Difference between revisions of "Team:Cambridge-JIC/Autofocus"
KaterinaMN (Talk | contribs) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 64: | Line 64: | ||
<li><p><b>Delays from moving the motor to receiving an updated frame</b> - this is a common issue with feedback loops, everywhere from biological systems to adjusting the temperature of the shower. Failure to deal with this can result in <b>oscillations</b> around the set point, with the image remaining just out of focus most of the time. We dealt with this by introducing a delay between sending a "move motor" command and a "read focus score" command to attempt to match the two. Reading a focus score when the motors were no longer moving is not an issue, but reading a value before the desired position has been reached is. Thus, it is beneficial to err on the side of an increased counter-delay, though at the expense of the time for autofocus to take place.</p></li> | <li><p><b>Delays from moving the motor to receiving an updated frame</b> - this is a common issue with feedback loops, everywhere from biological systems to adjusting the temperature of the shower. Failure to deal with this can result in <b>oscillations</b> around the set point, with the image remaining just out of focus most of the time. We dealt with this by introducing a delay between sending a "move motor" command and a "read focus score" command to attempt to match the two. Reading a focus score when the motors were no longer moving is not an issue, but reading a value before the desired position has been reached is. Thus, it is beneficial to err on the side of an increased counter-delay, though at the expense of the time for autofocus to take place.</p></li> | ||
<li><p><b>Unreliability of motor positioning</b> - when moving +400 steps and then -400 steps, there is no guarantee of returning to exactly the same position.</p></li> | <li><p><b>Unreliability of motor positioning</b> - when moving +400 steps and then -400 steps, there is no guarantee of returning to exactly the same position.</p></li> | ||
− | <li><p><b>Local maxima not being the global maxima</b> - A more theoretical issue than the practical ones above. Once reaching an area of high focus value, there is little guarantee that this is the most focused plane in the image. This is in contrast to the issue above - if we "give up" an area of high focus, we may find it difficult to retrieve it. We ignored this issue in favour of the more practical ones above - attempting to account for global maxima of focus scores would require the autofocus procedure to be far longer than desirable. We also implemented a naive threshold to stop moving the z axis once the focus was "good enough", a value for which | + | <li><p><b>Local maxima not being the global maxima</b> - A more theoretical issue than the practical ones above. Once reaching an area of high focus value, there is little guarantee that this is the most focused plane in the image. This is in contrast to the issue above - if we "give up" an area of high focus, we may find it difficult to retrieve it. We ignored this issue in favour of the more practical ones above - attempting to account for global maxima of focus scores would require the autofocus procedure to be far longer than desirable. We also implemented a naive dynamic threshold to stop moving the z axis once the focus was "good enough", a value for which is empirically derived.</p></li> |
<li><p><b>We settled for a hill-climbing approach</b>. Imagining the theoretical focus score for all possible z values on a graph may look like a hill. This algorithm attempts to "climb" that hill of focus scores. This algorithm assesses the focus scores of individual frames, moving in the direction where the focus is increasing. If the focus decreases, the motors are reversed in smaller increments. This process is repeated several times until an exit condition is reached.</p></li> | <li><p><b>We settled for a hill-climbing approach</b>. Imagining the theoretical focus score for all possible z values on a graph may look like a hill. This algorithm attempts to "climb" that hill of focus scores. This algorithm assesses the focus scores of individual frames, moving in the direction where the focus is increasing. If the focus decreases, the motors are reversed in smaller increments. This process is repeated several times until an exit condition is reached.</p></li> | ||
</ul> | </ul> | ||
Line 75: | Line 75: | ||
</ul></li> | </ul></li> | ||
<p>Gradient search, which is a simple technique to locate local extrema, was also attempted but did not give satisfactory results, as the learning rate required for convergence was slow. Also, noise from images drastically disrupted the calculations. This was a significant problem even when the gradient was calculated by taking multiple pictures around the point of interest. </p> | <p>Gradient search, which is a simple technique to locate local extrema, was also attempted but did not give satisfactory results, as the learning rate required for convergence was slow. Also, noise from images drastically disrupted the calculations. This was a significant problem even when the gradient was calculated by taking multiple pictures around the point of interest. </p> | ||
− | <center><img src="//2015.igem.org/wiki/images/d/da/CamJIC-Software-Autofocus-Example.jpg" style="width:40%;margin:10px"><img src="//2015.igem.org/wiki/images/b/b1/CamJIC-Software-Autofocus-Graph.png" style="width:40%;margin:10px"><p><i><b> | + | <center><img src="//2015.igem.org/wiki/images/d/da/CamJIC-Software-Autofocus-Example.jpg" style="width:40%;margin:10px"><img src="//2015.igem.org/wiki/images/b/b1/CamJIC-Software-Autofocus-Graph.png" style="width:40%;margin:10px"><p><i><b>Fig. 2:</b> Autofocus algorithm in action: the plot shows the increase of the variance (i.e. the focus score) of the image with each iteration.</i></p></center> |
<div style="width:220px;float:right"> | <div style="width:220px;float:right"> | ||
<img src="https://static.igem.org/mediawiki/2015/6/6c/CamJIC-Autofocus-Time.png" style="height:170px;width:200px;margin:10px;float:right"> | <img src="https://static.igem.org/mediawiki/2015/6/6c/CamJIC-Autofocus-Time.png" style="height:170px;width:200px;margin:10px;float:right"> | ||
− | <center><p style=><i><b>Fig. 3:</b> Indicative proportion of time spent in each phase of | + | <center><p style=><i><b>Fig. 3:</b> Indicative proportion of time spent in each phase of one implementation of an autofocus search</i></p></center></div> |
<p>The performance of the final autofocus algorithm varies, depending on the starting point of the search. A typical processing time is around 5s, which allows for autofocus during live-stream imaging through the <a href="//2015.igem.org/Team:Cambridge-JIC/Webshell" class="blue">Webshell</a>.</p> | <p>The performance of the final autofocus algorithm varies, depending on the starting point of the search. A typical processing time is around 5s, which allows for autofocus during live-stream imaging through the <a href="//2015.igem.org/Team:Cambridge-JIC/Webshell" class="blue">Webshell</a>.</p> | ||
<p>The autofocus algorithm we have implemented is open for further improvements and performance enhancement. Ideas for future development include:</p> | <p>The autofocus algorithm we have implemented is open for further improvements and performance enhancement. Ideas for future development include:</p> | ||
<ul> | <ul> | ||
− | <li><p>A | + | <li><p>A better hill climbing algorithm for finer focus after reaching the "almost focused stage"</p></li> |
<li><p>Automatic measurement of the actual height to the CCD</p></li> | <li><p>Automatic measurement of the actual height to the CCD</p></li> | ||
<li><p>More reliable motors use to improve precision</p></li> | <li><p>More reliable motors use to improve precision</p></li> | ||
</ul> | </ul> | ||
<hr> | <hr> | ||
− | <center><p><i>The Autofocus algorithm we have developed can be found in the <a href="" class="blue"> | + | <center><p><i>The Autofocus algorithm we have developed can be found in the <a href="https://2015.igem.org/Team:Cambridge-JIC/Downloads" class="blue">Downloads</a> page. The whole Software team contributed to its development.</i></p></center> |
<hr> | <hr> | ||
<p style="font-size:80%">References:<br>[1] Firestone, L., Cook, K., Culp, K., Talsania, N. and Preston, K. (1991). Comparison of autofocus methods for automated microscopy. <i>Cytometry</i>, 12(3), pp.195-206<br>[2] Wu, Q., Merchant, F. and Castleman, K. (2008). <i>Microscope image processing</i>. Amsterdam: Elsevier/Academic Press.</p> | <p style="font-size:80%">References:<br>[1] Firestone, L., Cook, K., Culp, K., Talsania, N. and Preston, K. (1991). Comparison of autofocus methods for automated microscopy. <i>Cytometry</i>, 12(3), pp.195-206<br>[2] Wu, Q., Merchant, F. and Castleman, K. (2008). <i>Microscope image processing</i>. Amsterdam: Elsevier/Academic Press.</p> |
Latest revision as of 00:54, 19 September 2015