This converter stitches 9 DM3 tile montages into a single OME-Zarr volume.
The input data consists of 9 montage folders (Montage_000 to Montage_008) arranged in a 3x3 grid:
Row 1 (top): Montage_006 | Montage_007 | Montage_008
Row 2 (middle): Montage_003 | Montage_004 | Montage_005
Row 3 (bottom): Montage_000 | Montage_001 | Montage_002
Each montage folder contains .dm3 files numbered sequentially, representing z-axis slices.
Install the required dependencies:
pip install -r requirements.txtpython converter.py <input_folder> <output_zarr>Example:
python converter.py ./data ./output.zarrYou can specify custom chunk sizes for the Zarr storage:
python converter.py ./data ./output.zarr --chunk-size 1 1024 1024The chunk size is specified as Z Y X dimensions.
Your input folder should have the following structure:
input_folder/
├── Montage_000/
│ ├── 0.dm3
│ ├── 1.dm3
│ ├── 2.dm3
│ └── ...
├── Montage_001/
│ ├── 0.dm3
│ ├── 1.dm3
│ └── ...
├── Montage_002/
│ └── ...
├── Montage_003/
│ └── ...
├── Montage_004/
│ └── ...
├── Montage_005/
│ └── ...
├── Montage_006/
│ └── ...
├── Montage_007/
│ └── ...
└── Montage_008/
└── ...
The output is an OME-Zarr file following the OME-Zarr 0.4 specification with:
- 3D volume (Z, Y, X)
- Compressed using Blosc/zstd
- Multiscale metadata for visualization
- Spatial coordinate system
- Automatic stitching: Tiles are automatically stitched in the correct spatial arrangement
- Progress tracking: Real-time progress bars for conversion
- Error handling: Robust error handling for missing files or montages
- Efficient storage: Chunked Zarr format with compression
- OME-Zarr compatible: Can be visualized with Neuroglancer, napari, and other OME-Zarr viewers
If some montage folders are missing, the converter will log warnings and leave those regions empty (zeros).
All tiles are expected to have the same dimensions. If tiles have different sizes, adjust the code accordingly.
The converter processes one z-slice at a time to minimize memory usage. Adjust chunk sizes if you encounter memory issues.