What is it?
MelastiX is a collection of MATLAB wrappers for the open source image registration suite Elastix. Elastix is cross-platform and is normally called from the system command-line (no GUI). MelastiX allows the elastix and transformix binaries to be called from within MATLAB as though they are native MATLAB commands.
What does it do?
- The user can feed in MATLAB matrices instead of image file names and get a MATLAB matrix back as a result.
- Parameters can be passed in as Elastix text files or as an MelastiX YAML file. The latter provides some error-checking options as the type and possible values of the parameters can be checked.
- Parameter files can be modified by passing an optional structure as a command-line argument. This makes it easy to explore how changing parameters affects registration accuracy.
- A function and example are provided to handle inverse transforms.
- Transforms sparse points.
- Handles both 2D and 3D data. Examples are only 2D, though.
What does it not do?
At the moment MelastiX does not provide tools to:
- Handle the mask option, thread option, and priority arguments for the elastix binary.
- Handle multiple fixed and moving image in one elastix call.
- Analyse transform parameters.
- Place the Elastix binaries in your system path. If you don't know how to do that, there's information here for Windows and Linux.
- Add the MelastiX code directory to your MATLAB path.
- Add yamlmatlab to your MATLAB path.
- Run the examples in MelastiX_examples.
Installing Elastix via the Linux package manager may lead to errors in MATLAB of the sort:
error while loading shared libraries: libANNlib.so.
If so, remove the version installed by the package manager and install manually from the Elastix GitHub page.
$ bzip2 -d elastix-4.9.0-linux.tar.bz2 $ tar -xvf elastix-4.9.0-linux.tar $ sudo cp bin/* /usr/local/bin/ $ sudo cp lib/* /usr/local/lib/
What to do if the transform fails?
If you get unexpected results, first check whether the transform parameter file was written properly. If you are providing an Elastix parameter file and not modifying it then you should be fine. However, if you use the .yml approach or modify a parameter file using a structure then it's possible you've found a bug in the writing of the paramater file. To diagnose this, look at the written parameter file by calling elastix.m with a user-defined output path (so the files produced are not deleted) or use the verbose option in elastix_paramStruct2txt. If you're still getting unexpected results then probably you have an issue with Elastix itself: please go the Elastix website for documentation or ask on their forum.
You will need at least MATLAB version R2017b.