vtkProbeFilter or vtkImageReslice question

Hello, we are trying to extract an oblique cross-section across a 3D image, i.e. a 2D image extracted from the colored volume in image below, oriented as the plane (a vtkPlane) highlighted in white.

We have tried in several ways with vtkCutter, vtkProbeFilter or vtkImageReslice.

vtkCutter works, but yield a vtkPolyData with non-regular spacing, and for some reason we’d like to get an image with regular spacing.

We have also triedto use a 2D image as the input object for vtkProbeFilter or vtkImageReslice (with the SetInformationInput option), but we are not able to extract any values, and the resulting image is generally filled with zeros…

… or with some strange values just at some points.

Could you point us to some relevant and working example?

Alternatively to using vtkProbeFilter or vtkImageReslice, we could also consider resampling the vtkPolyData obtained from vtkCutter in order to obtain an image with regular spacing, but we need advice also for this.


vtkImageReslice is the best choice - best speed and quality, and you can specify any output spacing you want. The API of this filter is somewhat different from most other VTK filters, in that it is somewhat redundant - there are several ways to achieve the same outcome - and not all settings are compatible.

I would recommend to check out vtkImageReslice examples in VTK examples or in applications such as ParaView or 3D Slicer. If you don’t find any then start from a VTK example, modify it as you think will work, and if it does not work as you expect then run it in a debugger, step by step, to see how exactly the output origin, spacing, axis directions, and extents are computed and why things go wrong.