Error with elastix registration

Running elastix with parameter file 0: “/Users/…/Downloads/Slicer.app/Contents/Extensions-27970/SlicerElastix/lib/Slicer-4.11/qt-scripted-modules/Resources/RegistrationParameters/Parameters_Rigid.txt”.

Current time: Thu Jan 30 13:52:42 2020.
Reading the elastix parameters from file …

Installing all components.
InstallingComponents was successful.

ELASTIX version: 4.900
Command line options from ElastixBase:
-f /var/folders/rm/z7mv0dx968j37d7g4ywm43b80000gn/T/Slicer-drpree/Elastix/20200130_135241_078/input/fixed.mha
-m /var/folders/rm/z7mv0dx968j37d7g4ywm43b80000gn/T/Slicer-drpree/Elastix/20200130_135241_078/input/moving.mha
-fMask unspecified, so no fixed mask used
-mMask unspecified, so no moving mask used
-out /var/folders/rm/z7mv0dx968j37d7g4ywm43b80000gn/T/Slicer-drpree/Elastix/20200130_135241_078/result-transform/
-p /Users/drpree/Downloads/Slicer.app/Contents/Extensions-27970/SlicerElastix/lib/Slicer-4.11/qt-scripted-modules/Resources/RegistrationParameters/Parameters_Rigid.txt
-p /Users/drpree/Downloads/Slicer.app/Contents/Extensions-27970/SlicerElastix/lib/Slicer-4.11/qt-scripted-modules/Resources/RegistrationParameters/Parameters_BSpline.txt
-threads unspecified, so all available threads are used
WARNING: The parameter “UseDirectionCosines”, requested at entry number 0, does not exist at all.
The default value “true” is used instead.

WARNING: The option “UseDirectionCosines” was not found in your parameter file.
From elastix 4.8 it defaults to true!
This may change the behavior of your registrations considerably.

Command line options from TransformBase:
-t0 unspecified, so no initial transform used

Reading images…
Reading images took 230 ms.

WARNING: the fixed pyramid schedule is not fully specified!
A default pyramid schedule is used.
WARNING: the moving pyramid schedule is not fully specified!
A default pyramid schedule is used.
WARNING: The parameter “AutomaticTransformInitializationMethod”, requested at entry number 0, does not exist at all.
The default value “GeometricalCenter” is used instead.
Transform parameters are initialized as: [0, 0, 0, 0.3627215474843979, -104.6372784525156, -27.999998092651353]
Scales are estimated automatically.
Scales for transform parameters are: [38942.372131347656, 38942.372131347656, 63034.744262695305, 1, 1, 1]
Initialization of all components (before registration) took: 7 ms.
Preparation of the image pyramids took: 1344 ms.

Resolution: 0
WARNING: The parameter “ShowExactMetricValue”, requested at entry number 0, does not exist at all.
The default value “false” is used instead.
WARNING: The parameter “CheckNumberOfSamples”, requested at entry number 0, does not exist at all.
The default value “true” is used instead.
WARNING: The parameter “UseMultiThreadingForMetrics”, requested at entry number 0, does not exist at all.
The default value “true” is used instead.
Setting the fixed masks took: 0 ms.
Setting the moving masks took: 0 ms.
WARNING: The parameter “NumberOfFixedHistogramBins”, requested at entry number 0, does not exist at all.
The default value “32” is used instead.
WARNING: The parameter “NumberOfMovingHistogramBins”, requested at entry number 0, does not exist at all.
The default value “32” is used instead.
WARNING: The parameter “FixedLimitRangeRatio”, requested at entry number 0, does not exist at all.
The default value “0.01” is used instead.
WARNING: The parameter “MovingLimitRangeRatio”, requested at entry number 0, does not exist at all.
The default value “0.01” is used instead.
WARNING: The parameter “FixedKernelBSplineOrder”, requested at entry number 0, does not exist at all.
The default value “0” is used instead.
WARNING: The parameter “MovingKernelBSplineOrder”, requested at entry number 0, does not exist at all.
The default value “3” is used instead.
WARNING: The parameter “UseFastAndLowMemoryVersion”, requested at entry number 0, does not exist at all.
The default value “true” is used instead.
WARNING: The parameter “UseJacobianPreconditioning”, requested at entry number 0, does not exist at all.
The default value “false” is used instead.
WARNING: The parameter “FiniteDifferenceDerivative”, requested at entry number 0, does not exist at all.
The default value “false” is used instead.
WARNING: The parameter “SP_A”, requested at entry number 0, does not exist at all.
The default value “20” is used instead.
WARNING: The parameter “MaximumNumberOfSamplingAttempts”, requested at entry number 0, does not exist at all.
The default value “0” is used instead.
WARNING: The parameter “SigmoidInitialTime”, requested at entry number 0, does not exist at all.
The default value “0” is used instead.
WARNING: The parameter “MaxBandCovSize”, requested at entry number 0, does not exist at all.
The default value “192” is used instead.
WARNING: The parameter “NumberOfBandStructureSamples”, requested at entry number 0, does not exist at all.
The default value “10” is used instead.
WARNING: The parameter “UseAdaptiveStepSizes”, requested at entry number 0, does not exist at all.
The default value “true” is used instead.
WARNING: The parameter “AutomaticParameterEstimation”, requested at entry number 0, does not exist at all.
The default value “true” is used instead.
WARNING: The parameter “UseConstantStep”, requested at entry number 0, does not exist at all.
The default value “false” is used instead.
WARNING: The parameter “MaximumStepLengthRatio”, requested at entry number 0, does not exist at all.
The default value “1” is used instead.
WARNING: The parameter “MaximumStepLength”, requested at entry number 0, does not exist at all.
The default value “0.809152” is used instead.
WARNING: The parameter “NumberOfGradientMeasurements”, requested at entry number 0, does not exist at all.
The default value “0” is used instead.
WARNING: The parameter “NumberOfJacobianMeasurements”, requested at entry number 0, does not exist at all.
The default value “1000” is used instead.
WARNING: The parameter “NumberOfSamplesForExactGradient”, requested at entry number 0, does not exist at all.
The default value “100000” is used instead.
WARNING: The parameter “SigmoidScaleFactor”, requested at entry number 0, does not exist at all.
The default value “0.1” is used instead.
Elastix initialization of all components (for this resolution) took: 30 ms.
Computing the fixed image extrema took 0 ms.
Computing the moving image extrema took 0 ms.
Initialization of AdvancedMattesMutualInformation metric took: 57 ms.
Starting automatic parameter estimation for AdaptiveStochasticGradientDescent …
WARNING: The parameter “ASGDParameterEstimationMethod”, requested at entry number 0, does not exist at all.
The default value “Original” is used instead.
Computing JacobianTerms …
Computing the Jacobian terms took 0.001056s
NumberOfGradientMeasurements to estimate sigma_i: 6
Sampling gradients …

Progress: 0%Time spent in resolution 0 (ITK initialization and iterating): 0.174 s.
Stopping condition: Error in metric.
Settings of AdaptiveStochasticGradientDescent in resolution 0:
( SP_a 1.000000 )
( SP_A 20.000000 )
( SP_alpha 0.602000 )
( SigmoidMax 1.000000 )
( SigmoidMin -0.800000 )
( SigmoidScale 0.000000 )

itk::ExceptionObject (0x7fb824102cc0)
Location: “ElastixTemplate - Run()”
File: /Volumes/Dashboards/Preview/S-0-E-b/SlicerElastix-build/elastix/Common/CostFunctions/itkAdvancedImageToImageMetric.hxx
Line: 1018
Description: itk::ERROR: AdvancedMattesMutualInformationMetric(0x7fb824842e00): Too many samples map outside moving image buffer: 10108 / 69632

Error occurred during actual registration.

Errors occurred!
vtkDebugLeaks has found no leaks.

Error:

This happens when the two input volumes don’t overlap enough.

I would recommend doing an approximate landmark registration with 3-4 landmarks points to somewhat align the images before fully automatic registration.

If your images have approximately the same orientation and only their position differs significantly then you may enable Elastix’ builtin transform initialization by editing the parameter files (see section “5.5.2 Bad initial alignment” in Elastix manual).