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: 2004/11/04 20:40:40 $
00007   Version:   $Revision: 1.31 $
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 "itkInPlaceImageFilter.h"
00021 #include "itkFiniteDifferenceFunction.h"
00022 
00023 namespace itk {
00024 
00121 template <class TInputImage, class TOutputImage>
00122 class ITK_EXPORT FiniteDifferenceImageFilter  
00123   : public InPlaceImageFilter<TInputImage, TOutputImage>
00124 {
00125 public:
00127   typedef FiniteDifferenceImageFilter Self;
00128   typedef InPlaceImageFilter<TInputImage, TOutputImage> Superclass;
00129   typedef SmartPointer<Self>  Pointer;
00130   typedef SmartPointer<const Self>  ConstPointer;
00131   
00133   itkTypeMacro(FiniteDifferenceImageFilter, InPlaceImageFilter );
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   itkGetConstReferenceMacro(ElapsedIterations, unsigned int);
00156 
00160   itkGetConstReferenceObjectMacro(DifferenceFunction,
00161                                   FiniteDifferenceFunctionType );
00162 
00166   itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType );
00167 
00168 
00170   itkSetMacro(NumberOfIterations, unsigned int);
00171   itkGetConstReferenceMacro(NumberOfIterations, unsigned int);
00172 
00175   itkSetMacro(UseImageSpacing,bool);
00176   itkBooleanMacro(UseImageSpacing);
00177   itkGetConstReferenceMacro(UseImageSpacing, bool);
00178 
00181   itkSetMacro(MaximumRMSError, double);
00182   itkGetConstReferenceMacro(MaximumRMSError, double);
00183 
00186   itkSetMacro(RMSChange, double);
00187   itkGetConstReferenceMacro(RMSChange, double);
00188 
00190   void SetStateToInitialized()
00191   {
00192     this->SetState(INITIALIZED);
00193   }
00194 
00196   void SetStateToUninitialized()
00197   {
00198     this->SetState(UNINITIALIZED);
00199   }
00200   
00202   itkSetMacro(State, FilterStateType);
00203   itkGetConstReferenceMacro(State, FilterStateType);
00204 
00207   itkSetMacro(ManualReinitialization, bool);
00208   itkGetConstReferenceMacro(ManualReinitialization, bool);
00209   itkBooleanMacro(ManualReinitialization);
00210   
00211 protected:
00212   FiniteDifferenceImageFilter()
00213   {
00214     m_UseImageSpacing    = false;
00215     m_ElapsedIterations  = 0;
00216     m_DifferenceFunction = 0;
00217     m_NumberOfIterations = NumericTraits<unsigned int>::max();
00218     m_MaximumRMSError = 0.0;
00219     m_RMSChange = 0.0;
00220     m_State = UNINITIALIZED;
00221     m_ManualReinitialization = false;
00222     this->InPlaceOff();
00223   }
00224   ~FiniteDifferenceImageFilter() {}
00225   void PrintSelf(std::ostream& os, Indent indent) const;
00226 
00228   virtual void AllocateUpdateBuffer() = 0;
00229 
00233   virtual void ApplyUpdate(TimeStepType dt) = 0;
00234   
00240   virtual TimeStepType CalculateChange() = 0;
00241 
00245   virtual void CopyInputToOutput() = 0;
00246   
00250   virtual void GenerateData();
00251 
00263   virtual void GenerateInputRequestedRegion();
00264   
00267   virtual bool Halt();
00268 
00278   virtual bool ThreadedHalt(void *itkNotUsed(threadInfo)) { return this->Halt(); }
00279 
00285   virtual void Initialize() { };
00286 
00293   virtual void InitializeIteration()
00294     { m_DifferenceFunction->InitializeIteration(); }
00295   
00309   virtual TimeStepType ResolveTimeStep(const TimeStepType* timeStepList, 
00310                                        const bool* valid,int size);
00311 
00313   itkSetMacro(ElapsedIterations, unsigned int);
00314 
00317   virtual void PostProcessOutput() {}
00318 
00320   unsigned int  m_NumberOfIterations;
00321 
00322   double m_RMSChange;  
00323   double m_MaximumRMSError;
00324 
00325 private:
00326   FiniteDifferenceImageFilter(const Self&); //purposely not implemented
00327   void operator=(const Self&); //purposely not implemented
00328 
00331   unsigned int m_ElapsedIterations;
00332 
00335   bool m_UseImageSpacing;
00336 
00339   bool m_ManualReinitialization;
00340   
00342   typename FiniteDifferenceFunctionType::Pointer m_DifferenceFunction;
00343 
00345   FilterStateType m_State;
00346 };
00347   
00348 }// end namespace itk
00349 
00350 #ifndef ITK_MANUAL_INSTANTIATION
00351 #include "itkFiniteDifferenceImageFilter.txx"
00352 #endif
00353 
00354 #endif
00355 

Generated at Wed May 24 23:08:05 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000