[Elastix] How to use UseComplement in MultiMetric scenarios

Polfliet Mathias mpolflie at etro.vub.ac.be
Wed Apr 22 19:29:35 CEST 2015

The KappaStatistic is always a positive value between 0 and 1. Since all optimisers try to minimise the metric value it is a good idea to set the UseComplement to "true". In the case of no foreground alignment, the KappaStatistic would return 0 and increase to 1 for a perfect registration if the UseComplement is set to "false". The solution to your problem would be:

(UseComplement "true”)

Since the AdvancedMattesMutualInformation metric does not have this option/setting.

With kind regards,

Mathias Polfliet

On 22 Apr 2015, at 17:11, Fitze Thomas (fitz) <fitz at zhaw.ch<mailto:fitz at zhaw.ch>> wrote:

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"

Elastix mailing list
Elastix at bigr.nl<mailto:Elastix at bigr.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bigr.nl/pipermail/elastix/attachments/20150422/d69800aa/attachment.html>

More information about the Elastix mailing list