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: 2009-10-19 14:26:45 $
00007   Version:   $Revision: 1.42 $
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:
00126 
00128   typedef FiniteDifferenceImageFilter                     Self;
00129   typedef InPlaceImageFilter<TInputImage, TOutputImage>   Superclass;
00130   typedef SmartPointer<Self>                              Pointer;
00131   typedef SmartPointer<const Self>                        ConstPointer;
00132 
00134   itkTypeMacro(FiniteDifferenceImageFilter, InPlaceImageFilter );
00135 
00137   typedef TInputImage  InputImageType;
00138   typedef TOutputImage OutputImageType;
00139 
00141   itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
00142 
00144   typedef typename TOutputImage::PixelType    OutputPixelType;
00145   typedef typename TInputImage::PixelType     InputPixelType;
00146   typedef OutputPixelType                     PixelType;
00147 
00149   typedef typename NumericTraits< OutputPixelType >::ValueType OutputPixelValueType;
00150   typedef typename NumericTraits< InputPixelType >::ValueType  InputPixelValueType;
00151 
00155   typedef FiniteDifferenceFunction<TOutputImage> FiniteDifferenceFunctionType;
00156   typedef typename FiniteDifferenceFunctionType::TimeStepType TimeStepType;
00157 
00158   typedef typename FiniteDifferenceFunctionType::RadiusType RadiusType;
00159   typedef typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType;
00160 
00161   typedef enum { UNINITIALIZED = 0, INITIALIZED = 1 } FilterStateType;
00162   
00164   itkGetConstReferenceMacro(ElapsedIterations, unsigned int);
00165 
00169   itkGetConstReferenceObjectMacro(DifferenceFunction,
00170                                   FiniteDifferenceFunctionType );
00171 
00175   itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType );
00176 
00177 
00179   itkSetMacro(NumberOfIterations, unsigned int);
00180   itkGetConstReferenceMacro(NumberOfIterations, unsigned int);
00182 
00185   itkSetMacro(UseImageSpacing,bool);
00186   itkBooleanMacro(UseImageSpacing);
00187   itkGetConstReferenceMacro(UseImageSpacing, bool);
00189 
00192   itkSetMacro(MaximumRMSError, double);
00193   itkGetConstReferenceMacro(MaximumRMSError, double);
00195 
00198   itkSetMacro(RMSChange, double);
00199   itkGetConstReferenceMacro(RMSChange, double);
00201 
00203   void SetStateToInitialized()
00204     {
00205     this->SetState(INITIALIZED);
00206     }
00207 
00209   void SetStateToUninitialized()
00210     {
00211     this->SetState(UNINITIALIZED);
00212     }
00213 
00215 #if !defined(CABLE_CONFIGURATION)
00216   itkSetMacro(State, FilterStateType);
00217   itkGetConstReferenceMacro(State, FilterStateType);
00218 #endif
00219 
00220 
00223   itkSetMacro(ManualReinitialization, bool);
00224   itkGetConstReferenceMacro(ManualReinitialization, bool);
00225   itkBooleanMacro(ManualReinitialization);
00227 
00228 #ifdef ITK_USE_STRICT_CONCEPT_CHECKING
00229 
00230   itkConceptMacro(OutputPixelIsFloatingPointCheck,
00231     (Concept::IsFloatingPoint<OutputPixelValueType>));
00232 
00234 #endif
00235 
00236 protected:
00237   FiniteDifferenceImageFilter();
00238   ~FiniteDifferenceImageFilter();
00239   void PrintSelf(std::ostream& os, Indent indent) const;
00240 
00242   virtual void AllocateUpdateBuffer() = 0;
00243 
00247   virtual void ApplyUpdate(TimeStepType dt) = 0;
00248 
00254   virtual TimeStepType CalculateChange() = 0;
00255 
00259   virtual void CopyInputToOutput() = 0;
00260 
00264   virtual void GenerateData();
00265 
00277   virtual void GenerateInputRequestedRegion();
00278 
00281   virtual bool Halt();
00282 
00292   virtual bool ThreadedHalt(void *itkNotUsed(threadInfo)) { return this->Halt(); }
00293 
00299   virtual void Initialize() { };
00300 
00307   virtual void InitializeIteration()
00308     { m_DifferenceFunction->InitializeIteration(); }
00309 
00323   virtual TimeStepType ResolveTimeStep(const TimeStepType* timeStepList, 
00324                                        const bool* valid,int size);
00325 
00327   itkSetMacro(ElapsedIterations, unsigned int);
00328 
00331   virtual void PostProcessOutput() {}
00332 
00334   unsigned int  m_NumberOfIterations;
00335 
00338   unsigned int m_ElapsedIterations;
00339 
00342   bool m_ManualReinitialization;
00343 
00344   double m_RMSChange;  
00345   double m_MaximumRMSError;
00346 
00347 private:
00348   FiniteDifferenceImageFilter(const Self&); //purposely not implemented
00349   void operator=(const Self&); //purposely not implemented
00350 
00354   void InitializeFunctionCoefficients();
00355 
00358   bool m_UseImageSpacing;
00359 
00361   typename FiniteDifferenceFunctionType::Pointer m_DifferenceFunction;
00362 
00364   FilterStateType m_State;
00365 };
00366 
00367 }// end namespace itk
00368 
00369 // Define instantiation macro for this template.
00370 #define ITK_TEMPLATE_FiniteDifferenceImageFilter(_, EXPORT, x, y) namespace itk { \
00371   _(2(class EXPORT FiniteDifferenceImageFilter< ITK_TEMPLATE_2 x >)) \
00372   namespace Templates { typedef FiniteDifferenceImageFilter< ITK_TEMPLATE_2 x > \
00373                                             FiniteDifferenceImageFilter##y; } \
00374   }
00375 
00376 #if ITK_TEMPLATE_EXPLICIT
00377 # include "Templates/itkFiniteDifferenceImageFilter+-.h"
00378 #endif
00379 
00380 #if ITK_TEMPLATE_TXX
00381 # include "itkFiniteDifferenceImageFilter.txx"
00382 #endif
00383 
00384 #endif
00385 

Generated at Fri Apr 16 18:19:57 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000