[vtkusers] Rotate vtkImageData

KS Jothybasu jothybasu at gmail.com
Mon Mar 15 10:57:47 EDT 2010


In my case the image center is [218.0732421875, 218.0732421875, 158.75],
which I got from ImageData.GetCenter()

So you mean to say, first I translate the image,do the rotation and
translate back.

Is that right?

Thanks

Jothy

On Mon, Mar 15, 2010 at 2:26 PM, Darshan Pai <darshanpai at gmail.com> wrote:

> If the imageCenter is not (0,0,0) you need to translate the image , do the
> rotation and translate back ..
>
> Regards
> Darshan
>
> On Mon, Mar 15, 2010 at 10:15 AM, KS Jothybasu <jothybasu at gmail.com>wrote:
>
>> Hi,
>>
>> I wanted to rotate the vtkImageData and I am using vtkTransform to do
>> that. But how to rotate around the Image centre. I get the Image centre from
>> vtkImagedata.GetCenter() method. But when I view the image it seems to be
>> shifted.Here is the code
>>
>> xform=vtk.vtkTransform()
>> xform.PostMultiply()
>> #xform.RotateWXYZ(10,218.0732421875, 218.0732421875, 158.75)
>> x,y,z=Image.GetCenter
>> xform.RotateWXYZ(50,x,y,z)# rotate 50 degs
>> res=vtk.vtkImageReslice()
>> res.SetInput(Image.GetOutput())
>> res.SetInformationInput(Image.GetOutput())
>> res.SetResliceTransform(xform)
>> res.SetInterpolationModeToLinear()
>> res.Update()
>>
>> Whats wrong??
>>
>> Thanks
>>
>> Jothy
>>
>> _______________________________________________
>> 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 VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100315/8e1df069/attachment.htm>


More information about the vtkusers mailing list