avg_img_values#
- stimupy.utils.masks.avg_img_values(image, mask, f_average=np.median)#
Average values of pixels in image, per target region in integer mask
Values are calculated as means or medians, depending on the mode.
- Parameters:
image (2D numpy array) – 2D numpy array containing pixel values of the image
mask (2D numpy array) – 2D numpy array of same size as image. Each target patch has an integer value. Each pixel inside this patch has this integer value. Patches do not need to be continuous.
f_average (function, default=numpy.median) – How to average/summarise the pixels in each target region
- Returns:
each entry in the list is the average value of pixels in target region, index in the list is the integer index in the mask
- Return type:
See also