ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMultipleValuedNonLinearVnlOptimizer.h
Go to the documentation of this file.
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 __itkMultipleValuedNonLinearVnlOptimizer_h
00019 #define __itkMultipleValuedNonLinearVnlOptimizer_h
00020 
00021 #include "itkMultipleValuedNonLinearOptimizer.h"
00022 #include "itkMultipleValuedVnlCostFunctionAdaptor.h"
00023 #include "itkCommand.h"
00024 
00025 namespace itk
00026 {
00036 class ITK_EXPORT MultipleValuedNonLinearVnlOptimizer:
00037   public MultipleValuedNonLinearOptimizer
00038 {
00039 public:
00041   typedef MultipleValuedNonLinearVnlOptimizer Self;
00042   typedef MultipleValuedNonLinearOptimizer    Superclass;
00043   typedef SmartPointer< Self >                Pointer;
00044   typedef SmartPointer< const Self >          ConstPointer;
00045 
00047   itkTypeMacro(MultipleValuedNonLinearVnlOptimizer,
00048                MultipleValueNonLinearOptimizer);
00049 
00052   typedef Superclass::ParametersType ParametersType;
00053 
00060   virtual void SetCostFunction(MultipleValuedCostFunction *costFunction) = 0;
00061 
00065   void SetUseCostFunctionGradient(bool);
00066 
00067   void UseCostFunctionGradientOn()
00068   {
00069     this->SetUseCostFunctionGradient(true);
00070   }
00071 
00072   void UseCostFunctionGradientOff()
00073   {
00074     this->SetUseCostFunctionGradient(false);
00075   }
00076 
00077   bool GetUseCostFunctionGradient() const;
00078 
00085   itkGetConstReferenceMacro(CachedValue, MeasureType);
00086   itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
00087   itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
00088 protected:
00089   MultipleValuedNonLinearVnlOptimizer();
00090   virtual ~MultipleValuedNonLinearVnlOptimizer();
00092 
00093   void PrintSelf(std::ostream & os, Indent indent) const;
00094 
00095   typedef MultipleValuedVnlCostFunctionAdaptor CostFunctionAdaptorType;
00096 
00097   void SetCostFunctionAdaptor(CostFunctionAdaptorType *adaptor);
00098 
00099   const CostFunctionAdaptorType * GetCostFunctionAdaptor(void) const;
00100 
00101   CostFunctionAdaptorType * GetCostFunctionAdaptor(void);
00102 
00105   CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor(void) const;
00106 
00111   typedef ReceptorMemberCommand< Self > CommandType;
00112 private:
00113   MultipleValuedNonLinearVnlOptimizer(const Self &); //purposely not implemented
00114   void operator=(const Self &);                      //purposely not implemented
00116 
00118   void IterationReport(const EventObject & event);
00119 
00120   CostFunctionAdaptorType *m_CostFunctionAdaptor;
00121   bool                     m_UseGradient;
00122 
00123   CommandType::Pointer m_Command;
00124 
00125   mutable ParametersType m_CachedCurrentPosition;
00126   mutable MeasureType    m_CachedValue;
00127   mutable DerivativeType m_CachedDerivative;
00128 };
00129 } // end namespace itk
00130 
00131 #endif
00132