-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make SimpleITK dependency optional #497
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now that NumPy conversions have been fixed in SimpleITK (SimpleITK/SimpleITK#1687), remove this type mapping.
Surround SimpleITK type hints in quotes to avoid errors on load.
ITK requires world metadata to be set with the same shape as the current values. Adjust these values when replacing the NumPy array in a ITK or SimpleITK Image instance.
- Convert to list if a tuple - Convert docstrings to type hints - Add unit tests
- Add a library function that replaces as many values as possible by another sequence - Apply this function to replacing metadata in a SimpleITK/ITK Image instance
To support ITK in addition to SimpleITK when converting between arrays and image instances, use the conversion function instead.
Refactor transferring world info metadata from the function to replace the `Image` array to the world info matching function to make this transfer more generally available.
Support ITK in addition to SimpleITK type images.
Refactor measuring overlap between binarized images into the measure overlaps function to reduce redundancy and generalize support for SimpleITK and ITK images
- Allow using ITK in place of SimpleITK - Convert more docstring types to type hints - Showing the image is only supported in SimpleITK and not extended to ITK here
- Add a library function to load images based on the available library, using SimpleITK if it is available - Use this function when loading images with alternate extensions - Also apply to `edge_seq` and make SimpleITK optional for this module
Check for presence of SimpleITK before using it to show images. Applied to remaining instances of `sitk.Show`.
- Add an image write wrapper function to support both libraries - Apply to `export_rois`, removing SimpleITK import there
Use wrapper that supports ITK instead.
- Support ITK type hint for labels image in config - Catch import error for SimpleITK type hint
- Add an install group for SimpleITK and make this dependency optional - Use the custom pre-built SimpleITK with Elastix dependencies in this install group to continue supporting this registration pipeline
- Add doc for this install group - Alphabetize individual install groups
When ITK-based dependencies were added as an alternative for SimpleITK, both libraries were made to be optional for core functionality. Move the these ITK-based dependencies into an `itk` install group, which will also be included in the `most` and `all` groups. Also, make the SimpleITK group constant's name consistent with the other extra installs constants.
5 tasks
Also, add `itk` install group docs.
yoda-vid
added a commit
that referenced
this pull request
May 25, 2023
Also, add `itk` install group docs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #496. This PR change SimpleITK from a required to an optional dependency. Equivalent support for most SimpleITK functionality has been implemented through ITK-Elastix. I/O operations have been moved into wrapper functions that support both libraries, while #495 added support to ITK-Elastix in image registration functions.
To determine which library to use, the following approach is applied:
sitk.Image
oritk.Image