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 .czexp experiments

  • Saving 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 .czexp experiment 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:

  1. Overview acquisition and analysis

  2. Object-based navigation

  3. XY and Z reanalysis

  4. Adaptive experiment execution

  5. 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 .czexp experiment

  • manual – 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

class execute_python.PythonAnalysisRunner(config_path)[source]

Bases: object

Class responsible for the correct initialization of the main_processor Python script and loading correct arguments.

param str config_path: path to the localization of the config folder

run(**kwargs)[source]

Function for Python initialization :param dict kwargs: dictionary of the arguments for Python initialization :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: object

Class 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

overview_image_path(obj_id, name=None)[source]

returns: full path to the overview image

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.

result_dir(obj_id, stage=None, name=None)[source]

Return the result path based on object ID.

result_path(obj_id, stage, measurement, name=None)[source]

Return the result full file path based on object ID and the stage of experiment.

get_latest_fcs_and_raws()[source]

Finds the latest .fcs file in the Zen autosave folder, matches the corresponding .raw files by uuid and returns list of paths.