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

(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")

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

(Registration "MultiResolutionRegistration")
(FixedImagePyramid "FixedRecursiveImagePyramid")
(MovingImagePyramid "MovingRecursiveImagePyramid")
(Interpolator "BSplineInterpolator")
(Metric "AdvancedNormalizedCorrelation")
(Optimizer "AdaptiveStochasticGradientDescent")
(ResampleInterpolator "FinalBSplineInterpolator")
(Resampler "DefaultResampler")
(Transform "BSplineTransform")


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

// Total number of resolutions
(NumberOfResolutions 5)
(ImagePyramidSchedule 16 16 8 8 8 4 4 4 2 2 2 1 1 1 1)


// ********** Transform

(FinalGridSpacingInPhysicalUnits 10.0 10.0 10.0)
(GridSpacingSchedule 8.0 8.0 4.0 2.0 1.0)
(HowToCombineTransforms "Compose")

//Save composite ITK transform
(ITKTransformOutputFileNameExtension "h5")
(WriteITKCompositeTransform "true")


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

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

(AutomaticParameterEstimation "true")

// We cannot use adaptive step sizes, because we use the local NC.
// So, it does not make sense to evaluate the inner product of the
// cost function derivative g_{k}^T g_{k-1}, since these are computed
// on different regions of the image.
// However, it is still better to use the adaptive gd method, since
// all parameters are estimated automatically, and adapted to the
// specific image content. We only don't use the time adaption.
(UseAdaptiveStepSizes "false")


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

(NumberOfHistogramBins 32)
(FixedLimitRangeRatio 0.0)
(MovingLimitRangeRatio 0.0)
(FixedKernelBSplineOrder 1)
(MovingKernelBSplineOrder 3)
(UseExplicitPDFDerivatives "false")


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

(WriteTransformParametersEachIteration "false")
(WriteTransformParametersEachResolution "true")
(WriteResultImageAfterEachResolution "false")
(WritePyramidImagesAfterEachResolution "false")
(WriteResultImage "false")
(ShowExactMetricValue "false")
(ErodeMask "false")

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

//Number of spatial samples used to compute the mutual information in each resolution level:
(ImageSampler "RandomCoordinate")
(NumberOfSpatialSamples 2000)
(NewSamplesEveryIteration "true")
(UseRandomSampleRegion "true")
(SampleRegionSize 50.0 50.0 50.0)
(MaximumNumberOfSamplingAttempts 50)


// ********** 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 3)

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

