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->IsInside(myPhysicalPoint)<br><br>If I remove this line, then the execution fails in:<br><br>imageFilter->Update(); // 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->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, VolumeType > SpatialObjectToImageFilterType;
<br>SpatialObjectToImageFilterType::Pointer imageFilter = SpatialObjectToImageFilterType::New();<br><br>imageFilter->SetInput( m_SpatialInfo );<br>imageFilter->Update();<br>itk::ImageFileWriter<VolumeType>::Pointer writer = 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 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>