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: 2008-10-07 09:09:39 $
00007   Version:   $Revision: 1.24 $
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<
00074     TInputImage, TOutputImage>                 Superclass;
00075   typedef SmartPointer<Self>                   Pointer;
00076   typedef SmartPointer<const Self>             ConstPointer;
00077 
00079   itkTypeMacro(DenseFiniteDifferenceImageFilter, ImageToImageFilter );
00080 
00082   typedef typename Superclass::InputImageType  InputImageType;
00083   typedef typename Superclass::OutputImageType OutputImageType;
00084   typedef typename Superclass::FiniteDifferenceFunctionType
00085    FiniteDifferenceFunctionType;
00086 
00089   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00090 
00093   typedef typename Superclass::PixelType PixelType;
00094 
00096   typedef typename Superclass::TimeStepType TimeStepType;
00097 
00099   typedef OutputImageType UpdateBufferType;
00100 
00101 #ifdef ITK_USE_CONCEPT_CHECKING
00102 
00103   itkConceptMacro(OutputTimesDoubleCheck,
00104     (Concept::MultiplyOperator<PixelType, double>));
00105   itkConceptMacro(OutputAdditiveOperatorsCheck,
00106     (Concept::AdditiveOperators<PixelType>));
00107   itkConceptMacro(InputConvertibleToOutputCheck,
00108     (Concept::Convertible<typename TInputImage::PixelType, PixelType>));
00109 
00111 #endif
00112 
00113 protected:
00114   DenseFiniteDifferenceImageFilter()
00115     { m_UpdateBuffer = UpdateBufferType::New(); }
00116   ~DenseFiniteDifferenceImageFilter() {}
00117   void PrintSelf(std::ostream& os, Indent indent) const;
00118 
00122   virtual void CopyInputToOutput();
00123 
00127   virtual void ApplyUpdate(TimeStepType dt);
00128 
00131   virtual UpdateBufferType* GetUpdateBuffer()
00132     { return m_UpdateBuffer; }
00133 
00137   virtual TimeStepType CalculateChange();
00138 
00141   virtual void AllocateUpdateBuffer();
00142 
00144   typedef typename UpdateBufferType::RegionType ThreadRegionType;
00145 
00150   virtual
00151   void ThreadedApplyUpdate(TimeStepType dt,
00152                            const ThreadRegionType &regionToProcess,
00153                            int threadId);
00154 
00159   virtual
00160   TimeStepType ThreadedCalculateChange(const ThreadRegionType &regionToProcess,
00161                                        int threadId);
00162 
00163 private:
00164   DenseFiniteDifferenceImageFilter(const Self&); //purposely not implemented
00165   void operator=(const Self&); //purposely not implemented
00166 
00169   struct DenseFDThreadStruct
00170     {
00171     DenseFiniteDifferenceImageFilter *Filter;
00172     TimeStepType TimeStep;
00173     TimeStepType *TimeStepList;
00174     bool *ValidTimeStepList;
00175     };
00176 
00179   static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback( void *arg );
00180 
00183   static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback( void *arg );
00184 
00186   typename UpdateBufferType::Pointer m_UpdateBuffer;
00187 };
00188 
00189 
00190 }// end namespace itk
00191 
00192 // Define instantiation macro for this template.
00193 #define ITK_TEMPLATE_DenseFiniteDifferenceImageFilter(_, EXPORT, x, y) namespace itk { \
00194   _(2(class EXPORT DenseFiniteDifferenceImageFilter< ITK_TEMPLATE_2 x >)) \
00195   namespace Templates { typedef DenseFiniteDifferenceImageFilter< ITK_TEMPLATE_2 x > \
00196                                             DenseFiniteDifferenceImageFilter##y; } \
00197   }
00198 
00199 #if ITK_TEMPLATE_EXPLICIT
00200 # include "Templates/itkDenseFiniteDifferenceImageFilter+-.h"
00201 #endif
00202 
00203 #if ITK_TEMPLATE_TXX
00204 # include "itkDenseFiniteDifferenceImageFilter.txx"
00205 #endif
00206 
00207 #endif
00208 

Generated at Mon Jul 12 2010 18:13:10 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000