Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions converters/dm3_to_omezarr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# 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:

```bash
pip install -r requirements.txt
```

## Usage

### Basic Usage

```bash
python converter.py <input_folder> <output_zarr>
```

Example:
```bash
python converter.py ./data ./output.zarr
```

### Custom Chunk Size

You can specify custom chunk sizes for the Zarr storage:

```bash
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.
Loading