New Autofocus Feature

I updated the pyseq code to include an autofocus feature. The routine does a rough scan of a section at a fixed objective position, then analyzes the out of focus image to find points to focus on, and finally does an objective stack at a number of points to find the optimal “in focus” objective position.

The update is on the GitHub and readthedocs.

Since I’m interested in imaging tissue sections, I don’t know where to focus on initially, hence the initial rough scan. Illumina does not do this because they already know where to focus on their patterned flow cells. For the automated control there are 4 autofocus routines: full, partial, full once, partial once. The full routine scans the entire section every round of imaging. The partial routine scans only the center of the section every round of imaging. Full once only scans the entire section the first round of imaging, and partial once only scans the center of the section the first round of imaging.

To determine the optimal “in focus” position of the objective, the system takes an objective stack, that is the camera continuously images an area as the objective moves away from the stage. The images in the objective stack are converted to jpegs because the filesize of the jpeg is a proxy for how “in focus” the image is, the larger the file size the more in focus. The jpeg filesize as a function of objective position is fitted to a gaussian, and objective position at the peak is called as the optimal “in focus” position.

The number of objective stacks at different points across the section increases as the size of the section increases. A minimum of 3 focus points are found, and the median objective position is used for the entire section.

Looking through the Illumina log files, I think they actually move the objective while taking imaging scans to account for any tilt in the flowcell. We may want to try to implement this too, but for me its not a priority at the moment. I also tried to develop a tilt correction routine with the tilt motors, but adjustments to the motors were insignificant. I’m probably doing something wrong.

1 Like