Skip to content

ENH: Add SimpleITK Image to ITK Image conversion support#6021

Draft
blowekamp wants to merge 1 commit intoInsightSoftwareConsortium:mainfrom
blowekamp:itk_simpleitk_conversion
Draft

ENH: Add SimpleITK Image to ITK Image conversion support#6021
blowekamp wants to merge 1 commit intoInsightSoftwareConsortium:mainfrom
blowekamp:itk_simpleitk_conversion

Conversation

@blowekamp
Copy link
Copy Markdown
Member

This PR introduces a "generic" interface for an "itk-like" python image object. The itk-like object can be converted to a numpy array and contains "spacing", "direction", and "origin" keys. This should be an interface both ITK and SimpleITK images provide.

Any thoughts on this type of interface?

  • Implement image_from_simpleitk() function for converting SimpleITK images to ITK images
  • Support 2D, 3D, and multi-component (vector) images
  • Preserve spacing, origin, and direction metadata
  • Preserve MetaData dictionary entries
  • Integrate SimpleITK support into filter auto-conversion decorator
  • Add comprehensive tests for conversion functionality

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@github-actions github-actions bot added type:Enhancement Improvement of existing methods or implementation area:Python wrapping Python bindings for a class type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct labels Apr 7, 2026
@hjmjohnson
Copy link
Copy Markdown
Member

@blowekamp I made a note this morning that this was going to be needed :)! You must have heard my thoughts!

@blowekamp
Copy link
Copy Markdown
Member Author

@dzenanz Raised this issue here: SimpleITK/SimpleITK#2531

Copy link
Copy Markdown
Member

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

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

Can you comment on the missing "Image buffer start index" that is missing?

Comment thread Wrapping/Generators/Python/itk/support/extras.py
Copy link
Copy Markdown
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

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

👍

- Implement image_from_simpleitk() function for converting SimpleITK images to ITK images
- Support 2D, 3D, and multi-component (vector) images
- Preserve spacing, origin, and direction metadata
- Preserve MetaData dictionary entries
- Integrate SimpleITK support into filter auto-conversion decorator
- Add comprehensive tests for conversion functionality
@hjmjohnson hjmjohnson force-pushed the itk_simpleitk_conversion branch from f3b51ac to 98916f9 Compare April 15, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Python wrapping Python bindings for a class type:Enhancement Improvement of existing methods or implementation type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants