Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkFiniteDifferenceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFiniteDifferenceImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/11/26 12:23:12 $
00007   Version:   $Revision: 1.25 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkFiniteDifferenceImageFilter_h_
00018 #define __itkFiniteDifferenceImageFilter_h_
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkFiniteDifferenceFunction.h"
00022 
00023 namespace itk {
00024 
00121 template <class TInputImage, class TOutputImage>
00122 class ITK_EXPORT FiniteDifferenceImageFilter  
00123   : public ImageToImageFilter<TInputImage, TOutputImage>
00124 {
00125 public:
00127   typedef FiniteDifferenceImageFilter Self;
00128   typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00129   typedef SmartPointer<Self>  Pointer;
00130   typedef SmartPointer<const Self>  ConstPointer;
00131   
00133   itkTypeMacro(FiniteDifferenceImageFilter, ImageToImageFilter );
00134   
00136   typedef TInputImage  InputImageType;
00137   typedef TOutputImage OutputImageType;
00138   
00140   itkStaticConstMacro(ImageDimension, unsigned int,
00141                       OutputImageType::ImageDimension);
00142 
00144   typedef typename TOutputImage::PixelType PixelType;
00145 
00149   typedef FiniteDifferenceFunction<TOutputImage> FiniteDifferenceFunctionType;
00150   typedef typename FiniteDifferenceFunctionType::TimeStepType TimeStepType;
00151 
00152   typedef enum { UNINITIALIZED = 0, INITIALIZED = 1 } FilterStateType;
00153   
00155   itkGetConstMacro(ElapsedIterations, unsigned int);
00156 
00160   itkGetConstReferenceObjectMacro(DifferenceFunction,
00161                                   FiniteDifferenceFunctionType );
00162 
00166   itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType );
00167 
00168 
00170   itkSetMacro(NumberOfIterations, unsigned int);
00171   itkGetMacro(NumberOfIterations, unsigned int);
00172 
00175   itkSetMacro(MaximumRMSError, double);
00176   itkGetMacro(MaximumRMSError, double);
00177 
00180   itkSetMacro(RMSChange, double);
00181   itkGetMacro(RMSChange, double);
00182 
00184   void SetStateToInitialized()
00185   {
00186     this->SetState(INITIALIZED);
00187   }
00188 
00190   void SetStateToUninitialized()
00191   {
00192     this->SetState(UNINITIALIZED);
00193   }
00194   
00196   itkSetMacro(State, FilterStateType);
00197   itkGetMacro(State, FilterStateType);
00198 
00201   itkSetMacro(ManualReinitialization, bool);
00202   itkGetMacro(ManualReinitialization, bool);
00203   itkBooleanMacro(ManualReinitialization);
00204   
00205 protected:
00206   FiniteDifferenceImageFilter()
00207   {
00208     m_ElapsedIterations  = 0;
00209     m_DifferenceFunction = 0;
00210     m_NumberOfIterations = NumericTraits<unsigned int>::max();
00211     m_MaximumRMSError = 0.0;
00212     m_RMSChange = 0.0;
00213     m_State = UNINITIALIZED;
00214     m_ManualReinitialization = false;
00215   }
00216   ~FiniteDifferenceImageFilter() {}
00217   void PrintSelf(std::ostream& os, Indent indent) const;
00218 
00220   virtual void AllocateUpdateBuffer() = 0;
00221 
00225   virtual void ApplyUpdate(TimeStepType dt) = 0;
00226   
00232   virtual TimeStepType CalculateChange() = 0;
00233 
00237   virtual void CopyInputToOutput() = 0;
00238   
00242   virtual void GenerateData();
00243 
00255   virtual void GenerateInputRequestedRegion();
00256   
00259   virtual bool Halt();
00260 
00270   virtual bool ThreadedHalt(void *itkNotUsed(threadInfo)) { return this->Halt(); }
00271 
00277   virtual void Initialize() { };
00278 
00285   virtual void InitializeIteration()
00286     { m_DifferenceFunction->InitializeIteration(); }
00287   
00301   virtual TimeStepType ResolveTimeStep(const TimeStepType* timeStepList, 
00302                                        const bool* valid,int size);
00303 
00305   itkSetMacro(ElapsedIterations, unsigned int);
00306 
00309   virtual void PostProcessOutput() {}
00310 
00312   unsigned int  m_NumberOfIterations;
00313 
00314   double m_RMSChange;  
00315   double m_MaximumRMSError;
00316 
00317 private:
00318   FiniteDifferenceImageFilter(const Self&); //purposely not implemented
00319   void operator=(const Self&); //purposely not implemented
00320 
00323   unsigned int m_ElapsedIterations;
00324 
00327   bool m_ManualReinitialization;
00328   
00330   typename FiniteDifferenceFunctionType::Pointer m_DifferenceFunction;
00331 
00333   FilterStateType m_State;
00334 };
00335   
00336 }// end namespace itk
00337 
00338 #ifndef ITK_MANUAL_INSTANTIATION
00339 #include "itkFiniteDifferenceImageFilter.txx"
00340 #endif
00341 
00342 #endif
00343 

Generated at Sun Jan 25 13:19:34 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000