[micro-manager-general] passing variables between runnables
Status: Beta
Brought to you by:
nicost
|
From: julou <tho...@no...> - 2020-04-30 08:44:50
|
Hi, I seek help to put together a script with runnables for plate acquisition with our Nikon Ti setup. We use the HCS plugin to create positions for image acquisition using the MDA functionality, but long-distance moves impose to look for focus beyond the range of PFS (and since the range we need to scan is large, HardwareFocusExtender is too slow). We have already established a procedure to find focus reliably. However, we have troubles when we want to acquire slices after having found the focus. In particular, while the slices of the first image are acquired as expected, the slices of the next positions are acquired at the wrong Z position. At the moment, I suspect that I fail at updating the value of a global variable from a runnable… Our script has 2 runnables, one called at every position which looks for the focus and stores the corresponding Z in a global variable, and one called at every slice to move the z drive to focus. Here is a stripped-down version: By setting `setPos` to a constant float value, I figured out that the slice offset is added to the position "automatically" i.e. despite always using the same value for setPosition(), getPosition() was moving around as expected from the slices settings of the MDA window. Now, if I use `setPos = ref_Z`, the following print() call has the correct value, but getPosition() returns weird values. In particular, starting from the second position, some slices seem to be at the ref_Z of the current position while others are at the ref_Z of the previous position. I don’t understand how print() calls the correct value, but getPosition() does not. Can they maybe be called in different thread where the variable have different values? This makes me suspect that I somehow don't manage to create ref_Z as a global position or that I should maybe use a modifier so that it's properly passed whenever the runnable runs. I would really appreciate help to understand this issue and achieve the expected behaviour. Thank you very much. Thomas -- Thomas Julou | Computational & Systems Biology | Biozentrum – University of Basel | Klingelbergstrasse 50/70 CH-4056 Basel | +41 (0)61 207 16 21 | https://julou.github.io/ ----- Thomas Julou | Computational & Systems Biology | Biozentrum – University of Basel | Klingelbergstrasse 50/70 CH-4056 Basel | +41 (0)61 267 16 21 -- Sent from: http://micro-manager.3463995.n2.nabble.com/ |