Skip to content

fix: read Imaris .ims via direct HDF5 (multi-channel)#19

Merged
lguerard merged 1 commit into
mainfrom
fix/imaris-multichannel-read
Jun 23, 2026
Merged

fix: read Imaris .ims via direct HDF5 (multi-channel)#19
lguerard merged 1 commit into
mainfrom
fix/imaris-multichannel-read

Conversation

@lguerard

Copy link
Copy Markdown
Contributor

Real .ims files failed to convert (IndexError / broadcast error). The imaris-ims-file-reader array interface squeezes singleton dims, pads slices to chunk boundaries, and closes its file handle on GC — all of which break da.from_array.

Fix: read the underlying HDF5 Data datasets directly — open our own h5py.File (kept alive via the dataset refs in the dask graph), stack the per-(timepoint, channel) 3-D arrays, crop the Imaris chunk padding to the true extent. dask's default read lock makes the threaded h5py reads safe.

Verified on a real 5-D (1, 3, 115, 37716, 27277) 3-channel file: opens as czyx with correct µm calibration (z=0.35, y=x=0.108) and converts a crop without error. Suite green (29 passed), ruff clean.

🤖 Generated with Claude Code

Real .ims files broke conversion with an IndexError / broadcast error:
the imaris-ims-file-reader array interface squeezes singleton dims and
pads slices to chunk boundaries, which da.from_array can't handle, and
its file handle closes on GC (stale h5py reads under threads).

Read the underlying HDF5 Data datasets directly instead: open our own
h5py handle (kept alive by the dataset refs in the dask graph), stack
the per-(timepoint, channel) 3-D arrays, and crop the Imaris chunk
padding to the true extent the reader reports. dask's default read lock
makes the threaded h5py reads safe.

Verified on a real 5-D (1,3,115,37716,27277) 3-channel file: opens as
czyx with correct µm calibration and converts without error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lguerard lguerard merged commit a30f0ea into main Jun 23, 2026
1 check passed
@lguerard lguerard deleted the fix/imaris-multichannel-read branch June 23, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant