[vtkusers] Translate vtkImageData

shinaji t_shinaji at chiba-u.jp
Mon Nov 26 09:23:05 EST 2012


Finally, I did it like following.
If someone know faster and more smart way, let me know.
Thank you.

            numpyTumorArray =
numpy_support.vtk_to_numpy(tumorImageData.GetPointData().GetScalars())
            numpyTumorArray = numpy.roll(numpyTumorArray, -100)
            numpyTumorArray.reshape(tumorDim[0], tumorDim[1], tumorDim[2])
            vtkTumorArray = numpy_support.numpy_to_vtk(numpyTumorArray)
            tumorImageData.GetPointData().SetScalars(vtkTumorArray)

            sumFilter = vtk.vtkImageWeightedSum() 
            sumFilter.AddInput(phamtomImageData) 
            sumFilter.SetWeight(0,1) 
            sumFilter.AddInput(tumorImageData) 
            sumFilter.SetWeight(1,1) 
            sumFilter.Update()

           writer = vtk.vtkXMLImageDataWriter() 
           writer.SetFileName('sample.vti') 
           writer.SetInput(sumFilter.GetOutput()) 
           writer.Write() 



--
View this message in context: http://vtk.1045678.n5.nabble.com/Translate-vtkImageData-tp5717258p5717293.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list