MatchingData#
- class MatchingData(target, template, template_mask=None, target_mask=None, invert_target=False, rotations=None)[source]#
Bases:
object
Contains data required for template matching.
- Parameters:
- targetnp.ndarray or
tme.density.Density
Target data.
- templatenp.ndarray or
tme.density.Density
Template data.
- target_masknp.ndarray or
tme.density.Density
, optional Target mask data.
- template_masknp.ndarray or
tme.density.Density
, optional Template mask data.
- invert_targetbool, optional
Whether to invert the target before template matching.
- rotations: np.ndarray, optional
Template rotations to sample. Can be a single (d, d) or a stack (n, d, d) of rotation matrices where d is the dimension of the template.
- targetnp.ndarray or
Examples
The following achieves the minimal definition of a
MatchingData
instance.>>> 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)
Attributes
Return stored rotation matrices.
Return the target.
Returns the target filter.
Return the target mask.
Return the reversed template.
Returns the template filter.
Return the reversed template mask.
Methods
Computes a parallelization schedule for a given template matching operation.
MatchingData.fourier_padding
([pad_fourier])Computes efficient shape four Fourier transforms and potential associated shifts.
Sets matching dimensions for target and template.
MatchingData.subset_array
(arr, arr_slice, ...)Extract a subset of the input array according to the given slice and apply padding.
MatchingData.subset_by_slice
([target_slice, ...])Subset class instance based on slices.
MatchingData.target_padding
([pad_target])Computes the padding of the target to the full convolution shape given the registered template.
Transfer and convert types of internal data arrays to the current backend.