MatchingData.subset_by_slice#

MatchingData.subset_by_slice(target_slice=None, template_slice=None, target_pad=None, template_pad=None, invert_target=False)[source]#

Subset class instance based on slices.

Parameters:
target_slicetuple of slice, optional

Target subset to use, all by default.

template_slicetuple of slice, optional

Template subset to use, all by default.

target_padNDArray, optional

Target padding, zero by default.

template_padNDArray, optional

Template padding, zero by default.

Returns:
MatchingData

Newly allocated subset of class instance.

Examples

>>> import numpy as np
>>> from tme.matching_data import MatchingData
>>> target = np.random.rand(50,40,60)
>>> template = target[15:25, 10:20, 30:40]
>>> matching_data = MatchingData(target=target, template=template)
>>> subset = matching_data.subset_by_slice(
>>>     target_slice=(slice(0, 10), slice(10,20), slice(15,35))
>>> )