Examples for microscope control, experiment configuration, image streaming, and guided acquisition.
These scripts can move hardware, acquire images, and change or overwrite experiment/output files. Review their settings before running on a microscope.
pixi_smartmic:default environment; see the
workshop setup.config.ini or my_config.ini; check the script’s selected path.From Windows CMD, launch a selected script using the workshop environment:
cd /d "F:\Pixi_Projects\zen_czi\smartmicroscopy"
pixi run --locked -e default python "examples\control_zen_via_zenapi\zenapi_streaming.py"
Replace the script name with the example you need. Most examples are configured inside their source rather than through command-line flags.
--help for arguments; see the
CMD example below.zenapi_guidedacq.py segments a saved overview and runs live detail scans for the detected regions. Optional settings collect run files and show a final comparison plot.
See the guided-acquisition README for setup, options, output locations, and the linked visual walkthrough, flowchart, and sequence diagram.
Keep gateway credentials private. Output locations vary by example; check the script and ZEN’s configured image output directory before acquisition.
Start a compatible ZEN installation with ZEN-API enabled and make the named
experiment available. Configure config.ini for your gateway
(or create the local my_config.ini if selected by your script).
The gateway INI is required; streaming dimensions come from ZEN’s exported
experiment metadata, not a separate streaming INI.
From the workshop root in CMD, start acquisition and write OME-Zarr:
pixi run --locked -e default python "examples\control_zen_via_zenapi\zenapi_stream2omezarr_experiment.py" ^
--experiment "00_ZEN_API_OMEZARR_Stream" ^
--zenapi-config "examples\control_zen_via_zenapi\config.ini" ^
--output-dir "results\zen-streaming" ^
--dtype uint16 ^
--czi-name "zenapi_stream" ^
--start-experiment ^
--no-overwrite-czi ^
--no-overwrite-zarr
^ continues a line; do not put spaces after it. Alternatively, join
the lines with spaces and remove the carets..czexp) and match --dtype to its pixels.
Quote paths with spaces. --output-dir affects OME-Zarr, not ZEN’s CZI location.--no-start-experiment (the default), launch the script,
then start the experiment in ZEN. Increase the default 30-second inactivity
timeout with --inactivity-timeout 120 if needed.--no-overwrite-* flags protect existing outputs; overwriting is otherwise
enabled by default.--validate-ome-zarr validates metadata; --pyramid-levels 3 adds
three downsampled levels afterward. Explicit sample-carrier wells select an
HCS plate layout by default.