[Insight-users] creating simplex mesh from segmentation

gmail magicdelphis at gmail.com
Sat Jan 3 14:47:19 EST 2009


Hi

 

I want to create a simplex mesh from binary image (segmented volume) , with
predefined resolution (e.g. if a voxel is 1x1x1 mm create a mesh with 5mm
spacing between vertices)

 

I've used BinaryMask3DMeshSource to create a mesh and VTK to reduce the
number of vertices. 

 

I used the following code to do so :

 

                  typedef itk::DefaultStaticMeshTraits< double, 3, 3,
double,double >                                   TriangleMeshTraits;

                  typedef itk::DefaultStaticMeshTraits< double, 3, 3,
double,double >                                   SimplexMeshTraits;

                  typedef itk::Mesh< double, 3, TriangleMeshTraits >
TriangleMeshType;

                  typedef itk::SimplexMesh< double, 3, SimplexMeshTraits >
SimplexMeshType;

 

                  // Transform the triangle mesh to vtk  mesh 

                  typedef itkMeshTovtkPolyData< TriangleMeshType
TriangleMeshToPolyDataType;

 

                  TriangleMeshToPolyDataType *meshToPolyData = new
TriangleMeshToPolyDataType();

                  meshToPolyData->SetInput( INPUT_MESH );

 

                  // reduce vertices to 10% 

                  vtkDecimatePro *decimator = vtkDecimatePro::New();

                  decimator->SetInput( meshToPolyData->GetOutput() );

                  decimator->SetTargetReduction( 0.1 );

                  decimator->PreserveTopologyOff();

                  decimator->SplittingOn();

                  decimator->BoundaryVertexDeletionOn();

                  decimator->SetMaximumError( VTK_DOUBLE_MAX );

                  decimator->Update();

 

                  typedef vtkPolyDataToitkMesh< TriangleMeshType >
PolyDataToTriangleMeshType;

                  PolyDataToTriangleMeshType *polyDataToMesh = new
PolyDataToTriangleMeshType();

                  polyDataToMesh->SetInput( decimator->GetOutput() );

 

                  // Transform the triangle mesh to simplex mesh 

                  typedef itk::TriangleMeshToSimplexMeshFilter<
TriangleMeshType, SimplexMeshType >       TriangleToSimplexMeshType;

                  TriangleToSimplexMeshType::Pointer triangleToSimplex =
TriangleToSimplexMeshType::New();

                  triangleToSimplex->SetInput( polyDataToMesh->GetOutput()
);

                  triangleToSimplex->Update();

                  this->m_pMesh = triangleToSimplex->GetOutput();

 

here are my questions 

1)      usually there are more than 10% of the vertices - how can I have
less than 10% when I set it in the decimator ?

2)      I cannot set the spacing - need to be guessed from the data (in the
above example I want 1/5*1/5*1/5 = 0.008, which is too low for the decimator
is there a method to do so ?

3)      is there a process (maybe through VTK) that creates a mesh with the
desired resolution (e.g. if a voxel is 1x1x1 mm create a mesh with 5mm
spacing between vertices)

 

 

Thanks

 

Ori Hay

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090103/6833cdfe/attachment.htm>


More information about the Insight-users mailing list