Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RegisterFit.jl

CI Coverage Stable Dev

RegisterFit computes affine transformations that minimize image registration mismatch. Given per-aperture mismatch data from RegisterMismatch, it finds the best-fit affine transform by fitting each aperture's mismatch to a quadratic form and solving a global least-squares problem. It is part of the HolyLab image registration pipeline.

Installation

RegisterFit is distributed through the HolyLabRegistry. Add the registry once, then install the package:

using Pkg
pkg"registry add https://github.com/HolyLab/HolyLabRegistry.git"
Pkg.add("RegisterFit")

Quick start

Fitting a single aperture's mismatch to a quadratic

using RegisterFit, RegisterCore

# Synthetic mismatch: parabola centred at shift (1, -2)
num = [(i - 1)^2 + (j + 2)^2 for i in -5:5, j in -5:5]
mm  = MismatchArray(num, ones(11, 11))

E0, u0, Q = qfit(mm, 0.5)
# E0 ≈ 0.0      — mismatch value at the minimum
# u0 ≈ [1, -2]  — shift at the minimum
# Q  ≈ I        — curvature matrix

Rigid alignment via the Principal Axes Transform

using RegisterFit

# Horizontal bar in fixed, vertical bar in moving (≈ 90° rotation)
fixed  = zeros(5, 7); fixed[3, 2:6]  .= 1.0
moving = zeros(7, 5); moving[2:6, 3] .= 1.0

tfms = principalaxes_rotation(fixed, moving)   # 2 candidate AffineMap transforms in 2D
# Evaluate each candidate against mismatch data and pick the best

Overview

The typical workflow in the registration pipeline is:

  1. Compute mismatch — per-aperture MismatchArrays from RegisterMismatch
  2. mms2fit! — fit each aperture to a quadratic; returns per-aperture shifts and curvature matrices
  3. mismatch2affine — global least-squares solve over all apertures to produce a single AffineMap
  4. Refine — further optimisation in RegisterDeformation

See the documentation for the full API reference.

About

RegisterFit contains a number of functions that calculate affine transformations that minimize mismatch. This package is separated from BlockRegistraton

Resources

Stars

0 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages