Hi guys,<br><br>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:
<br><br>myMeshSpatialObject-&gt;IsInside(myPhysicalPoint)<br><br>If I remove this line, then the execution fails in:<br><br>imageFilter-&gt;Update();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use the SpatialObjectToImageFilter to create the binary image
<br><br>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).<br><br>In any case I tried to use the SpatialObjectToImageFilter to create the binary image, using a SphereMeshSource in my code as follows:
<br><br>m_SphereMeshSource-&gt;SetCenter(m_SeedPoint);<br>m_SphereMeshSource-&gt;SetScale(sphereRadius);<br><br>m_TriangleMeshToSimplexFilter-&gt;SetInput(m_SphereSource-&gt;GetOutput());<br>m_TriangleMeshToSimplexFilter-&gt;Update();
<br>m_SimplexMesh = m_TriangleMeshToSimplexFilter-&gt;GetOutput();<br>m_SimplexMesh-&gt;DisconnectPipeline();<br><br>m_SpatialInfo = MeshSpatialObjectType::New();<br>m_SpatialInfo-&gt;SetMesh( m_SimplexMesh );<br><br>typedef itk::SpatialObjectToImageFilter&lt; MeshSpatialObjectType, VolumeType &gt; SpatialObjectToImageFilterType;
<br>SpatialObjectToImageFilterType::Pointer imageFilter = SpatialObjectToImageFilterType::New();<br><br>imageFilter-&gt;SetInput( m_SpatialInfo );<br>imageFilter-&gt;Update();<br>itk::ImageFileWriter&lt;VolumeType&gt;::Pointer writer = itk::ImageFileWriter&lt;VolumeType&gt;::New();
<br>writer-&gt;SetFileName(&quot;foo.mhd&quot;);<br>writer-&gt;SetInput(imageFilter-&gt;GetOutput());<br>writer-&gt;Update();<br><br><br>But I get an image filled with 0&#39;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.
<br><br>What am I missing here?<br><br>Thanks for your help as always,<br><br>Michael.<br>