RegisterQD performs image registration using the global optimization routine QuadDIRECT. Unlike many other registration packages, this is not "greedy" descent based on an initial guess — it attempts to find the globally-optimal alignment of your images.
RegisterQD and its dependencies live in the HolyLab registry. Add the registry once, then install:
using Pkg
pkg"registry add https://github.com/HolyLab/HolyLabRegistry.git"
Pkg.add("RegisterQD")You also need a mismatch backend. For CPU processing, load RegisterMismatch:
Pkg.add("RegisterMismatch")For GPU processing, use RegisterMismatchCuda instead. Do not load both in the same session — they conflict.
using RegisterMismatch, RegisterQD
fixed = Float64.(reshape(1:25, 5, 5))
moving = circshift(fixed, (2, 1)) # known shift: 2 rows, 1 column
tform, mm = qd_translate(fixed, moving, (3, 3))
# tform.translation == [2.0, 1.0]
# mm == 0.0qd_translate: register images by shifting one with respect to another (translations only)qd_rigid: register images using rotations and translationsqd_affine: register images using arbitrary affine transformations
In general, using more degrees of freedom allows you to solve harder optimization problems, but also makes it harder to find the global optimum. Use no more degrees of freedom than your problem requires.
This package supports images sampled anisotropically, which is common in 3-D biomedical imaging (e.g. MRI, optical sections where the axial resolution differs from the in-plane resolution).
Pass SD = diagm(voxelspacing) to the registration functions to account for non-uniform spacing.
See arrayscale and getSD for details, and the User Guide for a full explanation.
NOTE: see NEWS.md for information about recent breaking changes.