scipy.ndimage.measurements.sum

scipy.ndimage.measurements.sum(input, labels=None, index=None)

Calculate the sum of the values of the array.

Parameters :

input : array_like

Values of input inside the regions defined by labels are summed together.

labels : array_like of ints, optional

Assign labels to the values of the array. Has to have the same shape as input.

index : scalar or array_like, optional

A single label number or a sequence of label numbers of the objects to be measured.

Returns :

output : list

A list of the sums of the values of input inside the regions defined by labels.

See also

mean, median

Examples

>>> input =  [0,1,2,3]
>>> labels = [1,1,2,2]
>>> sum(input, labels, index=[1,2])
[1.0, 5.0]

Previous topic

scipy.ndimage.measurements.standard_deviation

Next topic

scipy.ndimage.measurements.variance

This Page