Hi,<br><br>Thanks for the help Luis, it worked great.<br><br>I have another question concerning the creation of meshes: Is it possible that there is a bug in itkTriangleMeshToSimplexMeshFilter?<br><br>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.
<br><br>I appreciate any comments on this.<br><br>Thanks,<br><br>Michael.<br><br><div><span class="gmail_quote">On 8/27/07, <b class="gmail_sendername">Luis Ibanez</b> <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi Michael,<br><br>You may want to use the following filter:<br><br>
<a href="http://www.itk.org/Insight/Doxygen/html/classitk_1_1TriangleMeshToBinaryImageFilter.html">http://www.itk.org/Insight/Doxygen/html/classitk_1_1TriangleMeshToBinaryImageFilter.html</a><br><br>Rasterizing a Mesh is not as fast as to be
<br>implemented correctly in the IsInside method<br>of the StatialObject family.<br><br>Instead you may want to explicitly use the filter<br>recommended above.<br><br><br> Regards,<br><br><br> Luis<br><br><br>------------------------
<br>Michael Baltaxe wrote:<br>> Hi guys,<br>><br>> I want to transform an itk::SimplexMesh to a binary image, which tells<br>> me which voxels are inside and which are outside the mesh. I found an<br>> example regarding to this in the itkSoftwareGuide, which points to
<br>> Examples/SpatialObjects/MeshSpatialObject.cxx. The problem is that the<br>> execution of the example fails when it gets to:<br>><br>> myMeshSpatialObject->IsInside(myPhysicalPoint)<br>><br>> If I remove this line, then the execution fails in:
<br>><br>> imageFilter->Update(); // Use the SpatialObjectToImageFilter<br>> to create the binary image<br>><br>> I am using ITK 3.2.0, Visual Studio 8 2005 x64, and Windows Vista x64<br>> (compilation is in 64 bits and debug mode, although release mode results
<br>> in the same).<br>><br>> In any case I tried to use the SpatialObjectToImageFilter to create the<br>> binary image, using a SphereMeshSource in my code as follows:<br>><br>> m_SphereMeshSource->SetCenter(m_SeedPoint);
<br>> m_SphereMeshSource->SetScale(sphereRadius);<br>><br>> m_TriangleMeshToSimplexFilter->SetInput(m_SphereSource->GetOutput());<br>> m_TriangleMeshToSimplexFilter->Update();<br>> m_SimplexMesh = m_TriangleMeshToSimplexFilter->GetOutput();
<br>> m_SimplexMesh->DisconnectPipeline();<br>><br>> m_SpatialInfo = MeshSpatialObjectType::New();<br>> m_SpatialInfo->SetMesh( m_SimplexMesh );<br>><br>> typedef itk::SpatialObjectToImageFilter< MeshSpatialObjectType,
<br>> VolumeType > SpatialObjectToImageFilterType;<br>> SpatialObjectToImageFilterType::Pointer imageFilter =<br>> SpatialObjectToImageFilterType::New();<br>><br>> imageFilter->SetInput( m_SpatialInfo );
<br>> imageFilter->Update();<br>> itk::ImageFileWriter<VolumeType>::Pointer writer =<br>> itk::ImageFileWriter<VolumeType>::New();<br>> writer->SetFileName("foo.mhd");<br>> writer->SetInput(imageFilter->GetOutput());
<br>> writer->Update();<br>><br>><br>> But I get an image filled with 0's (ie. no voxel is inside the mesh). I<br>> know this is not the case, because I visually check that the mesh exists<br>> and have a size.
<br>><br>> What am I missing here?<br>><br>> Thanks for your help as always,<br>><br>> Michael.<br>><br>><br>> ------------------------------------------------------------------------<br>><br>
> _______________________________________________<br>> Insight-users mailing list<br>> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>> <a href="http://www.itk.org/mailman/listinfo/insight-users">
http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div><br>