2 #include <itkCommand.h> 3 #include <itkEventObject.h> 14 m_CurrentIteration = 0;
16 m_CurrentParameter = 0;
17 m_CurrentIndex.Fill(0);
19 m_NumberOfSteps.Fill(0);
21 m_Geometry.set_size(3,3);
23 m_Geometry.fill_diagonal(1);
25 m_StopConditionDescription.str(
"");
32 return this->GetMaximumMetricValue();
34 return this->GetMinimumMetricValue();
62 this->InvokeEvent( itk::StartEvent() );
63 m_StopConditionDescription.str(
"");
64 m_StopConditionDescription << this->
GetNameOfClass() <<
": Running";
66 ParametersType initialPos = this->GetInitialPosition();
70 MeasureType initialValue = this->GetValue( this->GetInitialPosition() );
77 const unsigned int spaceDimension = this->GetInitialPosition().GetSize();
79 for (
unsigned int i=0; i< spaceDimension; i++)
85 ScalesType scales = this->GetScales();
88 if (scales.size() != spaceDimension)
90 itkExceptionMacro(<<
"The size of Scales is " 92 <<
", but the NumberOfParameters is " 99 itkExceptionMacro(<<
"The size of the geometry matrix is " 101 <<
", but the NumberOfParameters is " 107 ParametersType position( spaceDimension );
108 for(
unsigned int i=0; i<spaceDimension; i++)
109 position[i] = this->GetInitialPosition()[i] -
m_NumberOfSteps[i] * scales[i];
112 this->SetCurrentPosition( position );
126 const unsigned int spaceDimension = this->GetInitialPosition().GetSize();
127 ParametersType currentPosition(spaceDimension), newPosition(spaceDimension);
131 currentPosition = this->GetCurrentPosition();
159 m_StopConditionDescription.str(
"");
160 m_StopConditionDescription << this->
GetNameOfClass() <<
": Running. ";
163 this->InvokeEvent( itk::IterationEvent() );
168 this->SetCurrentPosition(newPosition);
180 this->InvokeEvent( itk::EndEvent() );
188 unsigned int idx = 0;
189 const unsigned int spaceDimension = m_CostFunction->GetNumberOfParameters();
191 while( idx < spaceDimension )
206 if( idx==spaceDimension )
209 m_StopConditionDescription.str(
"");
211 m_StopConditionDescription <<
"Completed sampling of parametric space of size " << spaceDimension;
214 for(
unsigned int i=0; i<spaceDimension; i++)
223 return m_StopConditionDescription.str();
230 Superclass::PrintSelf(os,indent);
235 os << indent <<
"Stop = " <<
m_Stop << std::endl;
238 os << indent <<
"Geometry = " <<
m_Geometry << std::endl;
StepsType m_NumberOfSteps
MeasureType m_CurrentValue
virtual void StartOptimization() ITK_OVERRIDE
ParametersType m_MaximumMetricValuePosition
void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE
MeasureType m_MaximumMetricValue
virtual const ParametersType & GetCurrentIndex() const
virtual const ParametersType & GetMaximumMetricValuePosition() const
ParametersType m_MinimumMetricValuePosition
void IncrementIndex(ParametersType &newPosition)
ParametersType m_CurrentIndex
unsigned long m_CurrentIteration
virtual const ParametersType & GetMinimumMetricValuePosition() const
virtual const MeasureType & GetMinimumMetricValue() const
unsigned int m_CurrentParameter
unsigned long m_MaximumNumberOfIterations
virtual const char * GetNameOfClass() const
MeasureType m_MinimumMetricValue
const MeasureType & GetCurrentCost() const
const std::string GetStopConditionDescription() const ITK_OVERRIDE
virtual const MeasureType & GetCurrentValue() const
virtual const MeasureType & GetMaximumMetricValue() const
VoxelExhaustiveOptimizer()