[Elastix] How to use UseComplement in MultiMetric scenarios

Fitze Thomas (fitz) fitz at zhaw.ch
Wed Apr 22 17:11:19 CEST 2015

Hi there!

Im trying to do a multi metric registration with (Metric "AdvancedMattesMutualInformation" "AdvancedKappaStatistic”). As far as i understand those 2 metric, i’ll have to use the complement of the KappaStatistic but not of the MMI. I tried to do this by using (UseComplement "false" "true”), but it appears that this does not work. The registration log always reports metric 2 as positive value, regardless of the UseComplement setting.

Am i doing this wrong? Here’s the full config:
(FixedInternalImagePixelType "short")
(MovingInternalImagePixelType "short")
(FixedImageDimension 3)
(MovingImageDimension 3)
(UseDirectionCosines "true")

// Main Components 
(Registration "MultiMetricMultiResolutionRegistration")
(Transform "AffineTransform")

// Multiresolution
(FixedImagePyramid "FixedSmoothingImagePyramid" "FixedSmoothingImagePyramid")
(MovingImagePyramid "MovingSmoothingImagePyramid" "MovingSmoothingImagePyramid")
(NumberOfResolutions 3 )
(ImagePyramidSchedule 4 4 1  2 2 1  1 1 1 )

// initial transformation
(AutomaticScalesEstimation "true")
(AutomaticTransformInitialization "true")
(AutomaticTransformInitializationMethod "GeometricalCenter")
//(HowToCombineTransforms "Compose")
(HowToCombineTransforms "Add")

// ******************* Optimizer ****************************
(Optimizer "AdaptiveStochasticGradientDescent")
(MaximumNumberOfIterations 500)
(MaximumStepLength 10.0)

// ****************** Metric *********************
(Metric "AdvancedMattesMutualInformation" "AdvancedKappaStatistic")
(UseForegroundValue "false")
(UseComplement "false" "true")
(UseRelativeWeights "false")
(Metric0Weight 0.3) 
(Metric1Weight 0.7)
(NumberOfHistogramBins 32)
(ErodeMask "false")

// **************** Image sampling **********************
(NumberOfSpatialSamples 10000)
(ImageSampler "RandomCoordinate" "RandomCoordinate")
(UseRandomSampleRegion "false")
(NewSamplesEveryIteration "true")
(CheckNumberOfSamples "false")

// ************* Interpolation and Resampling ****************
(Interpolator "LinearInterpolator" "NearestNeighborInterpolator")
(ResampleInterpolator "FinalBSplineInterpolator" "FinalBSplineInterpolator")
(Resampler "DefaultResampler" "DefaultResampler")
(BSplineInterpolationOrder 1)
(FinalBSplineInterpolationOrder 3)
(FixedImageBSplineInterpolationOrder 3)
(DefaultPixelValue 0)
(WriteResultImage "true")
(ResultImagePixelType "short")
(ResultImageFormat "nrrd”)

And this is the CLI call:
elastix -f0 ${FIX_IMGP0} -f1 ${FIX_IMGP1} -m0 ${MOV_IMGP0} -m1 ${MOV_IMGP1} -p Affine.txt -out "${DATA_RESULT}0" 


More information about the Elastix mailing list