I have a list of P positions in a MDA and would like to program Micromanager to make an Autofocus on only the first position of the list, and apply the offset to the P positions. I don’t want to do the autofocus on all the positions for technical reasons.
I have 2 different ideas to achieve that:
To create a beanshell runnable and attach it to my MDA. (As seen at the Janelia 2020 workshop with @nicost )
In this runnable would be:
-autofocus algorithm called at position 1 -> return z-offset
-apply the z-offset to the whole mm.positions()
Tweak the autofocus plugin so that it does:
-Compare the XY of the current position with the XY of the first position of the position list.
----If they are identical (or very close), run the routine, find the z-offset and apply it to the whole mm.positions()
----Else If the current position is different from the first position of the list, do nothing.
But since I’m a beginner in MM scripting, I was wondering if this sounds OK, or if an easier solution would exist, before starting the struggle .