Frequently asked questions (FAQ)
I am getting the error message: "Library not loaded: libANNlib.dylib" (on Mac) or similar on Linux.
- On Linux, the solution is: add the elastix lib directory to your
LD_LIBRARY_PATH. You can add the following line to ~/.bashrc or ~/.bash_profile:
- On Mac, the solution is: add the elastix lib directory to your
DYLD_LIBRARY_PATH. You can add the following line to ~/.bashrc or ~/.bash_profile:
With what compilers does
At least with the ones that are used on the nightly dashboard: http://my.cdash.org/index.php?project=elastix. Currently (2013), these include Microsoft Visual C++ 2008 and 2010 on Windows and gcc 4.x and clang 3.3+ on Linux 64bit or on Mac OS X. The underlying ITK code works with numerous compilers.
Do you have a manual?
elastix does not start on Windows and complains about missing libraries.
On some Windows systems it might be necessary to install the Microsoft Visual C++ Redistributable Package. Depending on the
The error message may be something like:
elastix version you are using it may be the one for MSVS 2008 (x64), for MSVS 2010 (x64), or MSVS 2012 (x64). Redistributable packages for x86 or for other MSVS compiler versions are also available on that website.
- The application failed to initialize properly (0xc0000135).
- This application has failed to start because the application configuration is incorrect. Reinstalling application may fix this problem.
- The system cannot execute the specified program.
- R6034 An application has made an attempt to load the C runtime library incorrectly.
- This application has failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem.
- Resolve Partial Assembly failed for Microsoft.VC90.CRT. Reference error message: The referenced assembly is not installed on your system.
elastix 4.8 we also have a dependency on the OpenCL library for GPU support. In case of issues you may want to update the drivers of your GPU.
I am getting the error message: "Too many samples map outside moving image buffer". What does that mean?
This can have several causes:
- Wrong initialisation: the fixed and moving image are for a large part or completely non-overlapping. It is not possible to start the registration now. Check the headers of your images. Good image formats store the origin and image orientation. It will tell you if this is indeed the cause of the problem. You can solve the problem by:
- manually specifying an initialisation by providing a proper transformation that roughly aligns the two images. This can be done by using
"-t0 TransformParameters.txt" in the call to
- automatically initializing the registration by putting the centres of the two images on top of each other. This can be done by adding
"(AutomaticTransformInitialization "true")" to the parameter file.
- Too large steps are taken during the registration. Initially the images have an overlap, but during the registration the moving image is moved such that the overlap disappears. Usually, this is because too large steps are taken during the registration. You can solve the problem by:
- decreasing the stepsize of the optimizer.
- if you are using a rigid or affine transformation, then maybe only too large steps are taken for the parameters that define the rotations (or the affine matrix). These parameters are differently scaled as the translations, and therefore the stepsize for these parameters are scaled by some user-specified number. You may need to increase the scales by setting
"(Scales float)" in the parameter file to an appropiate value.
- Too small moving image mask. This can happen especially when no mask for the fixed image is used. During registration samples are drawn from the fixed image, and subsequently mapped to the moving image. If a mask for the moving image is used, some of these samples have no corresponding points within the moving image mask. When the mask is small the corresponce is insufficient to compute a valid metric value. You can solve this problem by:
- using a mask for the fixed image instead of the moving image.
- using also a mask for the fixed image on the corresponding region.
elastix retry drawing samples for a number of times by specifying
in the parameter file.
- Moving image much smaller than fixed image. During registration samples are drawn from the fixed image, and subsequently mapped to the moving image. When the moving image is much smaller than the fixed image (in physical space), some of these samples have no corresponding points within the moving image. The corresponce is insufficient to compute a valid metric value. You can solve this problem by:
elastix accept insufficient overlap earlier
in the parameter file. The default is 0.25, i.e. 25% of the fixed image samples should have a correspondence.
I am getting the error message: "Could not find enough image samples within reasonable time. Probably the mask is too small". What can I do about it?
Explanation: When sampling the fixed image you walk over it and check for each voxel if it is within the fixed image mask. If so, the sample is included, if not it is excluded. Drawing image samples is stopped:
- when the desired number of samples are drawn. This is ok, you will not get this error message.
- after drawing 10 times the desired number of samples. If after this, you still don't have the desired number of samples, elastix is terminated and this error message is thrown. This is to avoid getting stuck in a seemingly endless loop.
Solution: You can use the RandomSamplerSparseMask by adding
"(ImageSampler "RandomSparseMask")" to the parameter file. This sampler walks over the fixed image mask to draw samples. Note that for this sampler, samples are drawn from the voxel grid, no RandomCoordinateSamplerSparseMask is currently available.
I registered two downsampled images. How do I apply the transformation on the full sized moving image?
You take the
TransformParameter.txt file resulting from the registration and change the
Spacing to the ones of the full image. Then you can use
transformix to apply this transformation:
transformix -in fullImage.ext -tp TransformParameter_Changed.txt -out outputDirectory
I applied the transformation as found by the registration on a binary segmentation, but the deformed segmentation is not binary anymore and contains holes?
This is due to the interpolation. You can change the interpolation order in the
TransformParameter.txt file to nearest neighbour interpolation:
Is it possible to transform a set of points instead of a complete image with
Yes, that is possible. See section 4.2 of the manual.
transformix -tp TransformParameters.txt -out outputDirectory -def FileWithPoints.txt
The text file "
FileWithPoints.txt" should be created with a certain structure. The first line should be "index" or "point", depending if the user supplies voxel indices or real world coordinates. The second line should be the number of points that should be transformed. The third and following lines give the indices or points. It is also possible to deform all points, thereby generating a deformation field image. This is done using
-def all in the call to
Is it possible to apply the inverse transformation with
Section 6.1.6 of the manual explains how to compute the inverse.