region_size#

region_size(im)[source]#

Replace each voxel with the size of the region to which it belongs

Parameters:

im (ndarray) – Either a boolean image wtih True indicating the features of interest, in which case scipy.ndimage.label will be applied to find regions, or a greyscale image with integer values indicating regions.

Returns:

image – A copy of im with each voxel value indicating the size of the region to which it belongs. This is particularly useful for finding chord sizes on the image produced by apply_chords.

Return type:

ndarray

See also

flood

Notes

This function provides the same result as flood with mode='size', although does the computation in a different way.

Examples

Click here to view online example.