[vtkusers] Rotate vtkImage with vtkmatrix4x4

David Gobbi david.gobbi at gmail.com
Tue Mar 1 11:42:37 EST 2011


Hi Jothy,

When you say "doesn't rotate the image", do you mean that it does
nothing at all?  What are the elements of your direction cosines matrix?

Also, note that direction cosines matrix is a pure rotation matrix.
i.e. it rotates about (0,0,0).  You need to create a matrix that
rotates around a particular point in space.

 - David


On Tue, Mar 1, 2011 at 9:28 AM, Jothy <jothybasu at gmail.com> wrote:
> Thanks!
>
> Now my images appeasr like the one shown in figure.
>
> I need to rotate the image and dose about the ImagePositionPatient
> upside-down.
>
> I tried vtkImageFlip - it invalidates the dicom coordinate system and the
> dose and image doesn't match.
>
> I tried this
>
>       vtkMatrix4x4 *invert = vtkMatrix4x4::New();
>
>         invert->DeepCopy( imageReader->GetDirectionCosines());
>
>         invert->Invert();
>
>         vtkImageReslice *reslice = vtkImageReslice::New();
>
>         reslice->SetResliceAxes( invert );
>
>         reslice->SetInput(this->imageData);
>
>         reslice->Update();
>
>
> But it doesn't rotate the image.How to rotate the image?
>
> Thanks
>
> Jothy
>
>
> On Tue, Mar 1, 2011 at 4:07 PM, Jothy <jothybasu at gmail.com> wrote:
>>
>> But in this example FileLowerLeft is switched off.
>>
>> Thanks
>>
>> Jothy
>>
>> On Tue, Mar 1, 2011 at 3:50 PM, Mathieu Malaterre
>> <mathieu.malaterre at gmail.com> wrote:
>>>
>>> jothy, I think what you are looking for is already in gdcm, have a look
>>> at:
>>> gdcmreslice.cxx
>>>
>>> hth
>>> On Tue, Mar 1, 2011 at 4:31 PM, Jothy <jothybasu at gmail.com> wrote:
>>> > Hi all,
>>> >
>>> > I am trying to rotate vtkImageData using vtkMatrix4x4 about a point. is
>>> > there any example on how to do this?
>>> >
>>> > 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
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Mathieu
>>
>
>
> _______________________________________________
> 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
>
>



More information about the vtkusers mailing list