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

ITK package requires numpy array be of order='C' before using ITK.GetImageFromArray #1243

Open
kyochujoho opened this issue Sep 10, 2019 · 0 comments

Comments

@kyochujoho
Copy link

commented Sep 10, 2019

Description

Regarding the conversion of Numpy arrays to ITK Images, I have found that an ITK package will report an error if the numpy array is not of order type 'C'. Specifically, when using an ITK Image that has been created from the conversion of a numpy array with itk.CoocurrenceTextureFeaturesImageFilter(), I will get the following error:

Requested region is (at least partially) outside the largest possible region.

Changing the numpy array to order 'C' resolved this issue. This doesn't seem to happen with arbitrarily created arrays using, for example, np.random.rand(), but does happen in my case with a pre-processed image.

Expected information

The proper format for a numpy array before conversion to ITKImage type.

Actual information

https://itkpythonpackage.readthedocs.io/en/latest/Quick_start_guide.html#mixing-itk-and-numpy

Versions

itk 5.0.1 pypi_0 pypi
itk-core 5.0.1 pypi_0 pypi
itk-filtering 5.0.1 pypi_0 pypi
itk-io 5.0.1 pypi_0 pypi
itk-numerics 5.0.1 pypi_0 pypi
itk-registration 5.0.1 pypi_0 pypi
itk-segmentation 5.0.1 pypi_0 pypi
itk-texturefeatures 3.2.2 pypi_0 pypi

Additional Information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.