API Reference v9.2.0
Autofocusclass
Module: ZaberMotionMicroscopy
A generic autofocus device.
The following example illustrates how you can obtain an instance of this type:
import ZaberMotionAscii
import ZaberMotionMicroscopy
let connection = try await Connection.openSerialPort(portName: "COM3")
let microscope = try await Microscope.find(connection: connection)
let autofocus = microscope.autofocusRelated Guides:
Index
pProperties
Constructor
Autofocus(providerId, focusAxis, objectiveTurret)Creates instance of `Autofocus` based on the given provider id.
Arguments
| Name | Type | Description |
|---|---|---|
| providerId | Int | The identification of external device providing the capability. |
| focusAxis | Axis | The focus axis. |
| objectiveTurret | Device? | The objective turret device if the microscope has one. |
Properties
p
p
autofocus.objectiveTurretDevice? The objective turret device if the microscope has one.p
Methods
m
m
try await autofocus.getLimitMax(unit = Units.native)Gets the upper motion limit for the autofocus control loop. Gets motion.tracking.limit.max setting of the focus axis.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | The units of the limit. |
Return Value
Double Limit value.m
try await autofocus.getLimitMin(unit = Units.native)Gets the lower motion limit for the autofocus control loop. Gets motion.tracking.limit.min setting of the focus axis.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | The units of the limit. |
Return Value
Double Limit value.m
try await autofocus.getObjectiveParameters(objective)Returns the parameters for the autofocus objective.
Arguments
| Name | Type | Description |
|---|---|---|
| objective | Int | The objective (numbered from 1) to get the parameters for. If your microscope has only one objective, use value of 1. Note that the method temporarily switches current objective to get the parameters. |
Return Value
[NamedParameter] The parameters for the autofocus objective.m
try await autofocus.getStatus()Returns the status of the autofocus.
Return Value
AutofocusStatus The status of the autofocus.m
m
m
try await autofocus.setLimitMax(limit, unit = Units.native)Sets the upper motion limit for the autofocus control loop. Use the limits to prevent the focus axis from crashing into the sample. Changes motion.tracking.limit.max setting of the focus axis.
Arguments
| Name | Type | Description |
|---|---|---|
| limit | Double | The upper limit of the focus axis. |
| unit | Units | The units of the limit. |
m
try await autofocus.setLimitMin(limit, unit = Units.native)Sets the lower motion limit for the autofocus control loop. Use the limits to prevent the focus axis from crashing into the sample. Changes motion.tracking.limit.min setting of the focus axis.
Arguments
| Name | Type | Description |
|---|---|---|
| limit | Double | The lower limit of the focus axis. |
| unit | Units | The units of the limit. |
m
try await autofocus.setObjectiveParameters(objective, parameters)Sets the parameters for the autofocus objective. Note that the method temporarily switches current objective to set the parameters.
Arguments
| Name | Type | Description |
|---|---|---|
| objective | Int | The objective (numbered from 1) to set the parameters for. If your microscope has only one objective, use value of 1. |
| parameters | [NamedParameter] | The parameters for the autofocus objective. |
m
try await autofocus.startFocusLoop()Moves the focus axis continuously maintaining focus. Starts the autofocus control loop. Note that the control loop may stop if the autofocus comes out of range or a movement error occurs. Use WaitUntilIdle of the focus axis to wait for the loop to stop and handle potential errors.
m
m