ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkWindowConvergenceMonitoringFunction.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 __itkWindowConvergenceMonitoringFunction_h
00019 #define __itkWindowConvergenceMonitoringFunction_h
00020 
00021 #include "itkConvergenceMonitoringFunction.h"
00022 
00023 namespace itk
00024 {
00025 namespace Function
00026 {
00038 template<class TScalar = double>
00039 class WindowConvergenceMonitoringFunction
00040 : public ConvergenceMonitoringFunction<TScalar, TScalar>
00041 {
00042 public:
00043 
00044   typedef WindowConvergenceMonitoringFunction                     Self;
00045   typedef ConvergenceMonitoringFunction<TScalar, TScalar>         Superclass;
00046   typedef SmartPointer<Self>                                      Pointer;
00047   typedef SmartPointer<const Self>                                ConstPointer;
00048 
00050   itkNewMacro( Self );
00051 
00053   itkTypeMacro( WindowConvergenceMonitoringFunction, ConvergenceMonitoringFunction );
00054 
00055   typedef TScalar                                            ScalarType;
00056   typedef typename NumericTraits<ScalarType>::RealType       RealType;
00057 
00058   typedef typename Superclass::EnergyValueType               EnergyValueType;
00059   typedef typename Superclass::EnergyValueContainerType      EnergyValueContainerType;
00060   typedef typename Superclass::EnergyValueContainerSizeType  EnergyValueContainerSizeType;
00061   typedef typename EnergyValueContainerType::iterator        EnergyValueIterator;
00062   typedef typename EnergyValueContainerType::const_iterator  EnergyValueConstIterator;
00063 
00065   virtual void AddEnergyValue( const EnergyValueType );
00066 
00067   /* Clear energy values and set total energy to 0 */
00068   virtual void ClearEnergyValues();
00069 
00071   itkSetMacro( WindowSize, EnergyValueContainerSizeType );
00072   itkGetConstMacro( WindowSize, EnergyValueContainerSizeType );
00074 
00076   virtual RealType GetConvergenceValue() const;
00077 
00078 protected:
00079   WindowConvergenceMonitoringFunction();
00080 
00081   ~WindowConvergenceMonitoringFunction();
00082 
00083   void PrintSelf( std::ostream & os, Indent indent ) const;
00084 
00085 private:
00086   WindowConvergenceMonitoringFunction( const Self & ); //purposely not implemented
00087   void operator=( const Self & );  //purposely not implemented
00088 
00089   EnergyValueContainerSizeType                   m_WindowSize;
00090 
00091   RealType                                       m_TotalEnergy;
00092 
00093 };
00094 } // end namespace function
00095 } // end namespace itk
00096 
00097 #ifndef ITK_MANUAL_INSTANTIATION
00098 #include "itkWindowConvergenceMonitoringFunction.hxx"
00099 #endif
00100 
00101 #endif
00102