mesh_volume

mesh_volume(region, voxel_size=(1.0, 1.0, 1.0))[source]

Compute the volume of a single region by meshing it

Parameters:
  • region (ndarray) – An image with a single region labelled as True (or > 0)

  • voxel_size (tuple) – The resolution of the image, expressed as the length of one side of a voxel, so the volume of a voxel would be voxel_size-cubed. The default is 1.

Returns:

volume – The volume of the region computed by applyuing the marching cubes algorithm to the region, then finding the mesh volume using the trimesh package.

Return type:

float

Examples

Click here to view online example.