NormalizedCrossCorrelation#

class NormalizedCrossCorrelation(target, template_coordinates, template_weights, template_mask_coordinates=None, target_mask=None, negate_score=True, return_gradient=False, interpolation_order=1, **kwargs)[source]#

Bases: CrossCorrelation

Computes a normalized version of the CrossCorrelation score based on the dot product of target_weights and template_weights, in order to reduce bias to regions of high local energy.

\[\text{score} = \frac{\text{target_weights} \cdot \text{template_weights}} {\text{max(target_norm} \times \text{template_norm, eps)}}\]

Where:

\[\text{target_norm} = ||\text{target_weights}||\]
\[\text{template_norm} = ||\text{template_weights}||\]

Here, \(||.||\) denotes the L2 (Euclidean) norm.

Parameters:
targetNDArray

A d-dimensional target to match the template coordinate set to.

template_coordinatesNDArray

Template coordinate array with shape (d,n).

template_weightsNDArray

Template weight array with shape (n,).

template_mask_coordinatesNDArray, optional

Template mask coordinates with shape (d,n).

target_maskNDArray, optional

A d-dimensional mask to be applied to the target.

negate_scorebool, optional

Whether the final score should be multiplied by negative one. Default is True.

return_gradientbool, optional

Invoking __call_ returns a tuple of score and parameter gradient. Default is False.

**kwargsDict, optional

Keyword arguments propagated to downstream functions.

Methods

NormalizedCrossCorrelation.grad()

Calculate the normalized gradient of the cost function w.r.t.

NormalizedCrossCorrelation.rotate_array(arr, ...)

NormalizedCrossCorrelation.score(x)

Compute the matching score for the given transformation parameters.

NormalizedCrossCorrelation.score_angles(x)

Computes the score after a given rotation.

NormalizedCrossCorrelation.score_translation(x)

Computes the score after a given translation.