Hello,
I also try to convert a 3D numpy array into VTK, but I do get some bugs. The array is an computed mask image from the original ultrasound image. The mask I want to apply over the original image in order to only show the region of interest in the ultrasound. I am able to visualize the original 3D volume, but applying the mask gives me a result with gaps.
For now I’m using a vtk.vtkImageImport() and np.transpose() for the array, with SetDataScalarTypeToUnsignedChar(), SetNumberOfScalarComponents(1), SetDataExtent(extend of original image), SetWholeExtent(extend of original image), SetDataSpacing(spacing of original image).
The output looks like this:
should I use vtkImageData? the gaps has to do something with the np.transpose() or how I set my dataspacing, but I tried a lot of things and this is the best result I got so far…