Old versions

Here you will find previous releases of bUnwarpJ that are no longer supported, however you can find here the source files, user manual (only the relevant features) and documentation:

bUnwarpJ v2.5

In bUnwarpJ v2.5 the main file of the code was stored outside the package "bunwarpj" and all supporting classes had names with the prefix "bUnwarpJ". That was changed for the sake of clarification on version 2.6. There is not much difference for the user, apart from the macro call for input/output options, which was done without the package prefix:

call("bUnwarpJ_.elasticTransformImageMacro", "My_path/A.jpg", "My_path/B.jpg", "My_path/A_direct_transf.txt", "My_path/output.tif");

bUnwarpJ v2.5 files:

API documentation - bUnwarpJ v2.5

The API documentation can be reached online here or downloaded from here:

bUnwarpJ v2.0

In bUnwarpJ v2.0 the main plugin dialog changed in order to allow using ImageJ macro language, along with color image support and many fixed bugs.  The source JAVA code and the class files can be downloaded from here:

bUnwarpJ v2.0 files:

API documentation - bUnwarpJ v2.0

The API documentation can be reached online here or downloaded from here:

Installation - bUnwarpJ v2.0

You must simply download bUnwarpJ_.jar to the Plugins folder of ImageJ, restart ImageJ and there will be a new "Registration > bUnwarpJ" command in the Plugins menu.

To execute bUnwarpJ as a macro or from the command line, see the description in the User Manual.

User manual - bUnwarpJ v2.0

The main differences in the plugin from v1.1 to v2.0 are in the main window (where the advanced options are now included) and the macro call:

Main window

The plugin must be installed as described on Installation (for further information go to ImageJ). Once it is properly installed, the plugin should appear in the main menu under Plugins > Registration > bUnwarpJ. Two images (8, 16, 32-bit grayscale or RGB Color) need to be opened in order to be able to use the plugin. If so, the following window will open:

Main window
Figure 2: Main plugin window (v2.0)

Macro call

Since bUnwarpJ v2.0 the plugin allows using ImageJ macro language to be called. Therefore, the user can launch the plugin from a macro setting all the parameters of the plugin main window, for instance:

run("bUnwarpJ", "source_image=A target_image=B registration=Accurate initial_deformation=[Very Coarse] final_deformation=[Very Fine] divergence_weight=0.1 curl_weight=0.1 landmark_weight=1 image_weight=1 consistency_weight=10 stop_threshold=0.01 verbose save_transformations");

When calling the plugin like this, if the "save_transformations" parameter is set to true, the transformations files will be saved in the following predefined format (not save dialog is shown): source image name + "_direct_transf.txt" and target image name + "_inverse_transf.txt".

SIFT and MOPS support

You can see an example of the combination of both methods in the macro AffineConsistentElasticRegistration.txt by Marta Rivera-Alba and Ignacio Arganda-Carreras. It uses MOPS and bUnwarpJ to register an entire stack of images using the first slice as reference.

bUnwarpJ v1.1

bUnwarpJ v1.1 files:

API documentation - bUnwarpJ v1.1

The API documentation can be reached online here or downloaded from here:

Installation - bUnwarpJ v1.1

bUnwarpJ v1.1 works as a plugin for ImageJ, but can be also called from the command line. To use it with the ImageJ interface there are several options:

You can download and uncompress one the files above to the plugins folder. We recommend to create a "bUnwarpJ" folder there. Then, restart ImageJ and there will be a new "bUnwarpJ" or "bUnwarpJ > bUnwarpJ" (if a folder was created) command in the Plugins menu. Instead of restarting ImageJ, it is possible as well to use the "Plugins > Compile and Run..." option selecting the corresponding "bUnwarpJ_.java" file from the plugins folder.

Or you can simply download bUnwarpJ_.jar to the plugins folder of ImageJ (or subfolder), restart ImageJ and there will be a new "bUnwarpJ" command in the Plugins menu, or submenu.

To execute bUnwarpJ v1.1 as a macro or from the command line, see the description in the User Manual - bUnwarpJ v1.1.

User manual - bUnwarpJ v1.1

Generalities

First of all, the plugin must be installed as described on Installation (for further information go to ImageJ). Once it is properly installed, the plugin should appear in the main menu under Plugins > bUnwarpJ > bUnwarpJ. Two images need to be opened in order to be able to use the plugin. The main options of the program are preserved from the previous work (UnwarpJ - user manual), so we will only describe here the relevant novelties.

Consistency weight

Under the "Advanced options" panel of the main bUnwarpJ v1.1 window there is a new parameter to play with: the Consistency Weight. This number forces the algorithm to move into solutions that ensure the invertibility of the resulting deformations. Therefore, higher is this number, more strictly is one deformation the inverse of the other. Due to the different units, there is no rule for selecting the right parameters. For instance, to perform the registration of the tumor images above, we recommend consistency weight values around 20.0.

Advanced options
Figure 1: Advanced Options window (v1.1).


One important advantage of bUnwarpJ over the previous method lies in the fact that many registration problems can be solved without using the landmarks and regularization terms of the energy function (that means setting their corresponding parameters to 0.0). Therefore, no user interaction is needed and the computational complexity of the algorithm is reduced.

Validation and transformations' comparison

When using the "I/O Menu" from the toolbar, we have the possibility of processing different input and output files that will affect the registration.

toolbar
Figure 2: ImageJ toolbar when using bUnwarpJ v1.1 plugin. I/O menu option is selected.

Compare Transformations
Figure 3: I/O Menu options.

After last release, the plugin presents the following Input/Output options:

  • Load Landmarks: it allows loading landmarks files.
  • Save Landmarks As: it allows saving the image landmarks into a file.
  • Show Landmarks: it forces the landmarks to be displayed.
  • Load Elastic Transformation: it loads an elastic transformation from a file and applies it to the so-called source image. The transformation file must be in the format of the plugin B-spline transformations, i.e. the same format as the files created with the "Save Transformation" option.
  • Load Raw Transformation: it loads a raw transformation from a file and applies it to the so-called source image. The transformation file must be in "raw" format, i.e. the same format as the files created with the "Convert Transformation To Raw" option. See raw_transformation_template.txt for a format description.
  • Compare Opposite Elastic Transformations: it calculates the warping index of two elastic transformations, i.e. the average of the geometrical distance between every pixel and its version after applying both transformations (direct and inverse). This value is given as a result. The transformation files must be in the format of the plugin B-spline transformations (same format as the files created with the "Save Transformation" option).
  • Compare Raw Transformations: it calculates the warping index of two raw transformations. The transformation file must be in "raw" format, i.e. the same format as the files created with the "Convert Transformation To Raw" option.
  • Convert Transformation To Raw: it converts a B-spline transformation file into a raw transformation file.
  • Compose Elastic Transformations: it composes two elastic transformations into a raw transformation. The input files must be in the B-spline transformation format, and the output file will be in "raw" format.
  • Compose Raw Transformations: it composes two raw transformations into another raw transformation. Both input and output files will be in "raw" format.
  • Compose Raw and Elastic Transformations: it composes one raw transformation and one elastic transformation into a raw transformation.
  • Evaluate Image Similarity: it calculates de current similarity error between the source and target images. The results is displayed in the "Results" window.
  • Adapt Coefficients: it transforms the coefficients of an specific elastic transformation according to an integer image factor. Very useful for example when we have very large images. We can register subsampled versions of our images (let us say 4 times smaller) and then adapt the result transformations (image factor = 4) so we can apply to the high resolution images.
  • Load Source Mask: it loads a mask from file (binary image) in the source image.
  • Load Source Initial Affine Matrix: it loads an affine matrix as starting point for the source-target transformation.

These new options allow the user to compare the result of our program with any other registration method. 

You can also test bUnwarpJ v1.1 with SplineDeformationGenerator, a new ImageJ plugin that allows the user to generate five different image deformations: elastic, fisheye, perspective, barrel/pincushion and smile effect. SplineDeformationGenerator uses the same raw transformation file format as bUnwarpJ v1.1, so they are completely compatible.

Results

After the registration process, the results are presented in two stacks. Every stack presents the registered image, the corresponding target image and the warped source mask. In addition, if the "Verbose" option was marked in the "Advanced options" panel, the stacks will present as well the deformation field and grid, and a "Results" window will appear during the whole registration process showing the optimizer's steps.

Deformation Field ADeformation Grid ADeformation Field BDeformation Grid B

Figure 4: From top to bottom and left to right: deformation field A, deformation grid A, deformation field B and deformation grid B.

Macro and command line call

bUnwarpJ v1.1 might be called as well as an ImageJ macro or from the command line. Here, the program offers the same options as in the interface:

  • -help: shows the syntax of the program
  • -align: launches the registration of two input images
  • -elastic_transform: transforms the source image with a given elastic deformation (previously calculated)
  • -raw_transform: transforms the source image with a given raw deformation (previously calculated)
  • -compare_elastic: compares two previously calculated opposite elastic deformations through the warping index
  • -compare_elastic_raw: compares an elastic deformation with a raw deformation (both direct transformations) through the warping index
  • -compare_raw: compares two previously calculated and direct raw deformations through the warping index
  • -convert_to_raw: converts an elastic transformation into raw format
  • -compose_elastic: composes two elastic deformations, the result will be in raw format
  • -compose_raw: composes two raw deformations, the result will be too in raw format
  • -compose_raw_elastic: composes a raw deformation and an elastic one. Result in raw format
  • -adapt_transform: adapts an specific elastic transformation given a resolution image factor

To see the program help we can call the program from a macro like this:

run("bUnwarpJ ","-help");

Or from the command line (where $IJDIR is the directory where ImageJ is installed) like this:

java -Xmx512m -cp $IJDIR/ij.jar:$IJDIR/plugins/bUnwarpJ bUnwarpJ_ -help


For the rest of the options, follow the help instructions.

SIFT and MOPS plugin support

bUnwarpJ v1.1 has compatibility with the Stephan Saalfeld's plugin for automatic feature extraction: SIFT and MOPS algorithms. You only need to download the following files to your ImageJ plugins folder:

You can read the SIFT parameters' explanation from Albert Cardona's site.

After applying SIFT or MOPS methods, you will get two sets of corresponding points in both images. If you call now bUnwarpJ v1.1, then the corresponding points will appear as source and target landmarks.

Lena MOPSWorped Lena MOPSLena bUnwarpJ LandmarksWarped Lena bUnwarpJ Landmarks

Figure 5: SIFT/MOPS - bUnwarpJ compatibility. Top row: MOPS results. Bottom row: landmarks after calling bUnwarpJ.