[Insight-users] Converting simplex meshes to triangle meshes
Luis Ibanez
luis.ibanez at kitware.com
Mon Aug 14 08:05:29 EDT 2006
Hi Alexander,
Please use the
itk::RegularSphereMeshSource
instead of the
itk::SphereMeshSource
as illustrated in the example:
Insight/Testing/Code/Algorithms
itkSimplexMeshVolumeCalculatorTest.cxx
The RegularSphereMeshSource produces a triangulation by subdividing
an Icosahedron, which results in a regular size for all the triangles
in the sphere. The SphereMeshSource generates a triangulation using
the squares of a latitude/longitude partition of the sphere, and
results in very thin triangles in the sphere poles.
You may also want to look at the files:
itkDeformableSimplexMesh3DBalloonForceFilterTest.cxx
itkDeformableSimplexMesh3DFilterTest.cxx
itkDeformableSimplexMesh3DGradientConstraintForceFilterTest.cxx
in the same directory.
and to the Application:
InsightApplications
DeformableModelSimplexMesh/
You will probably be interested too in the following paper and
associated code in the Insight Journal:
http://insight-journal.org/dspace/handle/1926/220
KWMeshVisu: A Mesh Visualization Tool for Shape Analysis
by
Oguz, Ipek
Gerig, Guido
Barre, Sebastien
Styner, Martin
Regards,
Luis
------------------------------------
Alexander Schmidt-Richberg wrote:
> 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;
> }
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list