BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
BioImager.Focus Class Reference

Public Member Functions

void SetFocus (double f)
 
double GetFocus ()
 
double GetFocus (bool update)
 
PointD GetSWLimit ()
 
void SetSWLimit (double xd, double yd)
 

Static Public Attributes

static double upperLimit
 
static double lowerLimit
 

Detailed Description

Definition at line 244 of file Microscope.cs.

Constructor & Destructor Documentation

◆ Focus()

BioImager.Focus.Focus ( )

Definition at line 249 of file Microscope.cs.

250 {
251
252 }

Member Function Documentation

◆ GetFocus() [1/2]

double BioImager.Focus.GetFocus ( )

This function returns the z-axis position

Returns
The z-axis position of the microscope.

Definition at line 292 of file Microscope.cs.

293 {
294 return GetFocus(false);
295 }
double GetFocus()

◆ GetFocus() [2/2]

double BioImager.Focus.GetFocus ( bool update)

If the microscope is a Prior, get the Z position from the SDK. If it's a MTB, get the Z position from the MTB SDK. If it's a PMicroscope, get the Z position from the PMicroscope SDK. If it's a custom microscope, get the Z position from the custom SDK

Parameters
updateboolean, if true, the focus is updated from the microscope
Returns
The z position of the microscope.

Definition at line 304 of file Microscope.cs.

305 {
306 if (Properties.Settings.Default.PMicroscope)
307 {
308 Point3D p;
309 Microscope.pMicroscope.GetPosition3D(out p, update);
310 return p.Z;
311 }
312 else if(Properties.Settings.Default.PycroManager)
313 {
314 Point3D p;
315 MicroManager.GetPosition3D(out p, update);
316 return p.Z;
317 }
318 if (Properties.Settings.Default.LibPath.Contains("MTB"))
319 {
320 BioImager.MicroscopeConsole.Command com = BioImager.MicroscopeConsole.RunCommand
322 return com.doubles[0];
323 }
324 if (Properties.Settings.Default.LibPath.Contains("Prio"))
325 {
326 return Microscope.sdk.GetZ();
327 }
328 if(Automation.Properties.ContainsKey("GetFocus"))
329 {
330 return (double)Automation.GetProperty("GetFocus");
331 }
332 return z;
333 }

◆ GetSWLimit()

PointD BioImager.Focus.GetSWLimit ( )

It gets the lower and upper limits of the focus axis

Returns
The return value is a PointD object.

Definition at line 338 of file Microscope.cs.

339 {
340 if (Properties.Settings.Default.LibPath.Contains("MTB"))
341 {
343 new BioImager.MicroscopeConsole.Command(BioImager.MicroscopeConsole.Command.Type.GetStageSWLimit, null));
344 upperLimit = com.doubles[0];
345 lowerLimit = com.doubles[1];
346 return new PointD(upperLimit,lowerLimit);
347 }
348 return new PointD(lowerLimit, upperLimit);
349 }

◆ SetFocus()

void BioImager.Focus.SetFocus ( double f)

Sets the z-axis based on microscope configuration.

Parameters
fthe focus value

Definition at line 257 of file Microscope.cs.

258 {
259 if (Recorder.recordMicroscope)
260 Recorder.AddLine("Microscope.Focus.SetFocus(" + f + ");");
261 if (Properties.Settings.Default.PMicroscope)
262 {
263 PointD p = Microscope.Stage.GetPosition(true);
264 Microscope.pMicroscope.SetPosition(new Point3D(p.X,p.Y,f));
265 }
266 else
267 if (Properties.Settings.Default.PycroManager)
268 {
269 PointD p = Microscope.Stage.GetPosition(true);
270 MicroManager.SetPosition(new Point3D(p.X, p.Y, f));
271 }
272 else
273 if (Properties.Settings.Default.LibPath.Contains("MTB"))
274 {
275 BioImager.MicroscopeConsole.RunCommand(
276 new BioImager.MicroscopeConsole.Command(BioImager.MicroscopeConsole.Command.Type.SetFocus,new double[] { f}));
277 z = f;
278 }
279 else if (Properties.Settings.Default.LibPath.Contains("Prio"))
280 {
281 Microscope.sdk.SetZ(f);
282 }
283 if (Automation.Properties.ContainsKey("SetFocus"))
284 {
285 Automation.SetProperty("SetFocus", f.ToString());
286 }
287 }

◆ SetSWLimit()

void BioImager.Focus.SetSWLimit ( double xd,
double yd )

The function takes two double values, xd and yd, and sets the upper and lower limits of the focus axis

Parameters
xdthe upper limit of the focus
ydthe lower limit of the focus

Definition at line 356 of file Microscope.cs.

357 {
358 if (Properties.Settings.Default.LibPath.Contains("MTB"))
359 {
360 BioImager.MicroscopeConsole.RunCommand(
362 new double[] { xd, yd }));
363 }
364 upperLimit = xd;
365 lowerLimit = yd;
366 if (Recorder.recordMicroscope)
367 Recorder.AddLine("Microscope.Focus.SetSWLimit(" + xd + "," + yd + ");");
368 }

Member Data Documentation

◆ lowerLimit

double BioImager.Focus.lowerLimit
static

Definition at line 247 of file Microscope.cs.

◆ upperLimit

double BioImager.Focus.upperLimit
static

Definition at line 246 of file Microscope.cs.


The documentation for this class was generated from the following file: