<div dir="ltr"><div>Hi Sam,</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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 (<a href="https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMToRAS.h">https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMToRAS.h</a>) to convert images that are read by the vtkNIFTIImageReader from their native coordinate system to the DICOM coordinate system.</div><div><br></div><div>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.</div><div><br></div><div>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:</div><div><br></div><div> -1 0 0 0</div><div> 0 -1 0 0</div><div> 0 0 1 0</div><div> 0 0 0 1</div><div><br></div><div>However, it's rarely that straightforward, because it really depends on how the data was read into VTK.</div><div><br></div><div> - David</div><div><br></div><div><br></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 9, 2017 at 9:46 AM, <span dir="ltr"><<a href="mailto:sganesan@cusa.canon.com" target="_blank">sganesan@cusa.canon.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font size="2" face="sans-serif"><br>
Hello </font>
<br>
<br><font size="2" face="sans-serif">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). </font>
<br>
<br><font size="2" face="sans-serif"> a
b c x
</font>
<br><font size="2" face="sans-serif">
</font>
<br><font size="2" face="sans-serif"> d
e f y
</font>
<br><font size="2" face="sans-serif">
</font>
<br><font size="2" face="sans-serif"> g
h i z
</font>
<br>
<br><font size="2" face="sans-serif"> l
m n 1 </font>
<br>
<br><font size="2" face="sans-serif">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.</font>
<br>
<br>
<br><font size="2" face="sans-serif">How do I convert that to VTK format
</font>
<br>
<br>
<br><font size="2" face="sans-serif"> a
b c o
</font>
<br><font size="2" face="sans-serif">
</font>
<br><font size="2" face="sans-serif"> d
e f p
</font>
<br><font size="2" face="sans-serif">
</font>
<br><font size="2" face="sans-serif"> g
h i q
</font>
<br>
<br><font size="2" face="sans-serif"> 0
0 0 1 </font>
<br>
<br><font size="2" face="sans-serif">where (a,b,c,d,e,f,g,h,i) represent
my VTK matrix,, and (o,p,q) is my translation. </font>
<br>
<br><font size="2" face="sans-serif">Is there a relatively straightforward
way of doing this?</font>
<br>
<br><font size="2" face="sans-serif">Kind Regards,</font>
<br><font size="2" face="sans-serif">Sam</font>
<br></blockquote></div></div></div>