cupyx.scipy.ndimage.median(input, labels=None, index=None)[source]#

Calculate the median of the values of an array over labeled regions.

  • input (cupy.ndarray) – Array of values. For each region specified by labels, the median values of input over the region is computed.

  • labels (cupy.ndarray, optional) – An array of integers marking different regions over which the median value of input is to be computed. labels must have the same shape as input. If labels is not specified, the median over the whole array is returned.

  • index (array_like, optional) – A list of region labels that are taken into account for computing the medians. If index is None, the median over all elements where labels is non-zero is returned.


Array of medians of input over the regions determined by labels and whose index is in index. If index or labels are not specified, a 0-dimensional cupy.ndarray is returned: the median value of input if labels is None, and the median value of elements where labels is greater than zero if index is None.

Return type: