Skip to content

Latest commit

 

History

History
104 lines (77 loc) · 2.55 KB

File metadata and controls

104 lines (77 loc) · 2.55 KB

DM3 to OME-Zarr Converter

This converter stitches 9 DM3 tile montages into a single OME-Zarr volume.

Tile Organization

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.

Installation

Install the required dependencies:

pip install -r requirements.txt

Usage

Basic Usage

python converter.py <input_folder> <output_zarr>

Example:

python converter.py ./data ./output.zarr

Custom Chunk Size

You can specify custom chunk sizes for the Zarr storage:

python converter.py ./data ./output.zarr --chunk-size 1 1024 1024

The chunk size is specified as Z Y X dimensions.

Input Structure

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/
    └── ...

Output Format

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

Features

  • 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

Troubleshooting

Missing montage folders

If some montage folders are missing, the converter will log warnings and leave those regions empty (zeros).

Different tile sizes

All tiles are expected to have the same dimensions. If tiles have different sizes, adjust the code accordingly.

Memory usage

The converter processes one z-slice at a time to minimize memory usage. Adjust chunk sizes if you encounter memory issues.