B-spline Grid, Image and Point based Registration
Affine and B-spline grid based registration and data-fitting of two 2D color/grayscale images or 3D volumes or point-data. Registration can be done intensity / pixel based, or landmark / corresponding points based (See OpenSurf), or a combination.
Description Pixel-based registration:
This function is an (enhanced) implementation of the b-spline registration algorithm in D. Rueckert et al. "Nonrigid Registration Using Free-Form Deformations: Application to Breast MR Images". Including the smoothness penalty of Rueckert (thin sheet of metal bending energy), and Jacobian (diffeomorphic) function. Also including, localized normalized mutual information as registration error, allowing the images or volumes to be of a different type/modality for instance a MRI T1 and T2 patient scan.
How it works:
A grid of b-spline control points is constructed which controls the transformation of an input image. An error measure is used to measure the registration error between the moving and static image. The quasi newton Matlab optimizer fminlbfgs (also on Mathworks) is used to move the control points to achieve the optimal registration between both images with minimal registration error.
Usage:
- The function image_registration.m is easy to use, and contains examples in the help, and will fit most applications. (If you want to write your own specialized registration code study the registration examples)
- The function point_registration is fast fitting of a b-spline grid to 2D/3D corresponding points, for landmark based registration.
- There is also the function manually_warp_images which allow control grid changes with the mouse, to get better registration.
First, you need to compile mex / C code with compile_c_files.m. (2D registration also works without mex files but will be slower)
The multi-threaded mex code supports Windows, Linux (and Mac OS?)
Some Features:
- 2-D / 3-D Eulerian strain tensor images can be made from the transformations fields. For example to describe cardiac motion in the images.
- Landmarks can be used for already known corresponding points (for example from Sift). Influence of every landmark on the registration process can be adjust.
- It is possible to register a number of movie frames by using the registration grid of previous two images as initial registration grid of the next two images.
- It is possible to mask parts of the images, to decrease or increase the influence of an image structure on the registration result.
Literature:
- D. Rueckert et al. "Nonrigid Registration Using Free-Form Deformations: Application to Breast MR Images".
- Seungyong Lee, George Wolberg, and Sung Yong Shing, "Scattered Data interpolation with Multilevel B-splines"
note:
- B-spline registration is slower and more complex than demon registration see:
http://www.mathworks.fr/matlabcentral/fileexchange/loadFile.do?objectId=21451
- Why still use B-spine registration?, because the resulting transformation-field corresponds better to real-live deformation than transformation fields from fluid registration.
Please report bugs, successes and questions.
Cite As
Dirk-Jan Kroon (2024). B-spline Grid, Image and Point based Registration (https://www.mathworks.com/matlabcentral/fileexchange/20057-b-spline-grid-image-and-point-based-registration), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Image Processing Toolbox > Geometric Transformation and Image Registration >
- MATLAB > Graphics > Images > Read, Write, and Modify Image >
- Image Processing and Computer Vision > Computer Vision Toolbox > Recognition, Object Detection, and Semantic Segmentation > Image Category Classification >
Tags
Acknowledgements
Inspired: RADIOMICS
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
functions/
functions_affine/
functions_nonrigid/
low_level_examples/
Version | Published | Release Notes | |
---|---|---|---|
1.33.0.0 | Solved Bugs in diffeomorphic functions. Tested in Ubuntu and with LCC compiler |
||
1.32.0.0 | Added MakeDiffeomorphic for deformations without folding. New clean multi-threading c-code. |
||
1.31.0.0 | Fixed Nan in SSD calculation. Added numerical b-spline inverse. Added bi-cubic code |
||
1.30.0.0 | Major Update! Improved / fixed bugs in "Mutual information", new affine weighting par. in 3D. Fixed bug, which caused the error to decrease after refining a few times to a very fine b-spline grid. Added Point Registration examples. |
||
1.29.0.0 | Added Corresponding Point based registration of Lee. Merged 2D and 3D registration functions into one file. Replaced for-loops by faster 1D index operations. |
||
1.28.0.0 | Added manually_warp_images function. Now uses localized mutual information for the error calculation, not only for the gradient of the error. Split register_images and register_volumes in sub-functions. |
||
1.27.0.0 | Fixes for Linux Compiler |
||
1.26.0.0 | Fixed bug, 3D registration empty Fx and Fz matrix. |
||
1.25.0.0 | Fix Gaussian filter function |
||
1.23.0.0 | Fixed Single cubic interpolation bug, and addpaths.m in low_level_examples |
||
1.22.0.0 | Solved mask bug reported by siamak yousefi.
|
||
1.21.0.0 | Major code speed up by look up tables and separate SDD code. Also some bug Fixes in Mask code... |
||
1.20.0.0 | Major bug z-dimension fixed in volume registration |
||
1.19.0.0 | Bug fixed in index 3D cubic interpolation, resulted in zero resulting volumes |
||
1.18.0.0 | Minor bug, Mask is now resized to fit size Istatic (if not already). |
||
1.17.0.0 | Added Cubic interpolation!, fixed bug and comment in masks mutual information, interpolation now in separate file c. file |
||
1.16.0.0 | example 3d nonrigid fixed |
||
1.15.0.0 | Bug LCC compiler doesn't link floorf fixed. Also fixed NaN bug in image_difference.m |
||
1.14.0.0 | Tri Ngo provided me with Linux multi-threaded code, which I added, thus the registration now supports multi-threaded Windows, Linux and (Mac Os)?
|
||
1.13.0.0 | ";" removed to fix a boundary bug |
||
1.12.0.0 | Speed up affine 3D registration (2x), and some other small improvements. |
||
1.11.0.0 | Added 2D RGB image support |
||
1.10.0.0 | Landmarks can now be used as transformation regularization. |
||
1.9.0.0 | Fixed out of bounds bug, reported by D.C. Karhoff |
||
1.8.0.0 | Bug fixed in image dimensions in backwards2forward c-code and updated movepixels files to allow pixels outside image to be zero or nearest value inside image. |
||
1.7.0.0 | Changed parameter "size of region influenced by a control point" in final refinement step. Resulting in a speed up of 150% in gradient calculation in this last step. |
||
1.6.0.0 | Fixed a bug: The moving grid was used to determine the region influenced by a control point in gradient registration, this is changed in a uniform static grid. (b-splines are always determined on a uniform grid). |
||
1.5.0.0 | Multi-threaded registration now uses the number of threads set by maxNumCompThreads. New Quasi newton optimizer fminlbfgs. Speed ups in the smoothness penalty, and some other files. |
||
1.4.0.0 | Single Threaded files are updated to all code in the Multiple Threaded files, and tested... |
||
1.3.0.0 | 2D available in 100% Matlab code. Eulerian strain images available. Parts of images can be masked. Forward transformation field now also available. |
||
1.1.0.0 | Bug fixed: The rigid transformation optimizers crashed with images with strange dimensions |
||
1.0.0.0 | Added registration smoothness penalty. |