[Insight-users] TriangleMeshToSimplexMeshFilter - problem with different sources (vtkpolydata, stl file..)
Doyoung Chang
louis10th at gmail.com
Thu Sep 5 11:50:40 EDT 2013
Hi all!
I am trying to use the simplexDeformableModel filter and instead of using
the itk regular sphere mesh, I would like to use an initial mesh generated
by a 'vtkVoxelContoursToSurfaceFilter' so that the initial shape is closer
to the original shape.
However, when I generate a surface mesh using
'vtkVoxelContoursToSurfaceFilter' -> vtkPolyDataToitkMesh
->TriangleMeshToSimplexMeshFilter it would crash when I run it while
creating cells in the Triangle2simplex mesh filter.
So I did a simple test doing, regularspheremesh ->
triangle2simplexmesh->simplex2trianglemesh->triangle2simplexmesh
and it would crash at the second triangle2simplexmesh filter. Am I doing
something wrong?
Thank you all!
// Some type defs
typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double>
TriangleMeshTraits;
typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double>
SimplexMeshTraits;
typedef itk::Mesh< float, 3 > MeshType;
typedef itk::Mesh<double,3, TriangleMeshTraits> TriangleMeshType;
typedef itk::SimplexMesh<double,3, SimplexMeshTraits> SimplexMeshType;
typedef itk::RegularSphereMeshSource< TriangleMeshType > MeshSourceType;
typedef itk::TriangleMeshToSimplexMeshFilter<TriangleMeshType,
SimplexMeshType> SimplexFilterType;
typedef itk::SimplexMeshToTriangleMeshFilter<SimplexMeshType,
TriangleMeshType> TriangleFilterType;
meshSource = MeshSourceType::New();
meshPointType center;
center.SetElement(0,0); center.SetElement(1,0); center.SetElement(2,0);
meshSource->SetCenter( center );
meshPointType::ValueType radius[3] = {5,5,5};
meshVectorType scale = radius;
meshSource->SetScale( radius );
meshSource->SetResolution( 5 );
meshSource->Update();
meshSource->GetOutput()->Print( std::cout);
// Convert triangle to simple mesh
SimplexFilterType::Pointer m_SimplexFilter = SimplexFilterType::New();
m_SimplexFilter->SetInput( meshSource->GetOutput() );
m_SimplexFilter->Update();
// Save the Simplex mesh
SimplexMeshType::Pointer m_SimplexMesh = m_SimplexFilter->GetOutput();
m_SimplexMesh->DisconnectPipeline();
TriangleFilterType::Pointer m_SimplexToTriangle = TriangleFilterType::New();
m_SimplexToTriangle->SetInput(m_SimplexMesh);
m_SimplexToTriangle->Update();
TriangleMeshType::Pointer triangleMesh = m_SimplexToTriangle->GetOutput();
triangleMesh->DisconnectPipeline();
// Convert triangle to simple mesh
SimplexFilterType::Pointer m_SimplexFilter2 = SimplexFilterType::New();
//m_SimplexFilter2->SetInput( vtk2itk.GetOutput());
m_SimplexFilter2->SetInput( triangleMesh);
m_SimplexFilter2->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130905/efec7f38/attachment.htm>
More information about the Insight-users
mailing list