iris.nodes.templates_alignment package

Submodules

iris.nodes.templates_alignment.hamming_distance_based module

Hamming Distance-Based Template Alignment

This module implements a hamming distance-based alignment algorithm that aligns iris templates to a reference template by finding the optimal rotation offset that minimizes the hamming distance between each template and the reference.

The algorithm: 1. Finds the best reference template using original distances 2. For each template, finds the best rotation offset and aligns it to the reference 3. Returns both aligned templates and the original pairwise distances (which are invariant to global rotation)

Note: The pairwise distances are computed as the minimum Hamming distance over all possible rotations for each pair, so they are invariant to the global orientation of the templates. Thus, the distances before and after alignment are the same.

Author: Rostyslav Shevchenko Date: 12 June 2025

class iris.nodes.templates_alignment.hamming_distance_based.HammingDistanceBasedAlignment(rotation_shift: int = 15, use_first_as_reference: bool = False, normalise: bool = True, reference_selection_method: ReferenceSelectionMethod = ReferenceSelectionMethod.LINEAR, callbacks: List[Callback] = [])[source]

Bases: Algorithm

Hamming distance-based template alignment algorithm.

This algorithm aligns iris templates by finding the optimal rotation offset that minimizes the hamming distance between each template and a reference template. Always returns both the aligned templates and their pairwise distances (computed before alignment).

class Parameters(*, rotation_shift: ConstrainedIntValue = 15, use_first_as_reference: bool = False, normalise: bool = True, reference_selection_method: ReferenceSelectionMethod = ReferenceSelectionMethod.LINEAR)[source]

Bases: Parameters

HammingDistanceBasedAlignment parameters.

normalise: bool
reference_selection_method: ReferenceSelectionMethod
rotation_shift: ConstrainedIntValue
use_first_as_reference: bool
run(templates: List[IrisTemplate]) AlignedTemplates[source]

Align templates using hamming distance-based alignment.

Parameters:

templates (List[IrisTemplate]) – List of IrisTemplate objects to align

Returns:

an AlignedTemplates object

Return type:

AlignedTemplates

Raises:

ValueError – If no templates provided

class iris.nodes.templates_alignment.hamming_distance_based.ReferenceSelectionMethod(value)[source]

Bases: str, Enum

Enumeration of reference selection methods.

LINEAR = 'linear'
MEAN_SQUARED = 'mean_squared'
ROOT_MEAN_SQUARED = 'root_mean_squared'

Module contents

class iris.nodes.templates_alignment.HammingDistanceBasedAlignment(rotation_shift: int = 15, use_first_as_reference: bool = False, normalise: bool = True, reference_selection_method: ReferenceSelectionMethod = ReferenceSelectionMethod.LINEAR, callbacks: List[Callback] = [])[source]

Bases: Algorithm

Hamming distance-based template alignment algorithm.

This algorithm aligns iris templates by finding the optimal rotation offset that minimizes the hamming distance between each template and a reference template. Always returns both the aligned templates and their pairwise distances (computed before alignment).

class Parameters(*, rotation_shift: ConstrainedIntValue = 15, use_first_as_reference: bool = False, normalise: bool = True, reference_selection_method: ReferenceSelectionMethod = ReferenceSelectionMethod.LINEAR)[source]

Bases: Parameters

HammingDistanceBasedAlignment parameters.

normalise: bool
reference_selection_method: ReferenceSelectionMethod
rotation_shift: ConstrainedIntValue
use_first_as_reference: bool
run(templates: List[IrisTemplate]) AlignedTemplates[source]

Align templates using hamming distance-based alignment.

Parameters:

templates (List[IrisTemplate]) – List of IrisTemplate objects to align

Returns:

an AlignedTemplates object

Return type:

AlignedTemplates

Raises:

ValueError – If no templates provided