Skip to content

ENH: Add 2D cropping support and origin/spacing processing to ITK image readers#1511

Merged
joeykleingers merged 14 commits intoBlueQuartzSoftware:developfrom
joeykleingers:topic/CropImageGeometryParameter2D
Feb 6, 2026
Merged

ENH: Add 2D cropping support and origin/spacing processing to ITK image readers#1511
joeykleingers merged 14 commits intoBlueQuartzSoftware:developfrom
joeykleingers:topic/CropImageGeometryParameter2D

Conversation

@joeykleingers
Copy link
Contributor

@joeykleingers joeykleingers commented Jan 27, 2026

Summary

Enhances ITK image reading filters with 2D-aware cropping capabilities and configurable origin/spacing processing timing, providing more flexible image import workflows.

Key Changes

CropGeometryParameter Enhancement

  • Added is_2d flag to CropGeometryParameter to support 2D image cropping
  • Enables proper cropping of 2D images without Z-axis constraints

ITKImageReader & ITKImportImageStack Improvements

  • Added cropping options: Both filters now support voxel-based and physical subvolume cropping during image import
  • Origin & Spacing Processing parameter: New parameter controls whether user-specified origin/spacing values are applied before (preprocessed) or after (postprocessed) image reading and cropping
    • Preprocessed: Origin/spacing applied before cropping (affects crop bounds interpretation)
    • Postprocessed: Origin/spacing applied after cropping (simpler workflow)
  • Updated ReadImageUtils to handle cropping and origin/spacing processing timing

Testing

  • Completely rewrote ITKImageReaderTest and ITKImportImageStackTest to comprehensively test all code paths and feature interactions
  • Tests now validate all combinations of cropping, origin/spacing override, data type conversion, and processing timing

Testing Performed

  • All new test cases pass with exemplar validation
  • Tested 2D and 3D image cropping scenarios
  • Verified origin/spacing processing in both pre and post modes
  • Validated data type conversions with cropping

NOTE

This PR goes hand in hand with #1030 and should be approved and merged with it.

@joeykleingers joeykleingers added the enhancement New feature or request label Jan 27, 2026
@joeykleingers joeykleingers force-pushed the topic/CropImageGeometryParameter2D branch 2 times, most recently from 72d8e3b to dd59d60 Compare January 27, 2026 18:41
@imikejackson imikejackson force-pushed the topic/CropImageGeometryParameter2D branch from dd59d60 to 9ee9d79 Compare January 29, 2026 22:58
@joeykleingers joeykleingers force-pushed the topic/CropImageGeometryParameter2D branch 3 times, most recently from 102dae3 to abf5474 Compare February 3, 2026 15:41
@imikejackson imikejackson force-pushed the topic/CropImageGeometryParameter2D branch 2 times, most recently from a7649de to 52c888d Compare February 5, 2026 17:34
Copy link
Contributor

@imikejackson imikejackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the Read Zeiss TXM filter to have the preflight create the before and after for the input geometry.

joeykleingers and others added 12 commits February 6, 2026 09:02
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
…cks.

Also passed in NoCropping cropping options to Fiji Montage reader because
it uses the same ITK Image Reader execute API.  Still need to expose the
cropping options for Fiji Montage reader as a filter parameter.

Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
… stack reader.

This parameter determines whether the origin & spacing set by the user is set
before or after reading and cropping/processing the image(s).

Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
@imikejackson imikejackson force-pushed the topic/CropImageGeometryParameter2D branch from 3de8b2b to 22eb43c Compare February 6, 2026 14:03
…geometry.

Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
@joeykleingers joeykleingers enabled auto-merge (squash) February 6, 2026 18:55
@joeykleingers joeykleingers merged commit 40b270c into BlueQuartzSoftware:develop Feb 6, 2026
6 checks passed
@joeykleingers joeykleingers deleted the topic/CropImageGeometryParameter2D branch February 6, 2026 20:51
imikejackson pushed a commit to joeykleingers/simplnx that referenced this pull request Feb 7, 2026
…ge readers (BlueQuartzSoftware#1511)

Enhances ITK image reading filters with 2D-aware cropping capabilities and configurable origin/spacing processing timing, providing more flexible image import workflows.

CropGeometryParameter Enhancement
- Added `is_2d` flag to `CropGeometryParameter` to support 2D image cropping
- Enables proper cropping of 2D images without Z-axis constraints

ITKImageReader & ITKImportImageStack Improvements
- Added cropping options: Both filters now support voxel-based and physical subvolume cropping during image import
- Origin & Spacing Processing parameter: New parameter controls whether user-specified origin/spacing values are applied before (preprocessed) or after (postprocessed) image reading and cropping
  - Preprocessed: Origin/spacing applied before cropping (affects crop bounds interpretation)
  - Postprocessed: Origin/spacing applied after cropping (simpler workflow)
- Updated `ReadImageUtils` to handle cropping and origin/spacing processing timing

Testing
- Completely rewrote `ITKImageReaderTest` and `ITKImportImageStackTest` to comprehensively test all code paths and feature interactions
- Tests now validate all combinations of cropping, origin/spacing override, data type conversion, and processing timing

Testing Performed
- All new test cases pass with exemplar validation
- Tested 2D and 3D image cropping scenarios
- Verified origin/spacing processing in both pre and post modes
- Validated data type conversions with cropping
@imikejackson imikejackson restored the topic/CropImageGeometryParameter2D branch February 7, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants