Hi, I'm working on a python script to open MRI images in NIFTI format in paraview. I'm using "simple.ImageReader" to read the volume data. However, the file header specifies a 4x4 matrix which transforms voxel indices to coordinates in a reference coordinate system in mm, and I would like to use the mm coordinates in paraview.
There is a VTK thread on doing this (http://old.nabble.com/world-coordinates-and-image-data-td22217332.html) and the solution was to use "vtkImageReslice" together with a transform using "vtkMatrix4x4". However, the "vtkImageReslice" filter does not seem to be present in the VTK version that comes with ParaView (3.6.1-r1 on Gentoo). (Apart from this I couldn't figure out how to use VTK filters on "simple.ImageReader"). Since this didn't work, I tried a different method. The 4x4 matrix in the file is usually purely rotational and translational, I can extract the rotation and translation parameters for each dimension from the matrix and then simply rotate and shift the Image object. This can be done in Python using ... simple.Show(img) props = simple.GetDisplayProperties(img) props.Orientation = (180*alpha/pi, 180*beta/pi, 180*gamma/pi) props.Position = (tx, ty, tz) ... Where img is the "simple.ImageReader" object. This does rotate and translate the volume (image). However, the problem is that if apply a filter on it (e.g. Slice) the output of the filter is not shifted and translated, and thus does not appear at the same location as the image. I also tried using "simple.Transform" for the rotation and translation, but it looks like it doesn't support Image objects as input. Any hints on how to do this are greatly appreciated. Martin _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
