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 ITK_EXPORT DenseFiniteDifferenceImageFilter
00067 : public FiniteDifferenceImageFilter<TInputImage, TOutputImage>
00068 {
00069 public:
00071 typedef DenseFiniteDifferenceImageFilter Self;
00072 typedef FiniteDifferenceImageFilter<TInputImage, TOutputImage> Superclass;
00073 typedef SmartPointer<Self> Pointer;
00074 typedef SmartPointer<const Self> ConstPointer;
00075
00077 itkTypeMacro(DenseFiniteDifferenceImageFilter, ImageToImageFilter );
00078
00080 typedef typename Superclass::InputImageType InputImageType;
00081 typedef typename Superclass::OutputImageType OutputImageType;
00082 typedef typename Superclass::FiniteDifferenceFunctionType
00083 FiniteDifferenceFunctionType;
00084
00087 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00088
00091 typedef typename Superclass::PixelType PixelType;
00092
00094 typedef typename Superclass::TimeStepType TimeStepType;
00095
00097 typedef OutputImageType UpdateBufferType;
00098
00099 protected:
00100 DenseFiniteDifferenceImageFilter()
00101 { m_UpdateBuffer = UpdateBufferType::New(); }
00102 ~DenseFiniteDifferenceImageFilter() {}
00103 void PrintSelf(std::ostream& os, Indent indent) const;
00104
00108 virtual void CopyInputToOutput();
00109
00113 virtual void ApplyUpdate(TimeStepType dt);
00114
00117 virtual UpdateBufferType* GetUpdateBuffer()
00118 { return m_UpdateBuffer; }
00119
00120 private:
00121 DenseFiniteDifferenceImageFilter(const Self&);
00122 void operator=(const Self&);
00123
00126 struct DenseFDThreadStruct
00127 {
00128 DenseFiniteDifferenceImageFilter *Filter;
00129 TimeStepType TimeStep;
00130 TimeStepType *TimeStepList;
00131 bool *ValidTimeStepList;
00132 };
00133
00135 typedef typename UpdateBufferType::RegionType ThreadRegionType;
00136
00139 virtual void AllocateUpdateBuffer();
00140
00143 static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback( void *arg );
00144
00148 virtual TimeStepType CalculateChange();
00149
00152 static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback( void *arg );
00153
00160
00161
00162
00167 virtual
00168 void ThreadedApplyUpdate(TimeStepType dt,
00169 const ThreadRegionType ®ionToProcess,
00170 int threadId);
00171
00172
00177 virtual
00178 TimeStepType ThreadedCalculateChange(const ThreadRegionType ®ionToProcess,
00179 int threadId);
00180
00181
00183 typename UpdateBufferType::Pointer m_UpdateBuffer;
00184 };
00185
00186
00187 }
00188
00189 #ifndef ITK_MANUAL_INSTANTIATION
00190 #include "itkDenseFiniteDifferenceImageFilter.txx"
00191 #endif
00192
00193 #endif