You have many options to compute “center” of a segment.
- Model node’s GetMesh().GetCenter() method returns center of the bounding box. Depending on the model’s shape it may be close to the center of mass, but they are computed very differently.
See method help
>>> help(modelNode.GetMesh().GetCenter)
Help on built-in function GetCenter:
GetCenter(...)
V.GetCenter() -> (float, float, float)
C++: double *GetCenter()
V.GetCenter([float, float, float])
C++: void GetCenter(double center[3])
Get the center of the bounding box. THIS METHOD IS NOT THREAD
SAFE.
-
vtk.vtkCenterOfMass() applied to a segment’s closed surface representation returns center of mass of the surface points. Depending on the shape and density of points on the surface, it may be similar to center of mass of the of the solid object enclosed by the surface, but they are not the same.
-
You can compute true center of mass of the enclosed volume from binary labelmap representation (as @cpinter described above).