[Insight-users] Binary image out of simple mesh

Michael Baltaxe mbaltaxe at gmail.com
Tue Aug 28 10:38:09 EDT 2007


Hi,

Thanks for the help Luis, it worked great.

I have another question concerning the creation of meshes: Is it possible
that there is a bug in itkTriangleMeshToSimplexMeshFilter?

I am creting a mesh with itkSphereMeshSource, and then I use
itkTriangleMeshToSimplexMeshFilter to transform it into a simplex mesh. I
have found that the call to CreateCells() within
TriangleMeshToSimplexMeshFilter::GenerateData() creates all the mesh
information, but leaves several cells empty in the end of m_CellsContainer.
Then, the call to this->GetOutput()->BuildCellLinks() (also in
TriangleMeshToSimplexMeshFilter::GenerateData() ) tries to acces cells that
have no information.

I appreciate any comments on this.

Thanks,

Michael.

On 8/27/07, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
>
> Hi Michael,
>
> You may want to use the following filter:
>
>
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1TriangleMeshToBinaryImageFilter.html
>
> Rasterizing a Mesh is not as fast as to be
> implemented correctly in the IsInside method
> of the StatialObject family.
>
> Instead you may want to explicitly use the filter
> recommended above.
>
>
>     Regards,
>
>
>         Luis
>
>
> ------------------------
> Michael Baltaxe wrote:
> > Hi guys,
> >
> > I want to transform an itk::SimplexMesh to a binary image, which tells
> > me which voxels are inside and which are outside the mesh. I found an
> > example regarding to this in the itkSoftwareGuide, which points to
> > Examples/SpatialObjects/MeshSpatialObject.cxx. The problem is that the
> > execution of the example fails when it gets to:
> >
> > myMeshSpatialObject->IsInside(myPhysicalPoint)
> >
> > If I remove this line, then the execution fails in:
> >
> > imageFilter->Update();           // Use the SpatialObjectToImageFilter
> > to create the binary image
> >
> > I am using ITK 3.2.0, Visual Studio 8 2005 x64, and Windows Vista x64
> > (compilation is in 64 bits and debug mode, although release mode results
> > in the same).
> >
> > In any case I tried to use the SpatialObjectToImageFilter to create the
> > binary image, using a SphereMeshSource in my code as follows:
> >
> > m_SphereMeshSource->SetCenter(m_SeedPoint);
> > m_SphereMeshSource->SetScale(sphereRadius);
> >
> > m_TriangleMeshToSimplexFilter->SetInput(m_SphereSource->GetOutput());
> > m_TriangleMeshToSimplexFilter->Update();
> > m_SimplexMesh = m_TriangleMeshToSimplexFilter->GetOutput();
> > m_SimplexMesh->DisconnectPipeline();
> >
> > m_SpatialInfo = MeshSpatialObjectType::New();
> > m_SpatialInfo->SetMesh( m_SimplexMesh );
> >
> > typedef itk::SpatialObjectToImageFilter< MeshSpatialObjectType,
> > VolumeType > SpatialObjectToImageFilterType;
> > SpatialObjectToImageFilterType::Pointer imageFilter =
> > SpatialObjectToImageFilterType::New();
> >
> > imageFilter->SetInput( m_SpatialInfo );
> > imageFilter->Update();
> > itk::ImageFileWriter<VolumeType>::Pointer writer =
> > itk::ImageFileWriter<VolumeType>::New();
> > writer->SetFileName("foo.mhd");
> > writer->SetInput(imageFilter->GetOutput());
> > writer->Update();
> >
> >
> > But I get an image filled with 0's (ie. no voxel is inside the mesh). I
> > know this is not the case, because I visually check that the mesh exists
> > and have a size.
> >
> > What am I missing here?
> >
> > Thanks for your help as always,
> >
> > Michael.
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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/20070828/619e43a1/attachment-0001.html


More information about the Insight-users mailing list