# Problem calculating volume ITK mesh

Dear all,

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.

Elli

1 Like

Dear Dzenan,

yes, partially. As I understand I need the center of the mesh for volume calculation. is there a way to calculate the center of the mesh without using vtk?

Or can just use a random point as center as you stated in the post?

If I would have the center, the volume of one tetrahedron would be calculated as: (a-center)*((b-center)x(c-center))

Where a,b, and c are the vertex of one triangle cell. The total volume is then the sum of all tetrahedron volumes.Is that correct?