// ********** Image Types

(FixedInternalImagePixelType "float")
(FixedImageDimension 3)
(MovingInternalImagePixelType "float")
(MovingImageDimension 3)


// ********** Components

//(Registration "MultiResolutionRegistration")
(Registration "MultiMetricMultiResolutionRegistration")
(FixedImagePyramid "FixedSmoothingImagePyramid" "FixedSmoothingImagePyramid")
(MovingImagePyramid "MovingSmoothingImagePyramid" "MovingSmoothingImagePyramid")
(Interpolator "BSplineInterpolator" "BSplineInterpolator")
//(FixedImagePyramid "FixedSmoothingImagePyramid")
//(MovingImagePyramid "MovingSmoothingImagePyramid" )
//(Interpolator "BSplineInterpolator")

//(Interpolator "LinearInterpolator")
//(Metric "AdvancedMeanSquares")
//(Metric "AdvancedMattesMutualInformation")
(Metric "AdvancedMattesMutualInformation" "AdvancedKappaStatistic")
(Optimizer "StandardGradientDescent")
//(Optimizer "AdaptiveStochasticGradientDescent")
(ResampleInterpolator "FinalBSplineInterpolator")
//(ResampleInterpolator "FinalLinearInterpolator")
(Resampler "DefaultResampler")
(Transform "BSplineTransform")

(Metric0Weight 0.9)
(Metric1Weight 0.1)

// ********** Pyramid

// Total number of resolutions
(NumberOfResolutions 1)
//(ImagePyramidSchedule 1 2 2 1 1 1)

// default schedule: isotropic upsampling with factor 2

// ********** Transform
//(AutomaticTransformInitialization "true")
(FinalGridSpacingInPhysicalUnits 3.0 3.0 3.0)
//(GridSpacingSchedule 4.0 2.0 1.0)
(HowToCombineTransforms "Compose")


// Option supported in elastix 4.1:
(UseFastAndLowMemoryVersion "true")


// ********** Optimizer

// Maximum number of iterations in each resolution level:
(MaximumNumberOfIterations 500)

//(AutomaticParameterEstimation "true")
//(UseAdaptiveStepSizes "true")

//SP: Param_a in each resolution level. a_k = a/(A+k+1)^alpha
(SP_a 10000.0)
//(SP_a 500.0)

//SP: Param_alpha in each resolution level. a_k = a/(A+k+1)^alpha
(SP_alpha 0.602)

//SP: Param_A in each resolution level. a_k = a/(A+k+1)^alpha
(SP_A 50.0)

// ********** Metric

//Number of grey level bins in each resolution level:
(NumberOfHistogramBins 32)
(FixedLimitRangeRatio 0.0)
(MovingLimitRangeRatio 0.0)
(FixedKernelBSplineOrder 3)
(MovingKernelBSplineOrder 3)


// ********** Several

(WriteTransformParametersEachIteration "false")
(WriteTransformParametersEachResolution "false")
(WriteResultImageAfterEachResolution "false")
//(WriteResultImage "false")
(ShowExactMetricValue "false")
(ErodeMask "false")


// ********** ImageSampler

//Number of spatial samples used to compute the mutual information in each resolution level:
(ImageSampler "RandomSparseMask" "RandomSparseMask")
//(ImageSampler "RandomCoordinate" "RandomCoordinate")

(NewSamplesEveryIteration "true")
//(UseRandomSampleRegion "true")
//(SampleRegionSize 40.0 40.0 40.0)

(FixedImageBSplineInterpolationOrder 1 )

//(CheckNumberOfSamples "true")
//(MaximumNumberOfSamplingAttempts 10)

(NumberOfSpatialSamples 2000)






// ********** Interpolator and Resampler

//Order of B-Spline interpolation used in each resolution level:
(BSplineInterpolationOrder 1)

//Order of B-Spline interpolation used for applying the final deformation:
//(FinalBSplineInterpolationOrder 1)

//Default pixel value for pixels that come from outside the picture:
(DefaultPixelValue 0.0000000000)

(ResultImageFormat "mhd")
(ResultImagePixelType "float")
