iaf.reg

Registration functions.

iaf.reg.apply_rigid_transform(A: ndarray, R: ndarray, t: ndarray)[source]

Applies rotation and translation to coordinates A.

Parameters:
  • A (np.ndarray) – Array of 2D or 3D source coordinates with shape [2xN] or [3xN]

  • R (np.ndarray) – Rotation matrix (2x2 or 3x3).

  • t (np.ndarray) – Translation vector (2x1 or 3x1)

Returns:

A_t – Array of 2D or 3D coordinates (shape [2xN] or [3xN]) transformed by rotation matrix R and translation vector t.

Return type:

np.ndarray

iaf.reg.find_rigid_transform(A: ndarray, B: ndarray, force_reflection: bool = False)[source]

Calculate rigid transformation to map coordinates A onto coordinates B.

Parameters:
  • A (np.ndarray) – Array of 2D or 3D source coordinates with shape [2xN] or [3xN]

  • B (np.ndarray) – Array of 2D or 3D target coordinates A with shape [2xN] or [3xN]

  • force_reflection (bool) – Whether to force reflection if one is suspected: it can give false positives (optional, default False).

Returns:

  • R (np.ndarray) – Rotation matrix (either 2x2 or 3x3) to transform the A coordinates into B.

  • t (np.ndarray) – Translation vector (either 2x1 or 3x1) to transform the A coordinates into B.

iaf.reg.multi_image_alignment(images: list[ndarray], return_composites: bool = False) tuple[list[ndarray], ndarray, ndarray] | list[ndarray][source]

Registers (aligns) a series of images (translation only).

Parameters:
  • images (list[np.ndarray]) – List of 2D images to register. The first one will be used as template against which all others will be registered.

  • return_composites (bool = False) – If True, returns two composites of the channels before and after alignment for quality control.

Returns:

  • images (list[np.ndarray]) – List of registered images.

  • rgb_before (np.ndarray) – Composite of the channels before alignment.

  • rgb_after (np.ndarray) – Composite of the channels after alignment.