Introducing Pycro-Manager

Hi everyone,

I’m very excited to announce the release of a project that Nico Stuurman and I have been working on, Pycro-Manager. As the name suggests, this package enables Python access to Micro-Manager. The access works through a behind-the-scenes high-speed bridge that dynamically “translates” between the Java and c++ parts of Micro-Manager and Python. This allows for Python users to use any of the existing Java/c++ APIs and plugins of micro-manager as if they had been written in pure Python. The translation between languages occurs dynamically at runtime, so any future development on the Java/c++ side will be available through Python as well.

Pycro-manager also has a flexible, high-level API to enable complex, customized data acquisition without having write all the boilerplate automation yourself. This can be used, for example, to synchronize external hardware with the acquisition process, modify acquired images on-the-fly before saving/visualization, implement your own customized data saving/visualization, and easily adapt acquisition in response to data.

If you’d like to learn more, please check out the documentation (https://pycro-manager.readthedocs.io/en/latest/). For any questions/suggestions/discussions, the best place is the Pycro-manager issues page (https://github.com/micro-manager/pycro-manager/issues).

Happy imaging,
Henry

12 Likes

Could you discuss the choice of using ZMQ here rather than a JNI-based bridge?

This is not a critique, I’m just generally interested in that approach.

Basically because ZMQ is really lightweight and easily to maintain. There’s not need to match versions between Java and Python sides, as all they need to know about is a message passing syntax on the ZMQ layer. This method is also robust to changes in the Java APIs. So if something gets added to Java side, it will be discovered at runtime by python side with no need for any changes. Maybe there are ways to do this with JNI also, but in my experience JNI is a major pain to work with, and is not platform independent making it harder to setup and maintain.

1 Like

And as an added bonus, you can run ZMQ across a network (acquire on one computer, analyze on another)

2 Likes