Software Autofocus in ZEN
Basically, the SWAF searches, with a pre-set z step size, within a given range of z values for the image plane that returns the maximal “sharpness” value. The step size or sampling rate of the SWAF is determined by the objective NA and wavelength (more details are given below). In turn the (automatic) search range is also largely determined by the objective NA – obviously optics dictate that higher NA objectives have smaller search ranges and vice versa. For SWAF to be useful for the application in question the image plane that returns the maximal sharpness should ideally be equivalent to the plane of interest in the sample – i.e. thus sample characteristics determine whether SWAF is the appropriate method to reliably detect the desired plane of observation. The component algorithms and functions of the SWAF, their relationships and the basic SWAF workflow are visualized schematically in the image below:
The SWAF run is driven and controlled by the Maximizer which in turn controls the z-drive and camera to acquire a sequence of images at predefined axial intervals. Each of these images is transferred in sequence to a merit function that calculates a sharpness value for the image. This value is returned to the maximizer where a table of sharpness values is maintained. The Maximizer searches for (using either unidirectional (“full”) or bidirectional (“smart”) axial travel) and determines when a maximal sharpness value is found. Next data fitting is performed locally around the returned maximum to refine its position. Subsequently, the SWAF sets this z-value as the resulting axial position of the z-drive. If no maximum is found the Maximizer detects an error condition and throws a corresponding exception (error message). In this case the z-drive returns to its position of origin, thus minimizing the likelihood of a sample/ objective collision incident.