Ok, I have finally managed to get something working that works for normal transformation to the image-&gt;Display and vice versa...<br><br>However, it returns bogus values when a slice is rotated along an axis...<br><br>-------------------------------------------------------------------------------------------------------
<br>Display -&gt;Image Space...<br><br>// x, y, z are display coordinates<br><br>vtkMatrix4x4 * resliceMat = this-&gt;m_slicer-&gt;GetResliceAxes();<br>double axesTransform[4] = {x, y, z, 0.0};<br>resliceMat-&gt;MultiplyPoint(axesTransform, axesTransform);
<br>double * tp = m_transform-&gt;TransformPoint(axesTransform[0], axesTransform[1], axesTransform[2]);<br><br>// Out will contain the image coordinates<br><br>out[0] = tp[0];<br>out[1] = tp[1];<br>out[2] = tp[2];<br>out[3] = 
0.0;<br><br>--------------------------------------------------------------------------------<br>// Image-&gt;Display Space<br>This function works if the slice is not rotated...However, if the slice is rotated then the values are incorrect... I do not understand why as the rotation is reflected in the transformation matrix.
<br><br>// x, y, z are image coordinates<br>// out will contain the values in the display space... or so I hoped!<br><br>double * tp = m_transform-&gt;GetLinearInverse()-&gt;TransformPoint(x, y, z);<br>vtkMatrix4x4 * resliceMat = this-&gt;m_slicer-&gt;GetResliceAxes();
<br>out[0] = tp[0];<br>out[1] = tp[1];<br>out[2] = tp[2];<br>out[3] = 0.0;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  <br>resliceMat-&gt;Invert(resliceMat, m_indexInv);<br>m_indexInv-&gt;MultiplyPoint(out, out);<br>---------------------------------------------------------------------------------------------
<br><br>I am really struggling with this, so any help would be really nice!<br><br>Thanks,<br>Anja<br><br><div><span class="gmail_quote">On 23/09/06, <b class="gmail_sendername">Anja Ende</b> &lt;<a href="mailto:anja.ende@googlemail.com">
anja.ende@googlemail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">So, trying to use the reslice transform and reslice axes as suggested by David:
<br><br>I have an image with the following dimesnions: 256 X 256 X 62. It has been centered using vtkImageChangeInformation...<br><br>It has been scaled using the vtkTransform object by a factor of 2 in the X and Y direction..
<br><br>So, the transform matrix looks like this:<br><br>&nbsp; 0.5 0 0 0<br>&nbsp; 0 0.5 0 0<br>&nbsp; 0 0 1 0<br>&nbsp; 0 0 0 1<br><br><br>So, I click on the center of the image and I expect that the transformation back should give me the imnage coordinates in the original input image. So, I do the following:
<br><br>Input :255: 255: 62 (in pixels). Ignore the Z value... always 62<br><br>vtkImageData * in = reinterpret_cast&lt;vtkImageData *&gt;(this-&gt;m_slicer-&gt;GetInput());<br>in-&gt;UpdateInformation();<br><br> double origin[3];
<br>double spacing[3];<br>in-&gt;GetOrigin(origin);<br>in-&gt;GetSpacing(spacing);<br><br>// x = 255, y = 255, z = 62<br>// converting to world coordinates<br>double xt = origin[0] + spacing[0] * x;<br>double yt = origin[1] + spacing[1] * y;
<br>double zt = origin[2] + spacing[2] * z;<br><br>// Now transform the points....<br>double * tp = m_transform-&gt;TransformPoint(xt, yt, zt);<br><br>// Reslice axes of my reslicer <br>vtkMatrix4x4 * resliceMat = this-&gt;m_slicer-&gt;GetResliceAxes();
<br><br>// converting the transformed points back to display coordinates<br>double bx = (tp[0]&nbsp; - origin[0]) / spacing[0];<br>double by = (tp[1]&nbsp; - origin[1]) / spacing[1];<br>double bz = (tp[2]&nbsp; - origin[2]) / spacing[2];
<br><br>double inout[4] = {bx, by, bz, 0.0};<br>resliceMat-&gt;MultiplyPoint(inout, inout);<br><br>Now, I expected this to return:<br><br>127.5: 127.5: 62...center of the data...<br><br>Instead it returns:<br><br>191.75: 
191.25: 62 :((((<br><br>I know I am making some fundamental errors here...so if someone could please help me sort it out... I would be really grateful<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>Best,<br><br>Anja<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><br><div>
<span class="gmail_quote">
On 22/09/06, <b class="gmail_sendername">Anja Ende</b> &lt;<a href="mailto:anja.ende@googlemail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">anja.ende@googlemail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Yes, I, unfortunately, could not get any other way to work... As I said, I am trying to get the TransformPoints method to work, but with little success so far. <br><br>Could you point an example as to how to use the ResliceTransform and the ResliceMatrix??
<br><br>Cheers and thanks,<br><span><br>Anja</span><div><span><br><br><div><span class="gmail_quote">On 22/09/06, <b class="gmail_sendername">David Gobbi</b> &lt;<a href="mailto:dgobbi@atamai.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

dgobbi@atamai.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I should point out that the IndexMatrix is not a public member of the<br>class... and if you have a special version of vtkImageReslice that makes<br>this member public, you are using vtkImageReslice in a way that other<br>


people don't.<br><br>Why not just use the ResliceTransform and ResliceMatrix?<br><br> - David<br><br><br><br>Anja Ende wrote:<br>&gt; Forgot to mention...<br>&gt;<br>&gt; I am using the index matrix in the vtkImageReslice class to do the
<br>&gt; input-&gt;output mapping and vice versa (by using the inverse of the<br>&gt; matrix).<br>&gt;<br>&gt; Anja<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________
<br>&gt; This is the private VTK discussion list.<br>&gt; Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt; Follow this link to subscribe/unsubscribe:
<br>&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<br><br></blockquote></div><br>



</span></div></blockquote></div><br>

</blockquote></div><br>