Numpy bridge with image vectors

It seems to me that the numpy bridge does not work for “itk::Image<itk::Vector” types. For example, if I (manually) run the test test_NumPyBridge_itkVectorPixelImage, the convertedvectorImage is not of the same type as the vectorImage: it’s a scalar image instead of an image of vectors. Is this intended? Maybe PixelType should be redefined in itkPyBuffer.wrap for vector pixel types?

Hi Simon,

Good point. I will take a look.


@matt.mccormick I have created a PR that attempts to address this issue. Let me know what you think… As a side note, this PR does not address another problem I have observed: error messages thrown in the code, e.g., in _GetImageViewFromArray, are not properly caught by Python. I don’t know how to address this other issue.

1 Like