I am facing a problem calculating the volume of an ITK mesh.
Originally I have an image mask and converted this mask to a triangle mesh. In order to calculate the surface, I wanted to convert this mesh to a simplex mesh using:
typedef itk::SimplexMesh< float, 3 > TSimplex; typedef itk::TriangleMeshToSimplexMeshFilter< MeshType, TSimplex > TConvert; // Convert the triangle mesh to a simplex mesh. TConvert::Pointer convert = TConvert::New(); convert->SetInput(meshSource->GetOutput()); convert->Update();
As I found it in one example. But in this case my software starts calculating and never stops.
So, now I tried to calculate the volume by iterating over the cells and add these volumes. But is there maybe another way?
It is important that the volume is really the volume of the mesh and not a count of voxels of the binary mask.
I also tried using the LabelImageToShapeLabelMapFilter and the GetPhysicalSize() function. But there the values I got were not in line with the values of the volume of a mesh. But maybe I am wrong with this.
Thanks a lot in advance for your help