- flood_func(im, func, labels=None)#
Flood each isolated region in an image with a constant value calculated by the given function.
im (ndarray) – An image with the numerical values of interest in each voxel, and 0’s elsewhere.
func (Numpy function handle) – The function to be applied to each region in the image. Any Numpy function that returns a scalar value can be passed, such as
labels (ndarray) – An array containing labels identifying each individual region to be flooded. If not provided then
scipy.ndimage.labelis applied to
im > 0.
flooded – An image the same size as
imwith each isolated region flooded with a constant value based on the given
funcand the values in
- Return type:
Many of the functions in
scipy.ndimagecan be applied to individual regions using the
indexargument. This function extends that behavior to all numpy function, in the event you wanted to compute the cosine of the values in each region for some reason. This function also floods the original image instead of returning a list of values for each region.
Click here to view online example.