Again, just a bit more elaboration on the previous observation...<br><br>The size of the slice returned of course depends on the origin of rotation and the angle of rotation...<br><br>Now, how can I find out the dimensions of the slice that the vtkImageReslice will return...
<br><br>I do not know how the vtkImageViewer displays the slice but I
can see a clear translation on the lower left position of the slice but
when I query the vtkActor2D for the position it does not report a
change in its location!!!
<br><br>This is quite bizarre... I have almost had it with this
problem... my whole Saturday is wasted... If anyone could PLEASE help
me I would be really really grateful...<br><br>Thanks,<br><br>Anja<br><br><div><span class="gmail_quote">On 23/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;">Hi,<br><br>Another thing that I noticed is that after rotation the image seems to jump or internally translate..... However, the position of the actor remains the same.... This probably also affects my calculations as I try to transform the points to display space correctly...
<br><br>So, again if someone could suggest how I can adjust to this affect... it would be great...<br><br>Cheers,<div><span class="e" id="q_10ddb39cf5181d1a_1"><br>Anja<br><br><div><span class="gmail_quote">On 23/09/06,
<b class="gmail_sendername">Anja Ende</b> <<a href="mailto:anja.ende@googlemail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
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;">Ok, I have finally managed to get something working that works for normal transformation to the image->Display and vice versa...
<br><br>However, it returns bogus values when a slice is rotated along an axis...<br><br>-------------------------------------------------------------------------------------------------------
<br>Display ->Image Space...<br><br>// x, y, z are display coordinates<span><br><br>vtkMatrix4x4 * resliceMat = this->m_slicer->GetResliceAxes();<br></span>double axesTransform[4] = {x, y, z, 0.0};<br>
resliceMat->MultiplyPoint(axesTransform, axesTransform);
<br>double * tp = m_transform->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->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->GetLinearInverse()->TransformPoint(x, y, z);<span><br>vtkMatrix4x4 * resliceMat = this->m_slicer->GetResliceAxes();
<br></span>out[0] = tp[0];<br>out[1] = tp[1];<br>out[2] = tp[2];<br>out[3] = 0.0; <br>resliceMat->Invert(resliceMat, m_indexInv);<br>m_indexInv->MultiplyPoint(out, out);<br>---------------------------------------------------------------------------------------------
<br><br>I am really struggling with this, so any help would be really nice!<br><br>Thanks,<br><span>Anja</span><div><span><br><br><div><span class="gmail_quote">On 23/09/06,
<b class="gmail_sendername">Anja Ende</b> <<a href="mailto:anja.ende@googlemail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
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;">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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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><br>Anja</span><div><span><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>
</blockquote></div><br>
</span></div></blockquote></div><br>
</span></div></blockquote></div><br>