[vtkusers] Rotate vtkImage with vtkmatrix4x4

Jothy jothybasu at gmail.com
Tue Mar 1 11:58:37 EST 2011


Yes it doesn't rotate at all!

My axial elements were

reslice->DeepCopy( imageReader->GetDirectionCosines());
reslice->SetElement(0,3,IPP[0]);
reslice->SetElement(1,3,IPP[1]);
reslice->SetElement(2,3,IPP[2]);

My images have

Image position: -275 -524 -122.441
Image Dims: 512 512 98
Image Origin: -275 -524 -122.441
ImageOrient: 1 0 -1.22465e-16 0 1 0





But this is changing only the y axis (some translation in Y). But no
rotation.

Any help is greatly appreciated.

Thanks again

Jothy

On Tue, Mar 1, 2011 at 4:42 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110301/5a572c66/attachment.htm>


More information about the vtkusers mailing list