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

Support reading into ITK images (and not just SimpleITK images) #39

Open
aylward opened this issue Sep 2, 2021 · 0 comments
Open

Support reading into ITK images (and not just SimpleITK images) #39

aylward opened this issue Sep 2, 2021 · 0 comments

Comments

@aylward
Copy link

aylward commented Sep 2, 2021

ITK now directly supports python wrapping. The wrapping provided directly by ITK is arguably more Pythonic, and it expose the entire ITK library and all optional modules, whereas SimpleITK does not.

To install ITK Python:
pip install itk

It would be great if this library also provided a segment_itk_image() function that returned an ITK image and that let you specify the target pixel type. The function would be nearly identical to segment_image()

def segment_itk_image(self, number: int, ttype):
     result = itk.GetImageFromArray(self._segment_data[number].astype(ttype))
     result.SetOrigin(self.origin)
     result.SetSpacing(self.spacing)
     result.SetDirection(self.direction.ravel())
     return result
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

No branches or pull requests

1 participant