[Insight-users] Convert image's direction cosines to transform matrix

Dženan Zukić dzenanz at gmail.com
Tue Apr 27 09:06:09 EDT 2010


Hi everybody,

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?

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.

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 *outside* of the image.
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?
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?
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.

If anyone knows a better way to visualize a polygonal model alongside 3D
image, I would like to hear it.
Off topic question: is combining polygons with scalar fields so simple in
VTK to justify a switch from OSG to VTK?

Thanks to anyone who takes interest in this.

Best regards,
Dženan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100427/02bb6f62/attachment.htm>


More information about the Insight-users mailing list