MatchingData.subset_array#

MatchingData.subset_array(arr, arr_slice, padding, invert=False)[source]#

Extract a subset of the input array according to the given slice and apply padding.

Parameters:
arrNDArray

The input array from which a subset is extracted.

arr_slicetuple of slice

Defines the region of the input array to be extracted.

paddingNDArray

Padding values for each dimension. If the padding exceeds the array dimensions, the extra regions are filled with the mean of the array values, otherwise, the values in arr are used.

invertbool, optional

Whether the returned array should be inverted and normalized to the interval [0, 1]. If available, uses the metadata information of the Density object, otherwise computes min and max on the extracted subset.

Returns:
NDArray

Subset of the input array with padding applied.