linumpy.registration.refinement#
Refinement registration: best-Z search and small rotation/translation correction.
Functions#
|
Find the Z-index in fixed_vol that best matches moving_slice. |
|
Compute small rotation and translation refinement using SimpleITK. |
|
Compute alignment offset using center-of-mass difference. |
|
Compute alignment offset using phase correlation on gradient magnitude images. |
Module Contents#
- linumpy.registration.refinement.find_best_z(fixed_vol, moving_slice, expected_z, search_range)[source]#
Find the Z-index in fixed_vol that best matches moving_slice.
Uses normalized cross-correlation in the center region.
- Parameters:
- Returns:
best_z (int) – Z-index giving the best correlation.
best_corr (float) – Correlation score at best_z.
- Return type:
- linumpy.registration.refinement.register_refinement(fixed, moving, enable_rotation=True, max_rotation_deg=5.0, max_translation_px=20.0, fixed_mask=None, moving_mask=None, initial_offset=None)[source]#
Compute small rotation and translation refinement using SimpleITK.
- Parameters:
fixed (np.ndarray) – 2D images for registration (should be normalized to [0, 1]).
moving (np.ndarray) – 2D images for registration (should be normalized to [0, 1]).
enable_rotation (bool) – Enable Euler2D rotation (default True). False = translation only.
max_rotation_deg (float) – Maximum allowed rotation in degrees.
max_translation_px (float) – Maximum allowed translation in pixels.
fixed_mask (np.ndarray or None) – Optional tissue masks multiplied into images before registration.
moving_mask (np.ndarray or None) – Optional tissue masks multiplied into images before registration.
initial_offset (tuple[float, float] or None) – Optional initial (dy, dx) translation offset for the transform.
- Returns:
tx, ty (float) – Translation refinement in pixels.
angle_deg (float) – Rotation angle in degrees.
metric (float) – Registration metric value.
- Return type:
- linumpy.registration.refinement.centre_of_mass_offset(fixed, moving)[source]#
Compute alignment offset using center-of-mass difference.
- Parameters:
fixed (np.ndarray) – 2D normalized images (values in [0, 1]).
moving (np.ndarray) – 2D normalized images (values in [0, 1]).
- Returns:
dy, dx – Translation from moving to fixed (fixed - moving offset).
- Return type:
- linumpy.registration.refinement.gradient_magnitude_alignment(fixed, moving)[source]#
Compute alignment offset using phase correlation on gradient magnitude images.
- Parameters:
fixed (np.ndarray) – 2D normalized images (values in [0, 1]).
moving (np.ndarray) – 2D normalized images (values in [0, 1]).
- Returns:
dy, dx – Translation from moving to fixed (fixed - moving offset).
- Return type: