[Insight-users] SpatialObjectToImageFilter or TriangleMeshToBinaryImageFilter?

advanced math advanced.math at gmail.com
Mon Sep 11 05:26:26 EDT 2006


Hi Chris,

Thank you for your answers.
I've tried the TriangleMeshToBinaryImageFilter class in the way you
suggested. I found that some of mesh input is OK, but some others not.

The mesh output from RegularSphereMeshSource class can be used to
generate binaryimage correctly. However, when I use the mesh generated
through AutomaticTopologyMeshSource class, the
TriangleMeshToBinaryImageFilter failed and generated exceptions.

Is there any requirements of mesh input?

Thanks,

Tim


On 9/11/06, Chris McIntosh <cmcintos.sfu at gmail.com> wrote:
>
> 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 >
> ::generateBinaryImageFromTopology( typename
> Geom_MeshSpatialObject<dType,nDims,MType,VType>::BinaryImageType::SizeType
> 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
>
>


More information about the Insight-users mailing list