Skip to content

best result rather than last result #1346

@lala0402

Description

@lala0402

How to make elastix return the best value instead of the result from the last iteration

param like this

how should i modify the paramfile

=============== start of ParameterFile: source/default_params.txt ===============
// 基本图像设置
(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")
(FixedImageDimension 3)
(MovingImageDimension 3)

// 高级参数
(UseDirectionSpecificScales "true")
(AutomaticScalesEstimation "true")
(ScalesEstimator "PhysicalShift")

// 主要组件
(Registration "MultiResolutionRegistration")
(Interpolator "BSplineInterpolator")
(ResampleInterpolator "FinalBSplineInterpolator")
(Resampler "DefaultResampler")
(Transform "EulerTransform")
(Optimizer "AdaptiveStochasticGradientDescent")
(Metric "AdvancedMattesMutualInformation")

// 图像金字塔
(FixedImagePyramid "FixedSmoothingImagePyramid")
(MovingImagePyramid "MovingSmoothingImagePyramid")

// 变换类型 (3D欧拉变换)
//(AutomaticTransformInitialization "true")
(HowToCombineTransforms "Compose")
//(AutomaticTransformInitialization "false")

(TransformParameters -0.9444 -58.5444 -151.7351 0.0 0.0 0.0)
(CenterOfRotationPoint 0.0 0.0 0.0)
(InitialTransformParameterFileName "NoInitialTransform")
(Direction 1 0 0 0 1 0 0 0 1)
(ComputeZYX "false")

// 优化器设置
(MaximumNumberOfIterations 800)
//(MaximumStepLength 0.0)
(AutomaticParameterEstimation "true")
(AutomaticTransformInitializationMethod "None")
(UseAdaptiveStepSizes "true")
(AdaptiveStepSizeStrategy "Explosive") // 自适应策略
//(MinimumStepLength 0.0) // MinimumStepLength=1e-6 (取消注释并设置)
//(ConvergenceWindowSize 20) // ConvergenceWindowSize=20
//(MinimumConvergenceValue 1e-6) // MinimumConvergenceValue=1e-6
(MaximumStepSizeInPhysicalUnits 0) // MaximumStepSizeInPhysicalUnits=0.0
(StepSizeStrategy "Adaptive") // 步长策略
//(UseBestSampling "true") // 近似ReturnBestParametersAndValue=True
(ScalesPhysicalShiftScale 1.0) // 对应 SetSmallParameterVariation(1.0)
(UseDirectionForScalesEstimation "true") // 对应 SetTransformForward(true)

// 度量设置 (Mattes互信息)

(NumberOfHistogramBins 30)
//(UseNormalization "true")

// 多分辨率设置
(NumberOfResolutions 4)
(ImagePyramidSchedule 8 8 8 4 4 4 2 2 2 1 1 1)
(SmoothingSigmas 4.0 2.0 1.0 0.0)
(SmoothingSigmasAreInPhysicalUnits "true")

// 采样策略
(ImageSampler "RandomCoordinate")
(NewSamplesEveryIteration "true")
(UseRandomSampleRegion "false")
(NumberOfSpatialSamples 2048) // 采样点数量
//(SampleGridSpacing 1 1 1 2 2 2 5 5 5 10 10 10)

// 插值设置
(BSplineInterpolationOrder 1)
(FinalBSplineInterpolationOrder 3)
(DefaultPixelValue -1000.0)

// 输出设置
(WriteResultImage "true")
(ResultImagePixelType "float")
(ResultImageFormat "mha")
(WriteTransformParametersEachResolution "true")
(ITKTransformOutputFileNameExtension "tfm")
(WriteITKCompositeTransform "true")
(UseBestSampling "true" "true" "true" "true")
(ReturnBestParametersAndValue "true" "true" "true" "true")

=============== end of ParameterFile: source/default_params.txt ===============

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions