I have derived a 4x4 transformation matrix t which I want to apply to a 3d vtkImageData.
To apply t to the imagedata I use vtkTransformFilter:
transform_filter = vtk.vtkTransformFilter() transform_filter.SetInputData(imgdata) transform_filter.SetTransform(t) transform_filter.Update()
If I create a contour of transform_filter it shows that the transformation is done correctly (since I know what the result should look like). However the light on the contour seems very weird, it is almost not visible.
I also tried applying t to the imagedata via vtkImageReslice:
resliced = vtk.vtkImageReslice() resliced.SetInputData(imgdata) resliced.SetAutoCropOutput(True) resliced.SetResliceTransform(t) resliced.SetInterpolationModeToLinear() resliced.Update()
However, when I create a contour of this result, the orientation of the object is different.
It seems applying transformation matrix t via vtkTransformFilter yields a different result from applying the same transformation matrix using vtkImageReslice. Therefore I was wondering if anybody would know what additional steps I would need to apply prior to transforming via vtkImageReslice to obtain the same result as with vtkTransformFilter.