Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use getFocusDirection when switching objects #197

Open
ianhi opened this issue Mar 7, 2022 · 1 comment
Open

use getFocusDirection when switching objects #197

ianhi opened this issue Mar 7, 2022 · 1 comment

Comments

@ianhi
Copy link
Collaborator

ianhi commented Mar 7, 2022

pymmcore-plus/napari-micromanager#119 added some logic to move the Z position on switching an objective

def _pre_change_hook(self) -> None:
if not self._mmc.getFocusDevice():
# drop focus motor
return
self._mmc.waitForDevice(self._device_label)
zdev = self._mmc.getFocusDevice()
self._previous_z = self._mmc.getZPosition()
self._mmc.setPosition(zdev, 0)
self._mmc.waitForDevice(zdev)

I think that in order to be fully safe that logic needs to check the focus device direction with core.getFocusDirection.

From the docs:

Returns +1 if increasing position brings objective closer to sample, -1 if increasing position moves objective away from sample, or 0 if unknown. (Make sure to check for zero!)

https://micro-manager.org/apidoc/MMCore/latest/class_c_m_m_core.html#ace092b60e0d8138c7c68cf6baebfc8af

If it's 0 then I think we can pop up a dialog asking what to do. For -1 I think the move it query the stage limits and then move to the max position.

(I have no sense of if any devices have -1 for this, but I'd hate to be person who found out that my device does :) )

@tlambert03
Copy link
Member

Yep sounds good. Note that pymmcore-plus/napari-micromanager#119 didn't add that, it's been there the whole time, just refactored there to maintain the existing behavior.

I agree that for a safety mechanism it makes too many assumptions... and as noted in the refactor, it also needs a preference (since moving anything should probably be opt in in some way)

@ianhi ianhi transferred this issue from pymmcore-plus/napari-micromanager Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants