[Insight-users] SpatialObjectToImageFilter or TriangleMeshToBinaryImageFilter?

Chris McIntosh cmcintos.sfu at gmail.com
Sun Sep 10 12:59:22 EDT 2006


Hi Tim,

>From my understanding the SpatialObjectToImageFilter is designed
to report 1 on the surface of the mesh and zero elsewhere as you
describe. This is based on my examination of the IsInside()
member function.

One option is to overwrite that function, and the other is to
use the TriangleMeshToBinaryImageFilter. Personally,
I've found the TriangleMeshToBinaryImageFilter to be quite
fast and straghtforward to use.

I've done both options in
http://www.sfu.ca/~cmcintos/IDO/doxygen/html/_geom___mesh_spatial_object_8cxx-source.html
.

---------------------
Geom_MeshSpatialObject< dType, nDims, MType, VType
><http://www.sfu.ca/~cmcintos/IDO/doxygen/html/classmial_1_1_geom___mesh_spatial_object.html>
::generateBinaryImageFromTopology<http://www.sfu.ca/~cmcintos/IDO/doxygen/html/classmial_1_1_geom___mesh_spatial_object.html>(
typename
Geom_MeshSpatialObject<dType,nDims,MType,VType>::BinaryImageType::SizeType<http://www.sfu.ca/~cmcintos/IDO/doxygen/html/classmial_1_1_geom___mesh_spatial_object.html>size)

This function uses the TriangleMeshToBinaryImageFilter. Ignore the commented
code, it was there to make use of
my attempt at writting a IsInside function. I've pasted whats relevant at
the bottom of this e-mail.

--------
void Geom_MeshSpatialObject< dType, nDims, MType, VType
>::generateTopologyFromBinaryImage( BinaryImageTypePointer binaryInputImage
)

This function shows how to go the other way (incase your interested).
---------------

I hope this helps.

-Chris


00350                 typename BinaryImageType::Pointer image =
BinaryImageType::New();
00351
00352                 typedef itk::TriangleMeshToBinaryImageFilter<
MeshType, BinaryImageType > meshToImageFilterType; 00353
typename meshToImageFilterType::Pointer meshToImageFilter =
meshToImageFilterType::New();
00354
00361
00362                 meshToImageFilter->SetSize( size );
00363
00364                 meshToImageFilter->SetInput(
theMeshSpatialObject->GetMesh() );
00365                 image = meshToImageFilter->GetOutput();
00366                 meshToImageFilter->Update();



On 9/10/06, advanced math <advanced.math at gmail.com> wrote:
>
> Dear all,
>
> I want to do Rasterization of a mesh to get a binary image. Seems
> there 2 classes could be used, SpatialObjectToImageFilter and
> TriangleMeshToBinaryImageFilter. Which one should I use? Which is
> faster?
>
> I've tried the SpatialObjectToImageFilter, but got very strange result.
> First, instead of a image inside mesh set to "1", outside the mesh set
> to "0", I got an image set to "1" on the surface of mesh, but "0" to
> the other part of the image.
>
> second, The class documentation indicates that by default, if the user
> does not specify the size of the output image, the size of the
> object's bounding box is used. However, what I got is an image much
> larger than the bounding box of the mesh object.
>
> Thanks,
> Tim Lee
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060910/ad184310/attachment.html


More information about the Insight-users mailing list