This is the sample implementation and benchmark dataset of the binary image registration algorithm described in the following papers:
Attila Tanacs and Zoltan Kato.
Fast Linear Registration of 3D Objects Segmented from Medical Images.
In Proceedings of International Conference on BioMedical Engineering and Informatics,
Shanghai, China, pages 299--303, October 2011. IEEE.
Attila Tanacs, Joakim Lindblad, Natasa Sladoje and Zoltan Kato.
Estimation of Linear Deformations of 3D Objects.
In Proceedings of International Conference on Image Processing,
Hong Kong, China, pp. 153-156, September 2010. IEEE.
The main code has been written by Viktor Varjas in Java. The code is released under the GNU General Public License.
For 3D visualization, we use the JOGL package.
The benchmark dataset contains 15 different template images and 1500 observations generated synthetically by random affine transformations. Please cite the above publication whenever you use the dataset.
Unzip the contents of the downloaded ZIP file to an arbitrary directory.
To run the application:
- Change to the unzipped directory.
- If you want to use the GUI:
Hint: specifying the maximum heap size of the Java Virtual Machine is strongly recommended when working with large images. E.g., to specify 2GB heap size, start the application from the command line by typing:
java -jar -Xmx2048m BinReg3D.jar
The heap size is specified after the
-Xmx parameter without whitespaces.
Specifying parameters in the command line (no GUI version):
- Specifying 2 parameters
java -jar -Xmx2048m BinReg3D.jar template.img observation.img
Register observation to template. The following new files will be created in the observation's directory:
observation_resultMatrix.txt: Found geometric transformation.
observation_Source.img: template image in the same extent as the registered observation.
observation_Registered.img: observation transformed to the template.
observation_Xor.img: Analyze image of the registration differences.
- Specifying 7 parameters
java -jar -Xmx2048m BinReg3D.jar template.img observation.img stat.txt matrix.txt template.img observed.img xor.im
Same as the 2 parameter version, except that here the name of the resulting files can be explicitely specified. If a file is not needed, a minus sign can be used, e.g. the following gives only the registration matrix and the difference image:
java -jar -Xmx2048m BinReg3D.jar template.img observation.img - matrix.txt - - xor.im
- Specifying 6 parameters
java -jar -Xmx2048m BinReg3D.jar template.img observation.img orientations algebraic_limit pre-opt transform_type
orientations: Number of orientations to use. Should be an integer between 1 and 5.
algebraic_limit: When the error of the system is below this limit, further orientations will not be considered. This should be a non-negative real number. Suggested value is 100.
pre-opt: Maximal allowed iteration number of the pre-optimizer. Should be an integer nember. Suggested value is between 20 and 200.
transform-type: Can be 0 (affine), 1 (rigid-body with calculated Jacobi) or 2 (rigid-body with constant 1 Jacobi).
- Specifying 11 parameters
java -jar -Xmx2048m BinReg3D.jar template.img observation.img
stat.txt matrix.txt template.img observed.img xor.im
orientations algebraic_limit pre-opt transform_type
Combination of the 7 and 6 parameters method.
Only binary images are supported in Analyze format. Some test images are provided under the
Images subdirectory. The program GUI should be intuitive. Main steps:
A short description of the "ground truth" text file
- Open template image (Open source img button).
- Open observation image or create one synthetically from the template by specifying the transformation parameters manually. Optionally these can be read from a "ground truth" text file.
The 3D images will be opened in separate windows. You can step through the slices by dragging and moving the ticker.
By clicking the radio buttons in the 3D options group, 3D models of the objects can also be visualized.
Registration parameters can be set in the top right-hand side (Number of orientations, Algebraic error limit, Iteration number limit for the pre-optimizer).
You can select the Rigid-body restriction and in this case the computation method of the Jacobian. The default is the full affine registration.
- Press Start registration button.
- View and/or save registration results (transformation matrix and/or transformed observation volume).
The base name of the text file must be the same as of the observation image (the extensions are different).
The structure of the file is the following:
Forward transform 4x4
-0.22844212 0.50522136 -1.21009546 386.89114531
-0.01402690 1.30574045 0.53163168 -164.65444551
0.65908245 0.20290228 -0.40811226 110.14690641
0.00000000 0.00000000 0.00000000 1.00000000
Statistics (Origin offsets, Dimensions, Voxel counts):
221 -42 74 145 198 179 351214 351214.00000000
Forward transform is the matrix that was used to generate the observation.
Statistics data is for information only, not used by the program.
This is a synthetic binary image dataset for testing affine registration
methods. All images are in Analyze format. There are 15 different template images. The observations were generated synthetically by applying randomly choosen affine transformations composed by
- Arbitrary degree of rotations around the axes;
- [-1,1] shearings;
- [0.5,1.5] scalings; (half of them shrinking, the other half magnification)
- [0,1] translations
For each template, we applied 100 transformations, of which 25 were rigid-body, 25 with non-uniform scaling, and 50 full affine.
Notes on the image file format
Images should be in uncompressed Analyze format.
Voxel values should be binary: zero is for background voxels, an arbitrary positive intensity value is for object points.
The observation images are cropped, i.e., the empty rows, columns and slices are removed after transformation.
This changes the origin of the dataset which causes problems when using the gold standard transformation
(that is stored in the separate "ground truth" text file).
That is why we store the coordinates of the new origin described in the original coordinate system.
These are integer numbers represented as a string and are stored in the descrip field of
the Analyze header starting at file position 148 (see Analyze format description).
These should be added to the column-row-slice coordinates of the object points.