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

itkFiniteDifferenceSparseImageFilter.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFiniteDifferenceSparseImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:07 $ 00007 Version: $Revision: 1.5 $ 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 __itkFiniteDifferenceSparseImageFilter_h_ 00018 #define __itkFiniteDifferenceSparseImageFilter_h_ 00019 00020 #include "itkFiniteDifferenceSparseImageFunction.h" 00021 #include "itkFiniteDifferenceImageFilter.h" 00022 #include "itkMultiThreader.h" 00023 #include "itkSparseImage.h" 00024 00025 namespace itk { 00026 00060 template <class TInputImageType, class TSparseOutputImageType> 00061 class FiniteDifferenceSparseImageFilter 00062 : public FiniteDifferenceImageFilter <TInputImageType, 00063 TSparseOutputImageType> 00064 { 00065 public: 00067 typedef FiniteDifferenceSparseImageFilter Self; 00068 typedef FiniteDifferenceImageFilter<TInputImageType, 00069 TSparseOutputImageType> Superclass; 00070 typedef SmartPointer<Self> Pointer; 00071 typedef SmartPointer<const Self> ConstPointer; 00072 00074 itkTypeMacro(FiniteDifferenceSparseImageFilter, FiniteDifferenceImageFilter); 00075 00077 typedef typename Superclass::InputImageType InputImageType; 00078 typedef typename Superclass::OutputImageType SparseOutputImageType; 00079 typedef typename Superclass::PixelType PixelType; 00080 typedef typename Superclass::TimeStepType TimeStepType; 00081 typedef typename Superclass::FiniteDifferenceFunctionType 00082 FiniteDifferenceFunctionType; 00083 // the PixelType is from output image; therefore, it is a pointer 00084 00087 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00088 00090 typedef typename SparseOutputImageType::IndexType IndexType; 00091 typedef typename SparseOutputImageType::NodeType OutputNodeType; 00092 typedef typename SparseOutputImageType::NodeListType NodeListType; 00093 00095 typedef typename OutputNodeType::NodeDataType NodeDataType; 00096 00100 typedef typename OutputNodeType::NodeValueType NodeValueType; 00101 00103 typedef FiniteDifferenceSparseImageFunction <SparseOutputImageType> 00104 SparseFunctionType; 00105 00107 void SetSparseFunction( SparseFunctionType *sf ); 00108 00109 itkSetMacro(PrecomputeFlag, bool); 00110 itkGetMacro(PrecomputeFlag, bool); 00111 00112 protected: 00113 FiniteDifferenceSparseImageFilter(); 00114 ~FiniteDifferenceSparseImageFilter() {} 00115 void PrintSelf(std::ostream& os, Indent indent) const; 00116 00120 virtual void Initialize(); 00121 00124 virtual void AllocateUpdateBuffer() {}; 00125 00128 virtual NodeDataType DataConstraint( const NodeDataType &data ) const 00129 { return data; } 00130 00131 private: 00133 struct ThreadRegionType 00134 { 00135 // this is the first element 00136 typename NodeListType::Iterator first; 00137 // this is one past the last element 00138 typename NodeListType::Iterator last; 00139 }; 00140 00141 protected: 00143 int GetSplitRegion( int i, int num, ThreadRegionType &splitRegion ); 00144 00147 virtual void ApplyUpdate( TimeStepType dt ); 00148 00150 static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback( void *arg ); 00151 virtual void ThreadedApplyUpdate(TimeStepType dt, 00152 const ThreadRegionType &regionToProcess, 00153 int threadId); 00154 00157 virtual TimeStepType CalculateChange(); 00158 00160 static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback( void *arg ); 00161 virtual TimeStepType ThreadedCalculateChange 00162 (const ThreadRegionType &regionToProcess, int threadId); 00163 00167 virtual void PrecalculateChange(); 00168 00170 static ITK_THREAD_RETURN_TYPE PrecalculateChangeThreaderCallback( void *arg ); 00171 virtual void ThreadedPrecalculateChange 00172 (const ThreadRegionType &regionToProcess, int threadId); 00173 00176 struct FDThreadStruct 00177 { 00178 FiniteDifferenceSparseImageFilter *Filter; 00179 TimeStepType TimeStep; 00180 TimeStepType *TimeStepList; 00181 bool *ValidTimeStepList; 00182 }; 00183 00184 private: 00186 bool m_PrecomputeFlag; 00187 00189 SparseFunctionType *m_SparseFunction; 00190 00193 typename NodeListType::RegionListType m_RegionList; 00194 00195 FiniteDifferenceSparseImageFilter(const Self&); //purposely not implemented 00196 void operator=(const Self&); //purposely not implemented 00197 }; 00198 00199 } // end namespace itk 00200 00201 #ifndef ITK_MANUAL_INSTANTIATION 00202 #include "itkFiniteDifferenceSparseImageFilter.txx" 00203 #endif 00204 00205 #endif

Generated at Sun Apr 1 02:28:31 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000