[Insight-users] TriangleMeshToBinaryImageFilter with direction cosines different from identity

Dženan Zukić dzenanz at gmail.com
Wed May 26 08:26:22 EDT 2010


Update: by setting transform matrices to identity in order to experiment
with them, I notices that my code for using
DeformableMesh3DFilter was not wrong, but that filter does not respect
direction cosines either. With identity cosines it worked without weird
deformations I was experiencing with sagittal images.

And since many (most?) filters which deal with images ignore direction
cosines, again we come to the need of having a filter which will reorient
image pixels in order to have identity cosines matrix (DICOM LPS
orientation, ITK RAI orientation). And creating this filter does not have to
be considered admitting "ITK is not perfect", it can be considered as a
stopgap measure until all filters use TransformPhysicalPointToIndex and
other built-in transformation routines instead of custom (and incomplete)
transformation code (such as in TriangleMeshToBinaryImageFilter).

Regards,
Dženan

2010/5/26 Dženan Zukić <dzenanz at gmail.com>

> Hi everyone!
>
> While wrestling with DeformableMesh3DFilter, I wanted to create binary mask
> of my initial mesh (so I could use it with examples), but I ran into a
> problem. TriangleMeshToBinaryImageFilter is not designed to produce images
> with direction cosines matrix different from identity matrix. When I supply
> it with such an image and mesh which is valid with respect to ITK's physical
> coordinate handling routines (TransformPhysicalPointToContinuousIndex and
> friends), it crashes.
>
> typedef itk::TriangleMeshToBinaryImageFilter<MeshType,VisualizingImageType>
> MeshFilterType;
> MeshFilterType::Pointer meshFilter = MeshFilterType::New();
> meshFilter->SetInfoImage(visualizing); //TransformMatrix = 0 1 0 -0.0939968
> 0 -0.995573 -0.995573 0 0.0939968
> meshFilter->SetInput(mesh);
> meshFilter->Update(); //crashes
>
> For usage in examples, I can edit my transform matrix in .mha files and set
> it to identity, but what about normal usage? Is there some quick (and
> possibly dirty) way to get this right, or do I have to do all the math on
> paper in order to transform between representations with and without
> direction cosines?
>
> Thanks,
> Dženan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100526/51872961/attachment-0001.htm>


More information about the Insight-users mailing list