ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkCumulativeGaussianOptimizer_h 00019 #define __itkCumulativeGaussianOptimizer_h 00020 00021 #include "itkMultipleValuedNonLinearOptimizer.h" 00022 #include "itkCumulativeGaussianCostFunction.h" 00023 00024 namespace itk 00025 { 00047 class ITK_EXPORT CumulativeGaussianOptimizer: 00048 public MultipleValuedNonLinearOptimizer 00049 { 00050 public: 00051 00053 typedef CumulativeGaussianOptimizer Self; 00054 typedef MultipleValuedNonLinearOptimizer Superclass; 00055 typedef SmartPointer< Self > Pointer; 00056 typedef SmartPointer< const Self > ConstPointer; 00057 00060 typedef CumulativeGaussianCostFunction CostFunctionType; 00061 00063 typedef CostFunctionType::MeasureType MeasureType; 00064 00066 itkNewMacro(Self); 00067 00069 itkTypeMacro(CumulativeGaussianOptimizer, MultipleValuedNonLinearOptimizer); 00070 00072 itkSetMacro(DifferenceTolerance, double); 00073 itkSetMacro(Verbose, bool); 00074 itkGetMacro(ComputedMean, double); 00075 itkGetMacro(ComputedStandardDeviation, double); 00076 itkGetMacro(UpperAsymptote, double); 00077 itkGetMacro(LowerAsymptote, double); 00078 itkGetMacro(FinalSampledArray, MeasureType *); 00079 itkGetMacro(FitError, double); 00081 00082 void SetDataArray(MeasureType *dataArray); 00083 00085 void StartOptimization(); 00086 00088 void PrintArray(MeasureType *array); 00089 00091 const std::string GetStopConditionDescription() const; 00092 00093 protected: 00094 CumulativeGaussianOptimizer(); 00095 virtual ~CumulativeGaussianOptimizer(); 00096 void PrintSelf(std::ostream & os, Indent indent) const; 00097 00098 private: 00099 00101 double m_DifferenceTolerance; 00102 00104 double m_ComputedMean; 00105 00107 double m_ComputedStandardDeviation; 00108 00110 double m_ComputedAmplitude; 00111 00114 double m_ComputedTransitionHeight; 00115 00117 double m_UpperAsymptote; 00118 00120 double m_LowerAsymptote; 00121 00123 double m_OffsetForMean; 00124 00126 bool m_Verbose; 00127 00129 double m_FitError; 00130 00133 MeasureType *m_FinalSampledArray; 00134 00136 MeasureType *m_CumulativeGaussianArray; 00137 00139 MeasureType * ExtendGaussian(MeasureType *originalArray, MeasureType *extendedArray, int startingPointForInsertion); 00140 00142 MeasureType * RecalculateExtendedArrayFromGaussianParameters(MeasureType *originalArray, 00143 MeasureType *extendedArray, 00144 int startingPointForInsertion); 00145 00148 double FindAverageSumOfSquaredDifferences(MeasureType *array1, MeasureType *array2); 00149 00151 void FindParametersOfGaussian(MeasureType *sampledGaussianArray); 00152 00154 void MeasureGaussianParameters(MeasureType *array); 00155 00157 void PrintComputedParameterHeader(); 00158 00160 void PrintComputedParameters(); 00161 00163 double VerticalBestShift(MeasureType *originalArray, MeasureType *newArray); 00164 00166 std::ostringstream m_StopConditionDescription; 00167 }; 00168 } // end namespace itk 00169 00170 #endif 00171