[Insight-users] Converting simplex meshes to triangle meshes

Alexander Schmidt-Richberg a_schmiri at web.de
Fri Aug 11 03:06:32 EDT 2006


Hello all,

I want to use the itk::DeformableSimplexMesh3DFilter for segmentation, 
but I have problems converting simplex meshes to triangle meshes. In my 
example code I simply generate a spherical triangle mesh, convert it to 
a simplex mesh and then re-convert it to a triangle mesh.
I get the following output:

Creating deformable mesh source...

Converting to simplex mesh... 

Converting to triangle mesh... 

error!!! 

Segmentation fault


I hope someone can help me, please find my code below.

Thanks a lot,

Alexander


typedef itk::DefaultStaticMeshTraits<double, 3, 3, double, double, double> TriangleMeshTraits;
typedef itk::DefaultStaticMeshTraits<double, 3, 3, double, double, double> SimplexMeshTraits;
typedef itk::Mesh<double,3,TriangleMeshTraits> TriangleMeshType;
typedef itk::SimplexMesh<double,3, SimplexMeshTraits> SimplexMeshType;

typedef itk::SphereMeshSource< 
        TriangleMeshType > MeshSourceType;
MeshSourceType::Pointer meshSource = MeshSourceType::New();

typedef itk::TriangleMeshToSimplexMeshFilter< 
        TriangleMeshType,
        SimplexMeshType > TriangleToSimplexType;
TriangleToSimplexType::Pointer triangleToSimplex = TriangleToSimplexType::New();

typedef itk::SimplexMeshToTriangleMeshFilter< 
        SimplexMeshType,
        TriangleMeshType > SimplexToTriangleType;
SimplexToTriangleType::Pointer simplexToTriangle = SimplexToTriangleType::New();


std::cout << "Creating deformable mesh source..." << std::endl;
// ... some parameters for the mesh source here
meshSource->Update();


std::cout << "Converting to simplex mesh... " << std::endl;
triangleToSimplex->SetInput( meshSource->GetOutput() );
try 
{
  triangleToSimplex->Update();
}
catch( itk::ExceptionObject & excep )
{
  std::cerr << "Exception Caught!" << std::endl;
  std::cerr << excep << std::endl;
}


std::cout << "Converting to triangle mesh... " << std::endl;
simplexToTriangle->SetInput( triangleToSimplex->GetOutput() );
try 
{
  simplexToTriangle->Update();
}
catch( itk::ExceptionObject & excep )
{
  std::cerr << "Exception Caught!" << std::endl;
  std::cerr << excep << std::endl;
}




More information about the Insight-users mailing list