Pycro-Manager: open-source software for customized and reproducible microscope control

Henry Pinkard, Nico Stuurman, Ivan E. Ivanov, Nicholas M. Anthony, Wei Ouyang, Bin Li, Bin Yang, Mark A. Tsuchida, Bryant B. Chhun, Grace Zhang, Ryan Mei, Michael Anderson, Douglas P. Shepherd, Ian Hunt-Isaak, Raymond L. Dunn, Wiebke Jahr, Saul Kato, Löıc A. Royer, Jay R. Thiagarajah, Kevin W. Eliceiri, Emma Lundberg, Shalin B. Mehta, Laura WallerNature Methods 2021 · DOI · OpenAlex

Abstract

Pycro-Manager is an open-source bridge that brings the power of the Python ecosystem—including NumPy, SciPy, and modern machine learning libraries—to microscope control. By providing a high-level Python interface for the widely used $\mu$Manager (Micro-Manager) platform, it enables researchers to create complex, automated, and reproducible imaging workflows that can react to data in real-time.

Introduction

Modern microscopy is no longer just about "taking a picture"; it’s increasingly about real-time data processing and "smart" acquisition. For example, a microscope might need to detect a specific biological event (like a cell dividing) and automatically trigger a high-speed 3D scan.

However, a major "language barrier" exists: most microscope hardware drivers and control software are written in C++ or Java for performance, while the most advanced data analysis and AI tools are written in Python. Researchers often end up writing "one-off" custom scripts that are hard to share, prone to bugs, and difficult to adapt to different hardware. Pycro-Manager solves this by creating a unified, scriptable framework that connects the hardware-heavy world of Java/C++ with the data-science-friendly world of Python.

Architecture and Methods

Pycro-Manager isn't a ground-up rewrite of microscope control; instead, it leverages the massive library of existing hardware drivers in $\mu$Manager. Its core innovation is a translation layer that converts Java objects and functions into language-agnostic messages that appear in Python as native objects and NumPy arrays.

The Pycro-Manager architecture (a) bridges Java/C++ hardware control with Python, while the high-level interface (b, c) provides abstractions for events, hooks, and real-time image processing.

The software introduces three main abstractions for high-level programming:

  1. Acquisition Events: Python dictionaries or lists that define instructions for the hardware (e.g., "move to this Z-position," "use this filter," "snap an image").
  2. Acquisition Hooks: "Checkpoints" where users can inject custom Python code to run concurrently with hardware movements (e.g., waiting for an external sensor or adjusting a laser).
  3. Image Processors: A pipeline that gives users real-time access to image data as it is acquired, allowing for on-the-fly modification or "data-driven acquisition" (where the analysis of one image determines the settings for the next).

Performance and Key Results

As a software tool, Pycro-Manager is designed to handle the massive data outputs of modern imaging. The authors demonstrate that the system can handle multi-terabyte datasets and sustain acquisition speeds of over 1 GB/s, making it suitable for high-throughput and high-resolution applications.

Key results include:

  • Hardware Support: Immediate access to hundreds of existing "device adapters" (drivers) already available in the $\mu$Manager ecosystem.
  • High Throughput: Despite the translation layer, the system maintains high performance, capable of high-speed triggering and massive data throughput (>1 GB/s).
  • Community Integration: Successful implementations have been demonstrated in diverse fields, including light-sheet microscopy, computational microscopy, and machine-learning-integrated sample processing.

Discussion and Future Work

By decoupling logic from hardware, Pycro-Manager makes code much more readable and portable across different microscope setups. Because it works within Jupyter Notebooks, a researcher can bundle the hardware settings, the acquisition script, the analysis code, and the final results into a single, reproducible document. Furthermore, the "Image Processor" abstraction makes it trivial to implement feedback loops, turning the microscope into an active participant in the experiment rather than a passive recorder.

While Pycro-Manager bridges the gap to Python, it still relies on the underlying $\mu$Manager core. If a device doesn't have a $\mu$Manager driver, Pycro-Manager cannot control it directly without additional work. Future development points toward further integration with cloud-based analysis and more sophisticated real-time AI models for autonomous microscopy.

Summary updated

BibTeX
@inproceedings{pinkard2021pycro,
  author = {Henry Pinkard and Nico Stuurman and Ivan E. Ivanov and Nicholas M. Anthony and Wei Ouyang and Bin Li and Bin Yang and Mark A. Tsuchida and Bryant B. Chhun and Grace Zhang and Ryan Mei and Michael Anderson and Douglas P. Shepherd and Ian Hunt-Isaak and Raymond L. Dunn and Wiebke Jahr and Saul Kato and Löıc A. Royer and Jay R. Thiagarajah and Kevin W. Eliceiri and Emma Lundberg and Shalin B. Mehta and Laura Waller},
  title = {{Pycro-Manager: open-source software for customized and reproducible microscope control}},
  booktitle = {Nature Methods},
  year = {2021},
  doi = {10.1038/s41592-021-01087-6},
}
Figure