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

Calculate the center of mass of the values of an array at labels.

  • input (cupy.ndarray) – Data from which to calculate center-of-mass. The masses can either be positive or negative.

  • labels (cupy.ndarray, optional) – Labels for objects in input, as enerated by ndimage.label. Only used with index. Dimensions must be the same as input.

  • index (int or sequence of ints, optional) – Labels for which to calculate centers-of-mass. If not specified, all labels greater than zero are used. Only used with labels.


Coordinates of centers-of-mass.

Return type:

tuple or list of tuples