I am having some doubts on vtkImageReslice. I am working in python. I would like not just to resample the image but also to crop the result to a box of size (10,10,20) centered in the origin (the box is much smaller than the original image). I could move and rotate as I wanted, but I could not manage to crop the final image (I guess by using something like
reslice.SetOutputExtent(-5,5,-5,5,-10,10) but this does not work)
I am making a downsample and need to conserve the integral of the scalars. The original image has a spacing that depends on the run but in general is of (0.9,0.9,3) and the output of the reslice is (4,4,4), I need that the output image values of the reslice have the integral of the resampled scalars . Is that possible? How
vtkImageReslice does interpolate while downsampling?
I do not only need to show the resulting image, but also get the output values for processing.
I am working with an image data named
imdata, and the translation and rotation I need for the image is in a 4x4 numpy array named
affineMatrix. The relevant part of the code is:
reslice = vtk.vtkImageReslice() reslice.SetInputData(imdata) #reslice.SetOutputSpacing(self.imdata.GetSpacing()) reslice.SetOutputSpacing(4,4,4) reslice.SetInterpolationModeToLinear() matrix = vtk.vtkMatrix4x4() matrix.DeepCopy(list(affineMatrix.flatten())) reslice.SetResliceAxes(matrix) reslice.Update()