Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Python GetArrayViewFromImage doesn't raise error if used the wrong way #1566
The following code :
creates an invalid numpy array.
Raise any kind of error, or produce a valid numpy array.
Nothing happens immediately. Cannot be debugged. The software crashes later without any error (not even segfault).
Versions & Environment
ITK 5.0.1 with Python 3.7.4 64-bit on Windows 10 1909
Assigning the result in the second line is removing the original
There are two options:
Thanks for the reply @thewtex.
Do you have an idea about why such bug doesn't happen in pure Numpy ? Assigning a view to the original numpy array does not destroy the array. The code below doesn't make the python crash.
Even if we can't fix it, I think it is important to find the reason behind this weird behavior.