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: 2007/02/08 16:56:10 $
00007   Version:   $Revision: 1.23 $
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 
00136   virtual TimeStepType CalculateChange();
00137 
00140   virtual void AllocateUpdateBuffer();
00141 
00143   typedef typename UpdateBufferType::RegionType ThreadRegionType;
00144 
00149   virtual
00150   void ThreadedApplyUpdate(TimeStepType dt,
00151                            const ThreadRegionType &regionToProcess,
00152                            int threadId);
00153 
00158   virtual
00159   TimeStepType ThreadedCalculateChange(const ThreadRegionType &regionToProcess,
00160                                        int threadId);
00161 
00162 private:
00163   DenseFiniteDifferenceImageFilter(const Self&); //purposely not implemented
00164   void operator=(const Self&); //purposely not implemented
00165 
00168   struct DenseFDThreadStruct
00169   {
00170     DenseFiniteDifferenceImageFilter *Filter;
00171     TimeStepType TimeStep;
00172     TimeStepType *TimeStepList;
00173     bool *ValidTimeStepList;
00174   };
00175 
00178   static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback( void *arg );
00179 
00182   static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback( void *arg );
00183 
00185   typename UpdateBufferType::Pointer m_UpdateBuffer;
00186 };
00187 
00188 
00189 }// end namespace itk
00190 
00191 // Define instantiation macro for this template.
00192 #define ITK_TEMPLATE_DenseFiniteDifferenceImageFilter(_, EXPORT, x, y) namespace itk { \
00193   _(2(class EXPORT DenseFiniteDifferenceImageFilter< ITK_TEMPLATE_2 x >)) \
00194   namespace Templates { typedef DenseFiniteDifferenceImageFilter< ITK_TEMPLATE_2 x > \
00195                                             DenseFiniteDifferenceImageFilter##y; } \
00196   }
00197 
00198 #if ITK_TEMPLATE_EXPLICIT
00199 # include "Templates/itkDenseFiniteDifferenceImageFilter+-.h"
00200 #endif
00201 
00202 #if ITK_TEMPLATE_TXX
00203 # include "itkDenseFiniteDifferenceImageFilter.txx"
00204 #endif
00205 
00206 #endif
00207 

Generated at Tue Jul 29 19:47:26 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000