00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 FiniteDifferenceImageFilter
00123 : public ImageToImageFilter<TInputImage, TOutputImage>
00124 {
00125 public:
00127 typedef FiniteDifferenceImageFilter Self;
00128 typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00129
00131 itkTypeMacro(FiniteDifferenceImageFilter, ImageToImageFilter );
00132
00134 typedef TInputImage InputImageType;
00135 typedef TOutputImage OutputImageType;
00136
00138 itkStaticConstMacro(ImageDimension, unsigned int,
00139 OutputImageType::ImageDimension);
00140
00142 typedef typename TOutputImage::PixelType PixelType;
00143
00147 typedef FiniteDifferenceFunction<TOutputImage> FiniteDifferenceFunctionType;
00148 typedef typename FiniteDifferenceFunctionType::TimeStepType TimeStepType;
00149
00151 itkGetConstMacro(ElapsedIterations, unsigned int);
00152
00156 itkGetConstReferenceObjectMacro(DifferenceFunction,
00157 FiniteDifferenceFunctionType );
00158
00162 itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType );
00163
00164 protected:
00165 FiniteDifferenceImageFilter() : m_ElapsedIterations(0) {}
00166 ~FiniteDifferenceImageFilter() {}
00167 void PrintSelf(std::ostream& os, Indent indent) const;
00168
00170 virtual void AllocateUpdateBuffer() = 0;
00171
00175 virtual void ApplyUpdate(TimeStepType dt) = 0;
00176
00182 virtual TimeStepType CalculateChange() = 0;
00183
00187 virtual void CopyInputToOutput();
00188
00192 virtual void GenerateData();
00193
00205 virtual void GenerateInputRequestedRegion();
00206
00209 virtual bool Halt() = 0;
00215 virtual void Initialize() { };
00216
00223 virtual void InitializeIteration()
00224 { m_DifferenceFunction->InitializeIteration(); }
00225
00239 virtual TimeStepType ResolveTimeStep(const TimeStepType* list, const bool* valid,
00240 int size);
00241
00243 itkSetMacro(ElapsedIterations, unsigned int);
00244
00247 virtual void PostProcessOutput() {}
00248
00249 private:
00250 FiniteDifferenceImageFilter(const Self&);
00251 void operator=(const Self&);
00252
00255 unsigned int m_ElapsedIterations;
00256
00258 typename FiniteDifferenceFunctionType::Pointer m_DifferenceFunction;
00259 };
00260
00261 }
00262
00263 #ifndef ITK_MANUAL_INSTANTIATION
00264 #include "itkFiniteDifferenceImageFilter.txx"
00265 #endif
00266
00267 #endif
00268