region_volumes¶
- region_volumes(regions, mode='marching_cubes', voxel_size=(1, 1, 1))[source]¶
Compute volume of each labelled region in an image
- Parameters:
regions (ndarray) – An image with labelled regions
mode (string) –
Controls the method used. Options are:
- ’marching_cubes’ (default)
Finds a mesh for each region using the marching cubes algorithm from
scikit-image
, then finds the volume of the mesh using thetrimesh
package.- ’voxel’
Calculates the region volume as the sum of voxels within each region.
- Returns:
volumes – An array of shape [N by 1] where N is the number of labelled regions in the image.
- Return type:
ndarray
Examples
Click here to view online example.