How to avoid the sawtooth from vtkImageReslice?

I find there is sawtooth for the output of vtkImageReslice, how can I avoid this sawtooth?

Any suggestion is appreciated!

Off the top of my head, have you tried vtkFlyingEdgesPlaneCutter ? It’s likely to be slower though… make sure you are building with threading enabled.

The interpolation in vtkImageReslice only interpolates between voxels within the image, but it does not interpolate between the image and the background. Because of this, the boundary between the image and the background is not smoothed.

One solution is to pad the image before using vtkImageReslice. The vtkImageConstantPad filter can be used for this. For example, if your image is 256x256,

auto pad = vtkSmartPointer<vtkImageConstantPad>::New();
pad->SetInputData(...); // (or SetInputConnection)
pad->SetExtent(-1, 256, -1, 256, 0, 0);

This requires a negative value to pad at the start of the image. Also note that for a 3D image the “0, 0” should be replaced by the z extent.

Padding with 1 pixel is good for linear interpolation, but if you are using cubic interpolation then a pad of 2 pixels should be used.

1 Like

Thank you for you kindly reply.