ZeissAPI
The ZeissAPI module provides the execution layer of the automated confocal
microscopy framework.
It is responsible for microscope control, experiment orchestration, GUI integration inside Zen Blue, and communication with external Python analysis processes.
The module consists of Zen macros (.czmac) and IronPython helper modules.
Overview
The ZeissAPI layer connects the Zen Blue microscope control software with the Python-based analysis pipeline.
Its main responsibilities include:
Executing automated acquisition workflows
Managing microscope stage and focus movements
Running overview scans and object-based reanalysis
Triggering adaptive and post-analysis experiments
Delegating computational analysis to external Python processes
—
Main Macro: main_macro.czmac
This macro defines the core acquisition logic and user interface.
It contains two main logical components: low-level API wrappers and the high-level acquisition pipeline.
ZeissApiProcessor
- class ZeissApiProcessor
A collection of static methods wrapping core Zen Blue API calls for microscope control and experiment execution.
Responsibilities:
Reading configuration files
Querying and updating stage and focus positions
Loading and executing
.czexpexperimentsSaving experiment results for imaging and spectroscopy
- get_stage_focus_position()
Return the current stage and focus position as
[x, y, z].
- move(points_to_move)
Move the microscope stage and focus to the specified coordinates.
- load_experiment(chosen_experiment)
Load and activate a
.czexpexperiment by name.
- execute_current_experiment()
Execute the currently active experiment.
- save_experiment_result(name, base_name=None)
Save experiment results using the configured directory layout.
—
AcquisitionPipeline
- class AcquisitionPipeline(object_visualization_experiment=None, reanalysis_dict=None, post_reanalysis_experiments=None, adaptive_experiment=None)
Implements a complete automated acquisition workflow.
The pipeline combines overview acquisition, object detection, spatial reanalysis (XY and Z), adaptive experiment execution, and post-processing measurements.
Main stages:
Overview acquisition and analysis
Object-based navigation
XY and Z reanalysis
Adaptive experiment execution
Post-analysis measurements
- acquire_overview(overview_experiment, analysis_args=None, name=None)
Execute an overview experiment and optionally trigger Python-based analysis.
- capture_objects(object_ids=None, name=None)
Perform visualization, reanalysis, and post-analysis experiments for detected objects.
- _perform_reanalysis_xy(obj_id, name=None)
Perform XY reanalysis of object position.
- _perform_reanalysis_z(obj_id, name=None, obj=None)
Perform Z reanalysis and update focus position.
—
Adaptive Experiments
The acquisition pipeline supports adaptive experiments, where experiment parameters are modified dynamically based on object properties obtained during analysis.
Adaptive behavior is implemented using user-defined Python functions executed before experiment runs.
An example adaptive function is fcs_zscan, which modifies the
center of a Z-scan based on the detected object radius.
—
Overview Grid Generation: find_overview_positions.czmac
AcquisitionGrid
- class AcquisitionGrid(mode='experiment', experiment_name='AI_sample_finder', manual_points=None)
Generates spatial grids for automated overview acquisition.
Supported modes:
experiment– read tile center positions from a.czexpexperimentmanual– generate a regular grid using plate-style coordinates
- calculate_points_for_overview()
Read tile center positions from the selected experiment.
- generate_grid_from_args()
Generate a regular grid based on manual configuration.
- save_overview_points()
Save generated grid points as a JSON file compatible with the acquisition pipeline.
—
Python Analysis Bridge
The following helper modules are implemented in IronPython.
execute_python
- execute_python.log(msg)[source]
Function for printing the logs to the txt file :param str msg: log to be printed :return: None
path_manager_main_macro
- path_manager_main_macro.log(msg)[source]
Function for printing the logs to the txt file :param str msg: log to be printed :return: None
- class path_manager_main_macro.PathManager(config_path)[source]
Bases:
objectClass responsible for the generation of the correct paths for the pipeline for saving files (JSON, czi, raw) in the correct directiories with correct names. A helping class for AcquisitionPipeline
- temp_file_path(obj_id, reanalysis_type=None, name=None)[source]
Return the temporary file path for measurement or reanalysis data based on object ID and reanalysis type.