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> 0.5 0 0 0<br> 0 0.5 0 0<br> 0 0 1 0<br> 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<vtkImageData *>(this->m_slicer->GetInput());<br>in->UpdateInformation();<br><br> double origin[3];
<br>double spacing[3];<br>in->GetOrigin(origin);<br>in->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->TransformPoint(xt, yt, zt);<br><br>// Reslice axes of my reslicer <br>vtkMatrix4x4 * resliceMat = this->m_slicer->GetResliceAxes();
<br><br>// converting the transformed points back to display coordinates<br>double bx = (tp[0] - origin[0]) / spacing[0];<br>double by = (tp[1] - origin[1]) / spacing[1];<br>double bz = (tp[2] - origin[2]) / spacing[2];
<br><br>double inout[4] = {bx, by, bz, 0.0};<br>resliceMat->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> <br>Best,<br><br>Anja<br> <br><br><div><span class="gmail_quote">
On 22/09/06, <b class="gmail_sendername">Anja Ende</b> <<a href="mailto:anja.ende@googlemail.com">anja.ende@googlemail.com</a>> 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 class="sg"><br>Anja</span><div><span class="e" id="q_10dd7be55e7bcb39_2"><br><br><div><span class="gmail_quote">On 22/09/06, <b class="gmail_sendername">David Gobbi</b> <<a href="mailto:dgobbi@atamai.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
dgobbi@atamai.com</a>> 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>> Forgot to mention...<br>><br>> I am using the index matrix in the vtkImageReslice class to do the
<br>> input->output mapping and vice versa (by using the inverse of the<br>> matrix).<br>><br>> Anja<br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________
<br>> This is the private VTK discussion list.<br>> 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>> Follow this link to subscribe/unsubscribe:
<br>> <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>><br><br></blockquote></div><br>
</span></div></blockquote></div><br>