<div dir="ltr">Hi all!<div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>So I did a simple test doing, regularspheremesh -> triangle2simplexmesh->simplex2trianglemesh->triangle2simplexmesh</div><div><br></div><div>and it would crash at the second triangle2simplexmesh filter. Am I doing something wrong?</div>
<div><br></div><div>Thank you all!</div><div><br></div><div><br></div><div><div><span class="" style="white-space:pre">        </span>// Some type defs</div><div><span class="" style="white-space:pre">        </span>typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double> TriangleMeshTraits;</div>
<div><span class="" style="white-space:pre">        </span>typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double> SimplexMeshTraits;</div><div><br></div><div><span class="" style="white-space:pre">        </span>typedef itk::Mesh< float, 3 > MeshType;</div>
<div><span class="" style="white-space:pre">        </span>typedef itk::Mesh<double,3, TriangleMeshTraits><span class="" style="white-space:pre">                </span>TriangleMeshType;</div><div><span class="" style="white-space:pre">        </span>typedef itk::SimplexMesh<double,3, SimplexMeshTraits> SimplexMeshType;</div>
</div><div><br></div><div><div><span class="" style="white-space:pre">        </span>typedef itk::RegularSphereMeshSource< TriangleMeshType ><span class="" style="white-space:pre">        </span>MeshSourceType;</div><div><span class="" style="white-space:pre">        </span>typedef itk::TriangleMeshToSimplexMeshFilter<TriangleMeshType, SimplexMeshType> SimplexFilterType;</div>
<div><span class="" style="white-space:pre">        </span>typedef itk::SimplexMeshToTriangleMeshFilter<SimplexMeshType, TriangleMeshType> TriangleFilterType;</div></div><div><br></div><div><span class="" style="white-space:pre">        </span>meshSource = MeshSourceType::New();<br>
</div><div><div><span class="" style="white-space:pre">        </span>meshPointType center;</div><div><span class="" style="white-space:pre">        </span>center.SetElement(0,0);<span class="" style="white-space:pre">                </span>center.SetElement(1,0);<span class="" style="white-space:pre">                </span>center.SetElement(2,0);</div>
<div><span class="" style="white-space:pre">        </span>meshSource->SetCenter( center );</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>meshPointType::ValueType radius[3] = {5,5,5};</div>
<div><span class="" style="white-space:pre">        </span>meshVectorType scale = radius;</div><div><span class="" style="white-space:pre">        </span>meshSource->SetScale( radius );</div><div><span class="" style="white-space:pre">        </span>meshSource->SetResolution( 5 );</div>
<div><span class="" style="white-space:pre">        </span>meshSource->Update();</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>meshSource->GetOutput()->Print( std::cout);</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>// Convert triangle to simple mesh</div><div><span class="" style="white-space:pre">        </span>SimplexFilterType::Pointer m_SimplexFilter = SimplexFilterType::New();</div>
<div><span class="" style="white-space:pre">        </span>m_SimplexFilter->SetInput( meshSource->GetOutput() );</div><div><span class="" style="white-space:pre">        </span>m_SimplexFilter->Update();</div><div> // Save the Simplex mesh </div>
<div><span class="" style="white-space:pre">        SimplexMeshType::Pointer </span>m_SimplexMesh = m_SimplexFilter->GetOutput();</div><div><span class="" style="white-space:pre">        </span>m_SimplexMesh->DisconnectPipeline();</div>
<div><br></div><div><span class="" style="white-space:pre">        TriangleFilterType::Pointer </span>m_SimplexToTriangle = TriangleFilterType::New();</div><div><span class="" style="white-space:pre">        </span>m_SimplexToTriangle->SetInput(m_SimplexMesh);</div>
<div><span class="" style="white-space:pre">        </span>m_SimplexToTriangle->Update();</div><div><br></div><div><div><span class="" style="white-space:pre">        </span>TriangleMeshType::Pointer triangleMesh = m_SimplexToTriangle->GetOutput();</div>
<div><span class="" style="white-space:pre">        </span>triangleMesh->DisconnectPipeline();</div></div><div><br></div><div><div><span class="" style="white-space:pre">        </span>// Convert triangle to simple mesh</div><div><span class="" style="white-space:pre">        </span>SimplexFilterType::Pointer<span class="" style="white-space:pre">        </span>m_SimplexFilter2 = SimplexFilterType::New();</div>
<div><span class="" style="white-space:pre">        </span>//m_SimplexFilter2->SetInput( vtk2itk.GetOutput());</div><div><span class="" style="white-space:pre">        </span>m_SimplexFilter2->SetInput( triangleMesh);</div><div><span class="" style="white-space:pre">        </span>m_SimplexFilter2->Update();</div>
</div></div></div>