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

itkSparseFieldFourthOrderLevelSetImageFilter.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSparseFieldFourthOrderLevelSetImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:56 $ 00007 Version: $Revision: 1.10 $ 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 _itkSparseFieldFourthOrderLevelSetImageFilter_h_ 00018 #define _itkSparseFieldFourthOrderLevelSetImageFilter_h_ 00019 00020 #include "itkSparseImage.h" 00021 #include "itkNormalVectorDiffusionFunction.h" 00022 #include "itkImplicitManifoldNormalVectorFilter.h" 00023 #include "itkLevelSetFunctionWithRefitTerm.h" 00024 #include "itkSparseFieldLevelSetImageFilter.h" 00025 #include <math.h> 00026 00027 namespace itk { 00028 00036 template <class TImageType> 00037 class NormalBandNode 00038 { 00039 public: 00041 typedef TImageType LevelSetImageType; 00042 00044 typedef typename LevelSetImageType::PixelType NodeValueType; 00045 00047 typedef typename LevelSetImageType::IndexType IndexType; 00048 00050 typedef Vector <NodeValueType, 00051 ::itk::GetImageDimension<TImageType>::ImageDimension> 00052 NodeDataType; 00053 00055 NodeDataType m_Data; 00056 00058 NodeDataType m_InputData; 00059 00061 NodeDataType m_Update; 00062 00065 NodeDataType 00066 m_ManifoldNormal[::itk::GetImageDimension<TImageType>::ImageDimension]; 00067 00069 NodeDataType m_Flux [::itk::GetImageDimension<TImageType>::ImageDimension]; 00070 00073 NodeValueType m_Curvature; 00074 00077 bool m_CurvatureFlag; 00078 00080 IndexType m_Index; 00081 00083 NormalBandNode *Next; 00084 NormalBandNode *Previous; 00085 }; 00086 00153 template <class TInputImage, class TOutputImage> 00154 class ITK_EXPORT SparseFieldFourthOrderLevelSetImageFilter 00155 : public SparseFieldLevelSetImageFilter <TInputImage, TOutputImage> 00156 { 00157 public: 00159 typedef SparseFieldFourthOrderLevelSetImageFilter Self; 00160 typedef SparseFieldLevelSetImageFilter<TInputImage, TOutputImage> Superclass; 00161 typedef SmartPointer<Self> Pointer; 00162 typedef SmartPointer<const Self> ConstPointer; 00163 00165 itkTypeMacro(SparseFieldFourthOrderLevelSetImageFilter, 00166 SparseFieldLevelSetImageFilter); 00167 00169 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00170 00172 typedef typename Superclass::OutputImageType OutputImageType; 00173 typedef typename Superclass::ValueType ValueType; 00174 typedef typename Superclass::IndexType IndexType; 00175 typedef typename Superclass::LayerType LayerType; 00176 00179 typedef NormalBandNode <OutputImageType> NodeType; 00180 00182 typedef SparseImage <NodeType, 00183 itkGetStaticConstMacro(ImageDimension)> SparseImageType; 00184 00186 typedef typename NodeType::NodeDataType NormalVectorType; 00187 00189 typedef NeighborhoodIterator <SparseImageType> SparseImageIteratorType; 00190 00192 typedef ImplicitManifoldNormalVectorFilter <OutputImageType, SparseImageType> 00193 NormalVectorFilterType; 00194 00196 typedef NormalVectorDiffusionFunction <SparseImageType> 00197 NormalVectorFunctionType; 00198 00200 //typedef typename NormalVectorFunctionType::RadiusType RadiusType; 00201 00203 typedef LevelSetFunctionWithRefitTerm <OutputImageType, 00204 SparseImageType> LevelSetFunctionType; 00205 00206 itkGetMacro(MaxRefitIteration,unsigned int); 00207 itkSetMacro(MaxRefitIteration,unsigned int); 00208 itkGetMacro(MaxNormalIteration,unsigned int); 00209 itkSetMacro(MaxNormalIteration,unsigned int); 00210 itkGetMacro(CurvatureBandWidth,ValueType); 00211 itkSetMacro(CurvatureBandWidth,ValueType); 00212 itkGetMacro(RMSChangeNormalProcessTrigger, ValueType); 00213 itkSetMacro(RMSChangeNormalProcessTrigger, ValueType); 00214 itkGetMacro(NormalProcessType, int); 00215 itkSetMacro(NormalProcessType, int); 00216 itkGetMacro(NormalProcessConductance, ValueType); 00217 itkSetMacro(NormalProcessConductance, ValueType); 00218 itkSetMacro(NormalProcessUnsharpFlag, bool); 00219 itkGetMacro(NormalProcessUnsharpFlag, bool); 00220 itkSetMacro(NormalProcessUnsharpWeight, ValueType); 00221 itkGetMacro(NormalProcessUnsharpWeight, ValueType); 00222 00225 void SetLevelSetFunction( LevelSetFunctionType *lsf ); 00226 00230 unsigned int GetMinimumNumberOfLayers() const 00231 { 00232 return (int)ceil(m_CurvatureBandWidth+ 00233 itkGetStaticConstMacro(ImageDimension)); 00234 } 00235 00238 virtual void SetNumberOfLayers( const unsigned int n ) 00239 { 00240 unsigned int nm = vnl_math_max (this->GetMinimumNumberOfLayers (), n ); 00241 if (nm != this->GetNumberOfLayers()) 00242 { 00243 Superclass::SetNumberOfLayers (nm); 00244 this->Modified(); 00245 } 00246 } 00247 00250 virtual void InitializeIteration() 00251 { 00252 Superclass::InitializeIteration(); 00253 ValueType rmschange = this->GetRMSChange(); 00254 00255 if ( ( this->GetElapsedIterations()==0 ) || 00256 ( m_RefitIteration == m_MaxRefitIteration ) || 00257 ( rmschange <= m_RMSChangeNormalProcessTrigger ) || 00258 ( this->ActiveLayerCheckBand() ) ) 00259 { 00260 if ( ( this->GetElapsedIterations() != 0 ) && 00261 ( rmschange <= m_RMSChangeNormalProcessTrigger ) && 00262 ( m_RefitIteration <= 1) ) 00263 { 00264 m_ConvergenceFlag = true; 00265 } 00266 00267 m_RefitIteration = 0; 00268 ProcessNormals(); 00269 } 00270 00271 m_RefitIteration++; 00272 } 00273 00274 protected: 00275 SparseFieldFourthOrderLevelSetImageFilter(); 00276 ~SparseFieldFourthOrderLevelSetImageFilter() {}; 00277 virtual void PrintSelf(std::ostream& os, Indent indent) const; 00278 00279 00282 ValueType ComputeCurvatureFromSparseImageNeighborhood 00283 ( SparseImageIteratorType &neighborhood ) const; 00284 00288 void ComputeCurvatureTarget( const OutputImageType *distanceImage, 00289 SparseImageType *sparseImage ) const; 00290 00292 void ProcessNormals(); 00293 00298 bool ActiveLayerCheckBand() const; 00299 00300 private: 00303 unsigned int m_RefitIteration; 00304 00308 unsigned int m_MaxRefitIteration; 00309 00312 unsigned int m_MaxNormalIteration; 00313 00317 ValueType m_RMSChangeNormalProcessTrigger; 00318 00321 bool m_ConvergenceFlag; 00322 00325 LevelSetFunctionType *m_LevelSetFunction; 00326 00331 ValueType m_CurvatureBandWidth; 00332 00335 int m_NormalProcessType; 00336 00339 ValueType m_NormalProcessConductance; 00340 00343 bool m_NormalProcessUnsharpFlag; 00344 00347 ValueType m_NormalProcessUnsharpWeight; 00348 00350 static const unsigned long m_NumVertex; 00351 static const ValueType m_DimConst; 00352 00353 SparseFieldFourthOrderLevelSetImageFilter(const Self&); 00354 //purposely not implemented 00355 void operator=(const Self&); //purposely not implemented 00356 }; 00357 00358 } // end namespace itk 00359 00360 #ifndef ITK_MANUAL_INSTANTIATION 00361 #include "itkSparseFieldFourthOrderLevelSetImageFilter.txx" 00362 #endif 00363 00364 #endif

Generated at Sat Mar 31 02:29:37 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000