Skip to content
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

Python readimage improvement series imageio #258

Conversation

fbudin69500
Copy link
Contributor

@fbudin69500 fbudin69500 commented Dec 4, 2018

This PR improves how images and image series are read using ITK Python.

Image series can now be read the same way single image files could already be read, relying on the automatic pixel type and image dimension detection. This can be done both by explicitly calling itk.ImageSeriesReader.New(FileNames=["xxx", "yyy"]) or by using the Pythonic function itk.imread(["xxx", "yyy"]) providing a list of images to the function.

When using itk.ImageFileReader.New() or itk.ImageSeriesReader.New() to read an image for which the pixel type and image dimension is automatically detected, one can now specify which image IO is going to be used. Previously, this could only be done if the pixel type and image dimension were manually specified; Otherwise, the image IO was selected automatically.

Copy link
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.

Awesome @fbudin69500 !

A minor documentation comment and probably want to update the commit message for the second commit -- as I see it, we just pass an array into itk.imread for a series, 👍 , instead of needing a different API call.

Wrapping/Generators/Python/Tests/extras.py Show resolved Hide resolved
Wrapping/Generators/Python/itkTemplate.py Show resolved Hide resolved
Wrapping/Generators/Python/Tests/extras.py Show resolved Hide resolved
Wrapping/Generators/Python/itkExtras.py Outdated Show resolved Hide resolved
Copy link

@SimonRit SimonRit left a comment

Choose a reason for hiding this comment

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

Nice improvement! Everything looks good to me.

Francois Budin added 3 commits December 5, 2018 20:48
When using itk.ImageFileReader to automatically select the image type
based on the image information, the user can now
itkTemplate image reading mechanism allows the user to not have to
select image type (pixel type and dimension). The same mechanism
now also works for image series.
If `itk.imread()` first argument is a list or a tuple, it will read
it as an image series. This can be used in combination with
`itk.NumericSeriesFileNames` for example.
@fbudin69500 fbudin69500 force-pushed the python_readimage_improvement_series_imageio branch from 65c4a6a to 379702b Compare December 6, 2018 01:53
@hjmjohnson
Copy link
Member

@fbudin69500 How does this differ from #259 ?

Copy link
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.

@SimonRit Stated approval, @thewtex gave positive resonse.

@hjmjohnson hjmjohnson merged commit be133dd into InsightSoftwareConsortium:master Dec 9, 2018
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.

None yet

4 participants