- flood(im, labels, mode='max')#
Floods/fills each region in an image with a single value based on the specific values in that region.
This function calls the various functions in
scipy.ndimage.measurementsbut instead of returning a list of values, it fills each region with its value. This is useful for visualization and statistics.
im (array_like) – An image with the numerical values of interest in each voxel, and 0’s elsewhere.
labels (array_like) – An array the same shape as
imwith each region labeled.
mode (string) –
Specifies how to determine the value to flood each region. Options taken from the
Floods each region with the local max in that region. The keyword
maxis also accepted.
Floods each region the local minimum in that region. The keyword
minis also accepted.
Floods each region the local median in that region
Floods each region the local mean in that region
Floods each region with the size of that region. This is actually accomplished with
imto a boolean image (
im = im > 0).
Floods each region with the value of the standard deviation of the voxels in
Floods each region with the value of the variance of the voxels in
flooded – A copy of
imwith new values placed in each forground voxel based on the
- Return type
Click here to view online example.