<br>Hi Dženan<br><br>This is indeed a common problem,<br>so, it is great that you bring it up.<br><br><br>Following the numbering of your questions:<br><br>a) No, there is no direct way of forcing the direction<br> matrix to be an identity. (and if there was such <br>
method we will strongly discourage you from using it)<br><br>b) You can change the direction matrix of the image,<br> by using the ChangeImageInformationFilter.<br> (but we strongly discourage you from doing so).<br>
<br>c) The RIGHT thing to do is to use the direction<br> matrix to correct the orientation of the isosurface<br> after you extract it. In that way, the iso-surface<br> will occupy the same coordinate system as the<br>
original image.<br><br><br>Options (a) and (b) are VERY dangerous if you are<br>dealing with real patient data.<br><br><br>Please find attached an example of how to do this<br>with ITK and VTK. You could directly use this example,<br>
or you can probably follow the math and apply the<br>equivalent processing using OSG.<br><br><br>You will find the full source code at:<br><br> InsightApplications/Auxiliary/vtk<br><br><br><br><br> Regards,<br>
<br><br> Luis<br> <br><br>---------------------------------------------------------------------<br><div class="gmail_quote">2010/4/27 Dženan Zukić <span dir="ltr"><<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi everybody,<div><br></div><div>I guess someone has dealt with a problem similar to mine before. I am doing segmentation in a magnetic resonance image. The result of my segmentation is a polygonal model. Problem: How to visualize the resulting polygonal model along with scalar-field image?</div>
<div><br></div><div>I use Qt, ITK and OpenSceneGraph. First I tried using osgVolume (ray-casting renderer) together with polygonal data in the same scene, but with that setup the depth information is lost. I resorted to using isosurface of the image instead of the image itself. It works, but I have to manage physical coordinates by myself - which is both a reinvention of the wheel and error-prone.</div>
<div><br></div><div>So I decided to use ITK's physical coordinate managing routines (TransformPhysicalPointToIndex), but I ran into a problem. GetDirection does not return identity matrix for my images (at least not for sagittal ones), therefore my segmented parts end up displayed <b>outside</b> of the image.</div>
<div>a) Is there a way to force image reading routines to load images into memory in such a way to have an identity matrix for directions?<br>b) If not, is there a way to transform image data (using a filter) to get an image with identity matrix as "directions". Is that filter ChangeInformationImageFilter?<br>
c) What is the proper way to construct a transformation matrix to be applied to the isosurface of the image (which was generated assuming identity matrix directions) in order to bring it to same coordinates I get when using TransformIndexToPhysicalPoint? Just using matrix returned by GetDirection and adding translation to account for origin does not work.</div>
<div><br></div><div>If anyone knows a better way to visualize a polygonal model alongside 3D image, I would like to hear it.</div><div>Off topic question: is combining polygons with scalar fields so simple in VTK to justify a switch from OSG to VTK?</div>
<div><br></div><div>Thanks to anyone who takes interest in this.</div><div><br></div><div>Best regards,</div><div>Dženan</div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>