Registration with BSpline method, ITKv4 registration

I have a regestration problem with Bspline transform.
I want to do the registration beween CT and MRI. I use the same precedure: manuel tranform for align the two series at the first time, Linear Transform for the second time and the BSpline transform for the thrid time.
I have tried in 3 PC (win 7, win 10 et ubuntu 18), work perfectly. But the 4th PC (ubuntu 18, AMD 5700, 32G memory, Nvidia GTV 1660) always give the same errer (LBFGSB optimizer …). I have tried with 4.13.0 et 4.11 version, the same results.
Could anyone give me some advise? thank you.

General Registration (BRAINS) standard error:

WARNING: In /work/Preview/Slicer-0-build/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSBOptimizerv4.cxx, line 99
LBFGSBOptimizerv4 (0x14ef8c0): LBFGSB optimizer does not support scaling. All scales are set to one.

General Registration (BRAINS) standard output:

Original Fixed image origin[-125, -102.2, -11.25, 0]
Read ITK transform from file: /tmp/Slicer-hao/BJIGG_vtkMRMLLinearTransformNodeF.h5
HACK: 0  AffineTransform
TransformTypes: BSpline(1 of 1).

=============================== ITKv4 Registration: Starting Transform Estimations for BSpline(1 of 1).===============================

Initialized BSpline transform is set to be an identity transform.
  - Number of parameters = 9945
-- WARNING: Only one in every 663 parameters is printed on screen.

LBFGSB optimizer is used for BSpline registration using following parameters set:
NOTICE: You can use commandline options to adjust these parameters to find a
         probable better compromise between running time and registration precision.
 - Cost Function Convergence Factor : 2e+13
 - Projected Gradient Tolerance     : 1e-05
 - Maximum Number of Corrections    : 25
 - Maximum Number of Evaluations    : 900
 - Maximum Number of Iterations     : 1500

Moving image is warped by initial transform, before it is passed to the BSpline registration.

*** Running bspline registration (meshSizeAtBaseLevel = [14, 10, 12]) ***

“General registration (BRAINS)” module requires experimentation with registration parameters (percentage of samples, minimum and maximum step length, and relaxation factor).

I would suggest to try SlicerElastix extension, because its default registration preset gives good results for all reasonable inputs. The only requirement is to crop the images to approximately the same anatomical region (e.g., if one image only contains the brain then crop the other image similarly).

1 Like

thanks, I will try it.

It work perfectly with Elastix.
otherwise, a little long but acceptable.

thanks Iassoan.

Great, thanks for the update!

With tuning of registration parameters (cropping, resampling of inputs, good initialization, reduced number of samples, etc.) you should be able to get rigid registration in 10-20 seconds and bspline in about a minute.

realy? it is good news. could you give me some articles ?

The ITK Software Guide is a good introduction to mechanics of intensity-based medical image registration. They should give you an idea how to choose number of samples, step size/relaxation factor, optimizer stopping conditions, etc. to reduce registration time.

I will try to read it, likely not easy to understand all of the mechanics of ITK. I am a medical doctor… :sweat_smile:


I have read some ITK, Elastix and SimpleElastix documents and begin to understand some mecanisme in the processus. but in pratice, I have still some questions:

  1. tuning of registration parameters, do you means that tuning this parameters in the General Registration (brain) module? because I see that in the Elastix module the paramers are in the database folder, and the items are differents with which you have mentioned (cropping, resampling, intitialiation, et al). In the Elastix parametermap, there are such as "ImagePyramidSchedule, Number of Iterations, Number of spatial samples, et al), which may be modified to optimise the proecssus, could we research the same resultes?
  2. resampling of inputs: do you means to down-sampling the moving images, ex from 512x512x200 to 256x256X100
  3. good initialization: do you means to do the manuel registration and harden the transform?
  4. reduced number of samples: I see that in the tuto, 100 000 to 200 000 are oftens used. We can reduce to which niveau? 10 000. how about B spline grid size.
  • General registration (BRAINS): parameters can be changed in the module user interface
  • General registration (Elastix): parameters can be changed by editing parameter files

Yes. Downsampling will not affect the registration time fundamentally (as registration is sample-based) but there are a few places where a smaller image reduces processing time.

Convergence is usually faster if you start closer to the optimal solution. You can either turn of automatic initialization and manually register and harden transform on the input; or experiment with different automatic initialization options.

It depends on the size and complexity of your images. A typical 3D volume size is 256x256x256 = 16 million voxels. If on average you take 1 sample out of each 5x5x5 cube then you will end up with 134 000 samples. This sampling density is typically sufficient for rigid registration and often you can get acceptable results with even less samples (about 10 000). If you do bspline registration with many grid points then you might want to use a bit more samples.

1 Like

thanks Iassoan, your advise is very useful.

1 Like