00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkDenseFiniteDifferenceImageFilter_h_
00018 #define __itkDenseFiniteDifferenceImageFilter_h_
00019
00020 #include "itkFiniteDifferenceImageFilter.h"
00021 #include "itkMultiThreader.h"
00022
00023 namespace itk {
00024
00065 template <class TInputImage, class TOutputImage>
00066 class DenseFiniteDifferenceImageFilter
00067 : public FiniteDifferenceImageFilter<TInputImage, TOutputImage>
00068 {
00069 public:
00071 typedef DenseFiniteDifferenceImageFilter Self;
00072 typedef FiniteDifferenceImageFilter<TInputImage, TOutputImage> Superclass;
00073
00075 itkTypeMacro(DenseFiniteDifferenceImageFilter, ImageToImageFilter );
00076
00078 typedef typename Superclass::InputImageType InputImageType;
00079 typedef typename Superclass::OutputImageType OutputImageType;
00080 typedef typename Superclass::FiniteDifferenceFunctionType
00081 FiniteDifferenceFunctionType;
00082
00085 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00086
00089 typedef typename Superclass::PixelType PixelType;
00090
00092 typedef typename Superclass::TimeStepType TimeStepType;
00093
00095 typedef OutputImageType UpdateBufferType;
00096
00097 protected:
00098 DenseFiniteDifferenceImageFilter()
00099 { m_UpdateBuffer = UpdateBufferType::New(); }
00100 ~DenseFiniteDifferenceImageFilter() {}
00101 void PrintSelf(std::ostream& os, Indent indent) const;
00102
00103 private:
00104 DenseFiniteDifferenceImageFilter(const Self&);
00105 void operator=(const Self&);
00106
00109 struct DenseFDThreadStruct
00110 {
00111 DenseFiniteDifferenceImageFilter *Filter;
00112 TimeStepType TimeStep;
00113 TimeStepType *TimeStepList;
00114 bool *ValidTimeStepList;
00115 };
00116
00118 typedef typename UpdateBufferType::RegionType ThreadRegionType;
00119
00122 virtual void AllocateUpdateBuffer();
00123
00127 virtual void ApplyUpdate(TimeStepType dt);
00128
00131 static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback( void *arg );
00132
00136 virtual TimeStepType CalculateChange();
00137
00140 static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback( void *arg );
00141
00148
00149
00150
00155 virtual
00156 void ThreadedApplyUpdate(TimeStepType dt,
00157 const ThreadRegionType ®ionToProcess,
00158 int threadId);
00159
00160
00165 virtual
00166 TimeStepType ThreadedCalculateChange(const ThreadRegionType ®ionToProcess,
00167 int threadId);
00168
00169
00171 typename UpdateBufferType::Pointer m_UpdateBuffer;
00172 };
00173
00174
00175 }
00176
00177 #ifndef ITK_MANUAL_INSTANTIATION
00178 #include "itkDenseFiniteDifferenceImageFilter.txx"
00179 #endif
00180
00181 #endif