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 casescipy.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 byapply_chords
.- Return type:
ndarray
See also
Notes
This function provides the same result as
flood
withmode='size'
, although does the computation in a different way.Examples
Click here to view online example.