linumpy.registration.transforms#
Transform construction and mosaic-level transform estimation.
Functions#
|
Create a 3D SimpleITK Euler transform from 2D parameters. |
|
Compute the transform matrix for motor-based tile positions. |
|
Estimate the 2x2 mosaic transform from pairwise phase-correlation registration. |
Module Contents#
- linumpy.registration.transforms.create_transform(tx, ty, angle_deg, center)[source]#
Create a 3D SimpleITK Euler transform from 2D parameters.
- linumpy.registration.transforms.compute_motor_transform(tile_shape, overlap_fraction)[source]#
Compute the transform matrix for motor-based tile positions.
Creates a diagonal transform where tile index (i, j) maps to a pixel position based on the expected overlap, corresponding to precise motor/stage positions from acquisition.
- linumpy.registration.transforms.estimate_mosaic_transform(mosaics, max_empty_fraction=0.9, n_samples=512, seed=None)[source]#
Estimate the 2x2 mosaic transform from pairwise phase-correlation registration.
For each mosaic, neighbouring tile pairs are registered with
pair_wise_phase_correlation()and the resulting pixel displacements are assembled into a least-squares system to recover the underlying affine transform.- Parameters:
mosaics (list of MosaicGrid) – Loaded mosaic grids to use for estimation.
max_empty_fraction (float, optional) – Maximum fraction of empty pixels in an overlap region to still use the pair (default 0.9).
n_samples (int, optional) – Maximum number of tile pairs to sample across all mosaics (default 512).
seed (int, optional) – Random seed for reproducible tile-pair sampling.
- Returns:
transform (np.ndarray) – 2x2 transform matrix.
residuals (np.ndarray) – Residuals from the least-squares fit.
tile_count (int) – Number of tile pairs actually used.
- Return type: