Assuming we have a vtkImageData object under the name of image this is how we'd go about resampling that image data with a factor of 2. Here we assume that image has a spacing of 1.0 mm across all axes
resliceFilter = vtk.vtkImageReslice()
resliceFilter.SetInput(image)
resliceFilter.SetOutputSpacing(0.5, 0.5, 0.5)
resliceFilter.SetInterpolationModeToCubic()
resliceFilter.Update()
imageResampled = resliceFilter.GetOutput()
The resampled vtkImageData object is stored under imageResampled. Note that resampling is achieved by setting the output spacing to 0.5 mm through the SetOutputSpacing method.
While the above snippet uses cubic interpolation,
vtkImageResliceoffers nearest-neighbor and linear interpolation as well. All it takes is replacingSetInterpolationModeToCubicwithSetInterpolationModeToNearestNeighbororSetInterpolationModeToLinear