Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkDenseFiniteDifferenceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDenseFiniteDifferenceImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/04/23 04:16:05 $
00007   Version:   $Revision: 1.19 $
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 __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:
00070 
00072   typedef DenseFiniteDifferenceImageFilter Self;
00073   typedef FiniteDifferenceImageFilter<TInputImage, TOutputImage> Superclass;
00074   typedef SmartPointer<Self>  Pointer;
00075   typedef SmartPointer<const Self>  ConstPointer;
00076 
00078   itkTypeMacro(DenseFiniteDifferenceImageFilter, ImageToImageFilter );
00079 
00081   typedef typename Superclass::InputImageType  InputImageType;
00082   typedef typename Superclass::OutputImageType OutputImageType;
00083   typedef typename Superclass::FiniteDifferenceFunctionType
00084    FiniteDifferenceFunctionType;
00085 
00088   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00089 
00092   typedef typename Superclass::PixelType PixelType;
00093 
00095   typedef typename Superclass::TimeStepType TimeStepType;
00096 
00098   typedef OutputImageType UpdateBufferType;
00099 
00100 #ifdef ITK_USE_CONCEPT_CHECKING
00101 
00102   itkConceptMacro(OutputTimesDoubleCheck,
00103     (Concept::MultiplyOperator<PixelType, double>));
00104   itkConceptMacro(OutputAdditiveOperatorsCheck,
00105     (Concept::AdditiveOperators<PixelType>));
00106   itkConceptMacro(InputConvertibleToOutputCheck,
00107     (Concept::Convertible<typename TInputImage::PixelType, PixelType>));
00108 
00110 #endif
00111 
00112 protected:
00113   DenseFiniteDifferenceImageFilter()
00114     { m_UpdateBuffer = UpdateBufferType::New(); }
00115   ~DenseFiniteDifferenceImageFilter() {}
00116   void PrintSelf(std::ostream& os, Indent indent) const;
00117 
00121   virtual void CopyInputToOutput();
00122 
00126   virtual void ApplyUpdate(TimeStepType dt);
00127 
00130   virtual UpdateBufferType* GetUpdateBuffer()
00131     { return m_UpdateBuffer; }
00132 
00133 private:
00134   DenseFiniteDifferenceImageFilter(const Self&); //purposely not implemented
00135   void operator=(const Self&); //purposely not implemented
00136 
00139   struct DenseFDThreadStruct
00140   {
00141     DenseFiniteDifferenceImageFilter *Filter;
00142     TimeStepType TimeStep;
00143     TimeStepType *TimeStepList;
00144     bool *ValidTimeStepList;
00145   };
00146 
00148   typedef typename UpdateBufferType::RegionType ThreadRegionType;
00149 
00152   virtual void AllocateUpdateBuffer();
00153 
00156   static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback( void *arg );
00157 
00161   virtual TimeStepType CalculateChange();
00162 
00165   static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback( void *arg );
00166 
00173   //  virtual
00174   //  int SplitUpdateContainer(int i, int num, ThreadRegionType& splitRegion);
00175 
00180   virtual
00181   void ThreadedApplyUpdate(TimeStepType dt,
00182                            const ThreadRegionType &regionToProcess,
00183                            int threadId);
00184   // FOR ALL: iterator(output, splitRegion), iterator(update, splitRegion)
00185 
00190   virtual
00191   TimeStepType ThreadedCalculateChange(const ThreadRegionType &regionToProcess,
00192                                        int threadId);
00193   // FOR ALL : iterator(input, splitRegion), iterator(update, splitRegion)
00194 
00196   typename UpdateBufferType::Pointer m_UpdateBuffer;
00197 };
00198 
00199 
00200 }// end namespace itk
00201 
00202 #ifndef ITK_MANUAL_INSTANTIATION
00203 #include "itkDenseFiniteDifferenceImageFilter.txx"
00204 #endif
00205 
00206 #endif
00207 

Generated at Fri Sep 8 02:58:02 2006 for ITK by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2000