Software control of a Nikon Ti Z-drive

Dear all,

I would like to control the Z-drive of a Nikon Ti microscope (without PFS) from a home-written program. (The program is in Python, but I don’t mind using other languages if necessary.) I have found and tried using various solutions: directly controlling the (undocumented?) Nikon.TiScope.NikonTi COM object via pywin32, or controlling the Z-drive via Micro-Manager and pymmcore or pycro-manager. In all cases I have found that the control is rather brittle: requests for position change (MoveRelative()/MoveAbsolute() on the COM object, or setPosition() on MMCore) only sometimes result in actual physical motion; even when it does, the position reported back (Position() on the COM object, or getPosition() on MMCore) often fails to correctly update (and in any case never includes the “custom” z-offset set on the microscope, although that’s a much less important issue that can be worked around); and, on top of that, the whole process crashes with Windows access violations every so often.

Are these problems that others here have seen before? Does anyone have a solution for more robust control of the Nikon Ti Z-drive?

Thanks in advance,

Antony

Hi Anthony,

Does the Ti Z-drive function correctly in straight up Micro-Manager (i.e., in the MM UI)? If it does, I am quite confused why it would not work correctly through the pycro-manager bridge (or using pycro-manager). If it does not, there is most likely some kind of version mis-match somewhere (between firmware and driver, or MM version requirement and driver). COM objects are very annoying to work with, they need their own “COM event loop”, and hooks for callbacks, so you would somehow need to provide all that from your Python code (but maybe someone has figured that out). I wish that we could share the MM Nikon TI adapter code for inspiration, but Nikon does not allow us to do so…