vtkProbeFilter with oriented image

Hi all

Maybe a question for @lassoan

I have seen that vtkDiscreteMarchingCube has been updated for oriented image. And indeed the IndexToPhysicalMatrix is used through the TransformPoints method at the end of the method.

When I try to use the vtkProbeFilter using the output of discrete marching cube as input, and distance map computed before on the same image as source, the probe contains 0. The only solution is to set direction matrix to identity to all the images before the marching cube.

My images are NIFTI. I corrected the direction matrix using the QForm matrix:

Pipelines before the orientation (I already checked that these pipelines produce excepted results)
→ segment the images
→ compute distance map from segmentation
→ store all image results as nifti files

mat= vtk.vtkMatrix4x4()
direction = []
origin = []
for k in range(3):
    factor = -1 if k<2 else 1
    for j in range(3):

for i in range(3):
    factor = -1 if i<2 else 1



Probe Pipeline

probe_filter = vtk.vtkProbeFilter()

When displaying it using colormap, I have not distance displayed. When I change reset the orientation to Identity (not set the vtkDirectionMatrix for the images) I have the correct distance displayed.

Wondering if probe filter take into account the Direction matrix? Or if it is the marching cubes ? or a missing matrice inversion?
thanks in advance

I don’t think vtkProbeFilter is appropriate for this. If you want to resample an image in the coordinate system of another image then you can use vtkImageReslice.

If you want to probe a surface with an image (set point scalars based on image data) then vtkImageProbeFilter can be used. It relies on TransformPhysicalPointToContinuousIndex, so it should work well with an arbitrarily oriented image.

1 Like

thanks. I was thinking using the vtkImageProbeFilter. But not it is the probe indeed…