[vtkusers] Conversion from ITK to VTK Coordinate spaces

David Gobbi david.gobbi at gmail.com
Tue May 9 13:06:40 EDT 2017


Hi Sam,

The question that you are asking does not have a straightforward answer,
because VTK doesn't actually define its coordinate space... in VTK you can
use whatever coordinate you want.

Since I work with DICOM images, I define my VTK world coordinate system to
be the DICOM patient coordinate system (that is, I follow the convention
that the +x direction is towards the left hand, the +z direction is towards
the head, and +y is towards the back).  This simplifies moving data between
ITK and VTK, because ITK uses the same coordinate system.

However, this means that whenever I read images into VTK, I must put the
images into this coordinate system.  So, for example, I wrote a class
called vtkDICOMToRAS (
https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMToRAS.h) to
convert images that are read by the vtkNIFTIImageReader from their native
coordinate system to the DICOM coordinate system.

Most of the VTK image readers assume that the user wants a RAS-like
coordinate system, but as I said, you are free to use whatever coordinate
system you desire inside VTK.  A lot of people prefer RAS because it means
they don't have to convert coordinate systems whenever they read an image.
I prefer using a DICOM coordinate system because I work a lot with DICOM
images, and it improves interoperability with ITK.

To kind-of sort-of answer your question, the general transformation between
an ITK (DICOM-like) coord system and a RAS coordinate system is as follows:

  -1  0  0  0
   0 -1  0  0
   0  0  1  0
   0  0  0  1

However, it's rarely that straightforward, because it really depends on how
the data was read into VTK.

 - David




On Tue, May 9, 2017 at 9:46 AM, <sganesan at cusa.canon.com> wrote:

>
> Hello
>
> I'm trying to write a function that can reasonably convert between ITK and
> VTK coordinate spaces. I have a given ITK transform with my 12 parameters,
> (3 fixed).
>
>        a        b      c    x
>
>        d      e       f     y
>
>        g      h        i     z
>
>         l      m       n    1
>
> where (a,b,c,d,e,f,g,h,i) represent my ITK matrix, (x,y,z) is my center,
> and (l,m,n) is my translation.
>
>
> How do I convert that to VTK format
>
>
>        a        b      c    o
>
>        d      e       f     p
>
>        g      h        i     q
>
>         0      0       0    1
>
> where (a,b,c,d,e,f,g,h,i) represent my VTK matrix,, and (o,p,q) is my
> translation.
>
> Is there a relatively straightforward way of doing this?
>
> Kind Regards,
> Sam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170509/da78d0f1/attachment.html>


More information about the vtkusers mailing list