Downsampling a 3D image by 2 in all dimensions

Dear All,

I want to downsample a MHD (3D, RGB) image by 2 in all dimensions. But because the image is a surface the resulting image is sparse. Has VTK some function to do that with some king of filter (Raised Cosine (??)) that do not have that problem?

Thanks,

Luís Gonçalves.

Try vtkImageResize. It allows you to choose what filter (interpolator) to use.

  vtkNew<vtkImageSincInterpolator> interpolator;
  // Hann is another name for Raised Cosine
  interpolator->SetWindowFunctionToHann();
  // Perform antialiasing when downsampling
  interpolator->AntialiasingOn();

  vtkNew<vtkImageResize> resize;
  resize->SetInputData(imageData);
  resize->InterpolateOn();
  resize->SetInterpolator(interpolator);
  resize->SetResizeMethodToOutputDimensions();
  resize->SetOutputDimensions(newSize[0], newSize[1], newSize[2]);