Downsampling 3D image data in VTK without aliasing?

Hi, I would like downsample some 3D image data by a factor of 2 without introducing aliasing artifact as described here:

I am able to do the downsampling with vtkImageReslice.SetOutputSpacing. However, it doesn’t appear to apply an anti-aliasing filter before the downsampling. Is that correct? If so, is there an alternative method I can use that does apply an anti-aliasing filter?
thank you in advance,
-M

The easiest way to do antialiased resizing is with vtkImageResize. This filter will perform band-limited sinc interpolation. You can use it to adjust the spacing as follows (using Python as an example):

resize = vtkImageResize()
resize.SetResizeMethodToOutputSpacing()
resize.SetOutputSpacing(sx, sy, sz)

Alternatively, you can use an antialiased interpolator with vtkImageReslice, though this isn’t quite as efficient:

interpolator = vtkImageSincInterpolator()
interpolator.AntialiasingOn()

reslice = vtkImageReslice()
reslice.SetInterpolator(interpolator)
reslice.SetOutputSpacing(sx, sy, sz)

The idea here is that a windowed and stretched sinc kernel is used to perform the resizing with antialiasing.

2 Likes

Thanks, yet again @dgobbi! I will try using vtkImageResize and will let you know how it goes. :slight_smile:

vtkImageResize worked great! Chalk up another win for @dgobbi.