20 #include <itkAmoebaOptimizer.h>
21 #include <itkConjugateGradientOptimizer.h>
22 #include <itkExhaustiveOptimizer.h>
23 #include <itkFRPROptimizer.h>
24 #include <itkGradientDescentOptimizer.h>
25 #include <itkLBFGSBOptimizer.h>
26 #include <itkLBFGSOptimizer.h>
27 #include <itkNormalVariateGenerator.h>
28 #include <itkOnePlusOneEvolutionaryOptimizer.h>
29 #include <itkPowellOptimizer.h>
30 #include <itkQuaternionRigidTransformGradientDescentOptimizer.h>
31 #include <itkRegularStepGradientDescentOptimizer.h>
32 #include <itkSPSAOptimizer.h>
33 #include <itkVersorRigid3DTransformOptimizer.h>
34 #include <itkVersorTransformOptimizer.h>
42 m_NumberTransformParameters = numberTransformParameters;
47 if (m_OptimizerParameters.IsNull())
49 MITK_ERROR <<
"No parameters set! Returning\n";
52 int optimizer = m_OptimizerParameters->GetOptimizer();
56 OptimizerPointer->SetStepLength(m_OptimizerParameters->GetStepLengthExhaustive());
57 itk::ExhaustiveOptimizer::StepsType steps(m_NumberTransformParameters);
58 for (
int i = 0; i < m_NumberTransformParameters; i++)
60 steps[i] = m_OptimizerParameters->GetNumberOfStepsExhaustive();
63 OptimizerPointer->SetNumberOfSteps(steps);
65 return OptimizerPointer.GetPointer();
70 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
71 OptimizerPointer->SetLearningRate(m_OptimizerParameters->GetLearningRateGradientDescent());
72 OptimizerPointer->SetNumberOfIterations(m_OptimizerParameters->GetNumberOfIterationsGradientDescent());
73 return OptimizerPointer.GetPointer();
79 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
80 OptimizerPointer->SetLearningRate(
81 m_OptimizerParameters->GetLearningRateQuaternionRigidTransformGradientDescent());
82 OptimizerPointer->SetNumberOfIterations(
83 m_OptimizerParameters->GetNumberOfIterationsQuaternionRigidTransformGradientDescent());
84 return OptimizerPointer.GetPointer();
90 itk::LBFGSBOptimizer::BoundValueType lower(12);
91 itk::LBFGSBOptimizer::BoundValueType upper(12);
92 itk::LBFGSBOptimizer::BoundSelectionType select(12);
98 OptimizerPointer->SetLowerBound(lower);
99 OptimizerPointer->SetUpperBound(upper);
100 OptimizerPointer->SetBoundSelection(select);
101 OptimizerPointer->SetCostFunctionConvergenceFactor(1e+1);
102 OptimizerPointer->SetMaximumNumberOfCorrections(5);
103 OptimizerPointer->SetProjectedGradientTolerance(1e-5);
104 OptimizerPointer->SetMaximumNumberOfEvaluations(500);
105 OptimizerPointer->SetMaximumNumberOfIterations(200);
106 return OptimizerPointer.GetPointer();
111 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
113 generator->Initialize(12345);
114 OptimizerPointer->SetNormalVariateGenerator(generator);
115 OptimizerPointer->SetGrowthFactor(m_OptimizerParameters->GetGrowthFactorOnePlusOneEvolutionary());
116 OptimizerPointer->SetShrinkFactor(m_OptimizerParameters->GetShrinkFactorOnePlusOneEvolutionary());
117 OptimizerPointer->SetEpsilon(m_OptimizerParameters->GetEpsilonOnePlusOneEvolutionary());
118 OptimizerPointer->SetInitialRadius(m_OptimizerParameters->GetInitialRadiusOnePlusOneEvolutionary());
119 OptimizerPointer->SetMaximumIteration(m_OptimizerParameters->GetNumberOfIterationsOnePlusOneEvolutionary());
120 return OptimizerPointer.GetPointer();
125 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
126 OptimizerPointer->SetStepLength(m_OptimizerParameters->GetStepLengthPowell());
127 OptimizerPointer->SetStepTolerance(m_OptimizerParameters->GetStepTolerancePowell());
128 OptimizerPointer->SetValueTolerance(m_OptimizerParameters->GetValueTolerancePowell());
129 OptimizerPointer->SetMaximumIteration(m_OptimizerParameters->GetNumberOfIterationsPowell());
130 return OptimizerPointer.GetPointer();
135 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
136 OptimizerPointer->SetStepLength(m_OptimizerParameters->GetStepLengthFRPR());
137 if (m_OptimizerParameters->GetFletchReevesFRPR())
139 OptimizerPointer->SetToFletchReeves();
141 else if (m_OptimizerParameters->GetPolakRibiereFRPR())
143 OptimizerPointer->SetToPolakRibiere();
145 OptimizerPointer->SetMaximumIteration(m_OptimizerParameters->GetNumberOfIterationsFRPR());
146 return OptimizerPointer.GetPointer();
152 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
153 OptimizerPointer->SetGradientMagnitudeTolerance(
154 m_OptimizerParameters->GetGradientMagnitudeToleranceRegularStepGradientDescent());
155 OptimizerPointer->SetMinimumStepLength(m_OptimizerParameters->GetMinimumStepLengthRegularStepGradientDescent());
156 OptimizerPointer->SetMaximumStepLength(m_OptimizerParameters->GetMaximumStepLengthRegularStepGradientDescent());
157 OptimizerPointer->SetNumberOfIterations(m_OptimizerParameters->GetNumberOfIterationsRegularStepGradientDescent());
158 OptimizerPointer->SetRelaxationFactor(m_OptimizerParameters->GetRelaxationFactorRegularStepGradientDescent());
159 return OptimizerPointer.GetPointer();
164 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
165 OptimizerPointer->SetGradientMagnitudeTolerance(
166 m_OptimizerParameters->GetGradientMagnitudeToleranceVersorRigid3DTransform());
167 OptimizerPointer->SetMinimumStepLength(m_OptimizerParameters->GetMinimumStepLengthVersorRigid3DTransform());
168 OptimizerPointer->SetMaximumStepLength(m_OptimizerParameters->GetMaximumStepLengthVersorRigid3DTransform());
169 OptimizerPointer->SetNumberOfIterations(m_OptimizerParameters->GetNumberOfIterationsVersorRigid3DTransform());
170 return OptimizerPointer.GetPointer();
175 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
176 OptimizerPointer->SetGradientMagnitudeTolerance(
177 m_OptimizerParameters->GetGradientMagnitudeToleranceVersorTransform());
178 OptimizerPointer->SetMinimumStepLength(m_OptimizerParameters->GetMinimumStepLengthVersorTransform());
179 OptimizerPointer->SetMaximumStepLength(m_OptimizerParameters->GetMaximumStepLengthVersorTransform());
180 OptimizerPointer->SetNumberOfIterations(m_OptimizerParameters->GetNumberOfIterationsVersorTransform());
181 return OptimizerPointer.GetPointer();
186 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
187 OptimizerPointer->SetParametersConvergenceTolerance(
188 m_OptimizerParameters->GetParametersConvergenceToleranceAmoeba());
189 OptimizerPointer->SetFunctionConvergenceTolerance(m_OptimizerParameters->GetFunctionConvergenceToleranceAmoeba());
190 itk::Array<double> simplexDeltaAmoeba = m_OptimizerParameters->GetSimplexDeltaAmoeba();
191 OptimizerType::ParametersType simplexDelta(m_NumberTransformParameters);
192 for (
int i = 0; i < m_NumberTransformParameters; i++)
194 simplexDelta[i] = simplexDeltaAmoeba[i];
196 OptimizerPointer->AutomaticInitialSimplexOff();
197 OptimizerPointer->SetInitialSimplexDelta(simplexDelta);
198 OptimizerPointer->SetMaximumNumberOfIterations(m_OptimizerParameters->GetNumberOfIterationsAmoeba());
199 return OptimizerPointer.GetPointer();
204 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
214 return OptimizerPointer.GetPointer();
219 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
220 OptimizerPointer->SetGradientConvergenceTolerance(m_OptimizerParameters->GetGradientConvergenceToleranceLBFGS());
221 OptimizerPointer->SetLineSearchAccuracy(m_OptimizerParameters->GetLineSearchAccuracyLBFGS());
222 OptimizerPointer->SetDefaultStepLength(m_OptimizerParameters->GetDefaultStepLengthLBFGS());
223 OptimizerPointer->SetTrace(m_OptimizerParameters->GetTraceOnLBFGS());
224 OptimizerPointer->SetMaximumNumberOfFunctionEvaluations(m_OptimizerParameters->GetNumberOfIterationsLBFGS());
225 return OptimizerPointer.GetPointer();
230 OptimizerPointer->SetMaximize(m_OptimizerParameters->GetMaximize());
231 OptimizerPointer->Seta(m_OptimizerParameters->GetaSPSA());
232 OptimizerPointer->SetA(m_OptimizerParameters->GetASPSA());
233 OptimizerPointer->SetAlpha(m_OptimizerParameters->GetAlphaSPSA());
234 OptimizerPointer->Setc(m_OptimizerParameters->GetcSPSA());
235 OptimizerPointer->SetGamma(m_OptimizerParameters->GetGammaSPSA());
236 OptimizerPointer->SetTolerance(m_OptimizerParameters->GetToleranceSPSA());
237 OptimizerPointer->SetStateOfConvergenceDecayRate(m_OptimizerParameters->GetStateOfConvergenceDecayRateSPSA());
238 OptimizerPointer->SetMinimumNumberOfIterations(m_OptimizerParameters->GetMinimumNumberOfIterationsSPSA());
239 OptimizerPointer->SetNumberOfPerturbations(m_OptimizerParameters->GetNumberOfPerturbationsSPSA());
240 OptimizerPointer->SetMaximumNumberOfIterations(m_OptimizerParameters->GetNumberOfIterationsSPSA());
241 return OptimizerPointer.GetPointer();
itk::SmartPointer< Self > Pointer
OptimizerType::Pointer GetOptimizer()
Returns the optimizer which then can be used in combination with a transform, a metric and an interpo...
DataCollection - Class to facilitate loading/accessing structured data.
void SetNumberOfTransformParameters(int numberTransformParameters)
Sets the number of transformParameters.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.