[vtkusers] [Gdcm2] Rotate vtkImage with vtkmatrix4x4

Mark Roden mmroden at gmail.com
Thu Mar 3 09:46:36 EST 2011


Hi Jothy,

I've solved this in the past by using cascading image flips.  The
dicom coordinate system will be modified by this approach, so when you
write the results out, you have to reverse all the flips.

There are two flips.

The first flips the image into the right space for rtstructs to
overlay the original image.  As I've said in the past, DICOM specifies
the upper left coordinate of each image, while VTK will reorder the
image coordinates based on the orientation vectors.  You're not
dealing with rtstructs, and I'm not sure how rtdose reacts (if it
needs the same flipping).

The second flip is for display purposes, as in, making sure that FFS,
HFS, etc images appear in the proper orientation.

Here is a previous post from November that contains my reading code in java:

http://www.vtk.org/pipermail/vtkusers/2010-November/113127.html

HTH,
Mark


On Tue, Mar 1, 2011 at 8: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
>>
>
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Gdcm-developers mailing list
> Gdcm-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdcm-developers
>
>



More information about the vtkusers mailing list