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-&gt;GetOutput()-&gt;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> &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com
</a>&gt; 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>&nbsp;&nbsp;&nbsp;&nbsp;Regards,<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Luis<br><br><br>------------------------
<br>Michael Baltaxe wrote:<br>&gt; Hi guys,<br>&gt;<br>&gt; I want to transform an itk::SimplexMesh to a binary image, which tells<br>&gt; me which voxels are inside and which are outside the mesh. I found an<br>&gt; example regarding to this in the itkSoftwareGuide, which points to
<br>&gt; Examples/SpatialObjects/MeshSpatialObject.cxx. The problem is that the<br>&gt; execution of the example fails when it gets to:<br>&gt;<br>&gt; myMeshSpatialObject-&gt;IsInside(myPhysicalPoint)<br>&gt;<br>&gt; If I remove this line, then the execution fails in:
<br>&gt;<br>&gt; imageFilter-&gt;Update();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use the SpatialObjectToImageFilter<br>&gt; to create the binary image<br>&gt;<br>&gt; I am using ITK 3.2.0, Visual Studio 8 2005 x64, and Windows Vista x64<br>&gt; (compilation is in 64 bits and debug mode, although release mode results
<br>&gt; in the same).<br>&gt;<br>&gt; In any case I tried to use the SpatialObjectToImageFilter to create the<br>&gt; binary image, using a SphereMeshSource in my code as follows:<br>&gt;<br>&gt; m_SphereMeshSource-&gt;SetCenter(m_SeedPoint);
<br>&gt; m_SphereMeshSource-&gt;SetScale(sphereRadius);<br>&gt;<br>&gt; m_TriangleMeshToSimplexFilter-&gt;SetInput(m_SphereSource-&gt;GetOutput());<br>&gt; m_TriangleMeshToSimplexFilter-&gt;Update();<br>&gt; m_SimplexMesh = m_TriangleMeshToSimplexFilter-&gt;GetOutput();
<br>&gt; m_SimplexMesh-&gt;DisconnectPipeline();<br>&gt;<br>&gt; m_SpatialInfo = MeshSpatialObjectType::New();<br>&gt; m_SpatialInfo-&gt;SetMesh( m_SimplexMesh );<br>&gt;<br>&gt; typedef itk::SpatialObjectToImageFilter&lt; MeshSpatialObjectType,
<br>&gt; VolumeType &gt; SpatialObjectToImageFilterType;<br>&gt; SpatialObjectToImageFilterType::Pointer imageFilter =<br>&gt; SpatialObjectToImageFilterType::New();<br>&gt;<br>&gt; imageFilter-&gt;SetInput( m_SpatialInfo );
<br>&gt; imageFilter-&gt;Update();<br>&gt; itk::ImageFileWriter&lt;VolumeType&gt;::Pointer writer =<br>&gt; itk::ImageFileWriter&lt;VolumeType&gt;::New();<br>&gt; writer-&gt;SetFileName(&quot;foo.mhd&quot;);<br>&gt; writer-&gt;SetInput(imageFilter-&gt;GetOutput());
<br>&gt; writer-&gt;Update();<br>&gt;<br>&gt;<br>&gt; But I get an image filled with 0&#39;s (ie. no voxel is inside the mesh). I<br>&gt; know this is not the case, because I visually check that the mesh exists<br>&gt; and have a size.
<br>&gt;<br>&gt; What am I missing here?<br>&gt;<br>&gt; Thanks for your help as always,<br>&gt;<br>&gt; Michael.<br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>
&gt; _______________________________________________<br>&gt; Insight-users mailing list<br>&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users">
http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div><br>