View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
3D Free Form Image Registration Toolbox (GUI)

4.3 | 3 ratings Rate this file 28 Downloads (last 30 days) File Size: 272 KB File ID: #21017 Version: 1.5
image thumbnail

3D Free Form Image Registration Toolbox (GUI)


Daniel Markel (view profile)


08 Aug 2008 (Updated )

A toolbox for performing image registrations on 4D RTOG files or any other volumetric image.

| Watch this File

File Information

This toolbox contains all the functions necessary for extraction and registration of medical RTOG images using a cubic-B-spline free form deformation technique. The optimization routine uses a difference of squares along with smoothness and feature point designations as error criteria to minimize. Some code has been taken from CERR.

A GUI (FFD4D) is included for handling all the steps from extraction of data and contours to registration and deformation of the image.

The GUI requires contours be loaded of the organs being deformed in order to register them. If contours are not available a very rough automated segmentation routine is provided to outline skin and bone structures. These contours are what is used by the registration routine and are necessary, the original images are not, but can be deformed using the registration parameters after.

It is recommended that images be cropped identically (no larger than [400x400x100 pixels] and are globally registered before hand. A typical registration takes approx. 160 minutes to perform.

DICOM images can also be used, however there may still be many bugs associated with using DICOM.

I will add proper documentation soon. I apologize for now.

Please ensure the folder hierarchy is preserved when extracting these files.

Please let me know if you experience any problems. Don't forget to extract the zip file with the folder hierarchy intact or the gui will not function correctly.

This software should not be used clinically or commercially and is for research purposes only. Use at your own risk.



This file inspired Dicom Directory (Of Slices) To 3 D Volume Image and Import Mim Dvh.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements Best performance on 64-bit version of Matlab. Recommended requirements- Matlab 7.1 or higher Pentium 4 processor or better Atleast 3GB of free hard disk space
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (19)
01 Mar 2016 Daniel Markel

Hi Justin,

This program only handles non-rigid registration unfortunately. However it's very easy to get the transformation you need. Matlab now has a number of options for rigid (and even non-rigid) registration that make it very simple. You might be better served to try those.

Comment only
23 Apr 2015 Justin

Justin (view profile)

Great software!

I was wondering if there is any way to get the transformation matrix?

I want to register treatment CT to the simulation CT and use this registration to apply couch shifts to a phantom.

It will be a rigid registration so I really just need the rotational and translational components.

Any ideas?


Comment only
23 Apr 2015 Justin

Justin (view profile)

PS: particularly if I use feature points for the registration

Comment only
22 Jan 2015 keen chan

28 Mar 2014 Nicolas Yu

Nicolas Yu (view profile)

No mannual. And the directories are better to be relative directories.

29 Jul 2012 ava

ava (view profile)

Thanks for the code,
How is it possible to test the software for 3D Mesh model?

Thanks again

Comment only
27 Oct 2011 Tsenmu

Tsenmu (view profile)

16 Aug 2011 amin moham

thanks for toolbox
can i use your functions for 2d image registration(motion maping in video)?

Comment only
11 Jul 2011 Eman Alsayyad

can i use this free form deformation code to deform a human body template model to an individual human by having 2 contour images one for the template and the other for the target if yes ,which files or functions can i use if no ,have you any background about how i can do that?
please reply as soon as possible it is an important issue thank you

Comment only
04 Nov 2009 yang ping

Can you offer more informations about CERR?
Thank you very much.

Comment only
21 May 2009 Daniel Markel

Daniel Markel (view profile)

Sorry the first part of the comment was cut off.

The label can be anything you want, it's just what the program will call the data set after you load it in. All I recommend is not using the words 'temp' or 'deform' in the title.

Put the data files into any folder on your computer, you'll be able asked to select it once you're adding an image dataset. I wouldn't mess around with the 'patient files' folder. the program will manage it on it's own.

I should add, there's a bit of an order to using the GUI, I apologize there's no manual yet.

1. 'create new patient' or load an exisiting one first.
2. Now you can add images to you're patients file it's expected that they are 3D volumes and all images pertaining to it are in the same folder.
3. Once the data is in the program you can select it in the list and click 'View data' to see it or you can select 'load contours' to load in any ROI's that accompanied the data set, they should also be in the dicom or RTOG files (this is optional).
4. Click 'Feature points' to mark any fudicials between data sets. The points are colour coded on the screen to correspond to the first or second image. The fade slider goes from 'image1 ---> image2'. (This is also optional)
5. In the pull down menu in the main program you can select 'Registration Parameters' to change the optimization parameters to get a better or faster registration.
5. Click register points to set up a single or series or registrations. If there are no contours you can select 'auto segment' in the registration menu to have the program use thresholding to segment the images. Once you're ready hit 'Register' and leave the program until it's finished, this may take a while.
6. Once done, the registration parameters will appear in the 'Deform' menu (purple button). You select the data set you're applying the transformation to on the left and the transformation on the right. Hit 'Apply deformation' to produce a data set of the deformed volume (remember you can only output in dicom for now). 'Load dose' to load a dose volume to accompany the data set. Or 'Calculate DVH' to apply the transformation to a dose set and produce an excel file with the DVH data.

Comment only
21 May 2009 Daniel Markel

Daniel Markel (view profile)

P.S. or if you're loading an RTOG you would select the header file within that folder.



Comment only
18 May 2009 Xi Liang

I cannot download database from the address, and they are just 14K and unable to unzip. Instead, I downloaded a dataset from

I put the files under the directory /patient files, but the this doesnt work. Should I rename the files?

Comment only
17 May 2009 Vahid T.

Thanks for uploading the database.
One more problem:
After loading the header file ( 0%0000 ), the software asks for a lable.
What should we insert as 'lable'?

Comment only
11 May 2009 Daniel Markel

Daniel Markel (view profile)

Sorry for the delay, that's not a bad idea. Here's an RTOG of a phantom, you have to unzip it first, first file 0%0000 is the header. I have gotten rid of almost all the bugs now, I'll try to upload the fixed version tommorrow.

Comment only
06 Apr 2009 Vahid T.

Can you please upload the input images in rapidshare or mega-upload or....
It is really useful.

Comment only
18 Nov 2008 vijay kumar

Is 'uint6' used in loadDICOM2.m on line 42 a valid data type? There are several other bugs.

Comment only
29 Aug 2008 Daniel Markel

I do, but RTOG image sets are fairly large about 80 megabytes each which is why I did not include them here. You'd need atleast two sets, to test the software.

Comment only
29 Aug 2008 Greg Thom

Do you have test data for this software ?

Comment only
13 Aug 2008

An additional comment was needed to explain that improperly extracting the files from the zip file would result in the software not working

13 Aug 2008

Fixed a bug with the load patient menu

13 Aug 2008

Sorry, found and fixed another bug with the patient loading menu.

15 Aug 2008

Bugs involved in creating and reloading patient data has been fixed.

19 Nov 2008 1.2

Bug with th cropping tool has been fixed. Also fudicials can now be inputted numerically given an isocenter and known image resolution. This is found in the feature point menu.

14 May 2009 1.3

Fixed bugs with registration initialization. Feature point menu now shows roi's

22 May 2009 1.4

Folder 'Patient Files' Should have had a blank .txt file called 'Patients.txt' This was added. If it's missing please add to your copy.

10 Feb 2012 1.5

Changed the usage of the fileparts function to prevent errors when using the latest version of Matlab

Contact us