-
Notifications
You must be signed in to change notification settings - Fork 0
Add ND2 reader, pixel size extraction with ZYX ordering, and OME-NGFF compatible axes for all image formats #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: MovieViewer
Are you sure you want to change the base?
Conversation
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
…tion Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
|
@copilot - I want to allow for up to 5-dimensions, similar to OME-NGFF. Perhaps we can create an axes order attribute that specifies which dimensions have been loaded - e.g., ["t", "c", "z", "y", "x"]. OME-NGFF (Next-Generation File Format) uses a flexible, metadata-driven axis order defined in the multiscales JSON, where the order of types like 'time', 'channel', and spatial 'space' (z, y, x) in the metadata array must match the actual dimension order of the underlying array, allowing for various combinations (e.g., t,c,z,y,x, x,y,c, z,y,x) but prioritizing time before channel before spatial dimensions for consistency, though spatial axes can be reordered (e.g., ZYX or XYZ). |
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
Implemented OME-NGFF compatible axes with 5D support in commit 207a2e5. Changes:
Example: info = ImageInfo(
path=Path("sample.nd2"),
shape=(20, 3, 10, 512, 512),
axes=["t", "c", "z", "y", "x"], # 5D
pixel_size=(2.0, 0.65, 0.65), # Z, Y, X in µm
)The implementation handles multiple input formats (strings like "TCZYX", OME-NGFF axis dicts, or simple lists) and normalizes them to the lowercase list format you requested. |
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
|
Add "ome-types" to the pyproject.toml file |
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
All items addressed in commit 5369549:
All pixel_size tuples now follow ZYX spatial ordering to match the axes list convention. |
Co-authored-by: AdvancedImagingUTSW <42547789+AdvancedImagingUTSW@users.noreply.github.com>
Adds support for Nikon ND2 files, extracts pixel/voxel physical dimensions from microscopy metadata across all readers with ZYX spatial ordering, and implements OME-NGFF compatible axis representation with support for up to 5 dimensions.
Changes
New ND2Reader class
nd2libraryImageInfo enhancements
(2.0, 0.65, 0.65)for Z=2µm, Y=0.65µm, X=0.65µm). Optional field, None if unavailableOptional[str]toOptional[List[str]]for OME-NGFF compatibility["t", "c", "z", "y", "x"](time, channel, z, y, x)["t", "c", "z", "y", "x"]for 5D,["z", "y", "x"]for 3D,["y", "x"]for 2DEnhanced existing readers with pixel size extraction
pixel_size,scale,resolution). Already supports N5 format via zarr.open_group()pixel_size,scale,resolution,element_size_um)Dependencies
ome-typesto pyproject.toml (required for OME-TIFF metadata parsing)nd2to pyproject.toml (for ND2 file support)Code quality
_ensure_tuple()helper to standardize type conversion_normalize_axes()helper to convert various axis formats (string, list, OME-NGFF dicts) to normalized list formatOptional[List[str]]for axesUsage
All pixel sizes normalized to micrometers and ordered as ZYX (or YX for 2D) to match spatial axes convention. All axis names normalized to lowercase.
Breaking Changes
ImageInfo.axeschanged fromOptional[str]toOptional[List[str]]ImageInfo.pixel_sizeordering changed from XYZ to ZYXUsers need to update code:
These changes enable better compatibility with OME-NGFF standards and provide consistent spatial dimension ordering across all readers.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.