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

itkGaussianDerivativeOperator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGaussianDerivativeOperator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-28 18:14:36 $
00007   Version:   $Revision: 1.4 $
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 
00018 #ifndef __itkGaussianDerivativeOperator_h
00019 #define __itkGaussianDerivativeOperator_h
00020 
00021 #include "itkNeighborhoodOperator.h"
00022 #include "itkGaussianOperator.h"
00023 #include "itkDerivativeOperator.h"
00024 #include <math.h>
00025 
00026 namespace itk {
00027 
00072 template<class TPixel,unsigned int VDimension=2,
00073   class TAllocator = NeighborhoodAllocator<TPixel> >
00074 class ITK_EXPORT GaussianDerivativeOperator
00075   : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
00076 {
00077 public:
00078 
00080   typedef GaussianDerivativeOperator                            Self;
00081   typedef NeighborhoodOperator<TPixel, VDimension, TAllocator>  Superclass;
00082 
00084   typedef GaussianOperator<TPixel, VDimension, TAllocator>      GaussianOperatorType;
00085   typedef DerivativeOperator<TPixel, VDimension, TAllocator>    DerivativeOperatorType;
00086 
00088   GaussianDerivativeOperator()
00089     {
00090     m_Order = 1;
00091     m_Variance = 1.0;
00092     m_Spacing = 1.0;
00093     m_MaximumError = 0.005;
00094     m_MaximumKernelWidth = 30;
00095     m_UseDerivativeOperator = false;
00096     m_NormalizeAcrossScale = true;
00097     }
00098 
00100   GaussianDerivativeOperator(const Self &other) :
00101     NeighborhoodOperator<TPixel, VDimension, TAllocator>(other)
00102     {
00103     m_UseDerivativeOperator = other.m_UseDerivativeOperator;
00104     m_NormalizeAcrossScale = other.m_NormalizeAcrossScale;
00105     m_Spacing = other.m_Spacing;
00106     m_Order = other.m_Order;
00107     m_Variance = other.m_Variance;
00108     m_MaximumError = other.m_MaximumError;
00109     m_MaximumKernelWidth = other.m_MaximumKernelWidth;
00110     }
00112 
00114   Self &operator=(const Self &other)
00115     {
00116     Superclass::operator=(other);
00117     m_UseDerivativeOperator = other.m_UseDerivativeOperator;
00118     m_NormalizeAcrossScale = other.m_NormalizeAcrossScale;
00119     m_Spacing = other.m_Spacing;
00120     m_Order = other.m_Order;
00121     m_Variance = other.m_Variance;
00122     m_MaximumError = other.m_MaximumError;
00123     m_MaximumKernelWidth = other.m_MaximumKernelWidth;
00124     return *this;
00125     }
00127 
00133   void SetUseDerivativeOperator( bool flag )
00134     {
00135     if( m_UseDerivativeOperator != flag )
00136       {
00137       m_UseDerivativeOperator = flag;
00138       }
00139     }
00140   bool GetUseDerivativeOperator() const { return m_UseDerivativeOperator; }
00141   itkBooleanMacro(UseDerivativeOperator);
00143 
00146   void SetNormalizeAcrossScale( bool flag )
00147     {
00148     if( m_NormalizeAcrossScale != flag )
00149       {
00150       m_NormalizeAcrossScale = flag;
00151       }
00152     }
00153   bool GetNormalizeAcrossScale() const { return m_NormalizeAcrossScale; }
00154   itkBooleanMacro(NormalizeAcrossScale);
00156 
00158   void SetVariance(const double variance) { m_Variance = variance; }
00159 
00161   void SetSpacing(const double spacing)
00162     {  
00163     m_Spacing = spacing;
00164     }
00165 
00170   void SetMaximumError( const double maxerror )
00171     {
00172     const double Min = 0.00001;
00173     const double Max = 1.0 - Min;
00174     m_MaximumError = (maxerror<Min?Min:(maxerror>Max?Max:maxerror));
00175     }
00177 
00179   double GetVariance() { return m_Variance; }
00180 
00185   double GetMaximumError() { return m_MaximumError; }
00186 
00191   void SetMaximumKernelWidth( unsigned int n )
00192     {
00193     m_MaximumKernelWidth = n;
00194     }
00195 
00197   unsigned int GetMaximumKernelWidth() const { return m_MaximumKernelWidth; }
00198 
00200   void SetOrder(const unsigned int order)
00201     {
00202     m_Order = order;
00203     }
00204 
00206   unsigned int GetOrder() const { return m_Order; }
00207 
00209   virtual void PrintSelf(std::ostream &os, Indent i) const
00210     {
00211     os << i << "GaussianDerivativeOperator { this=" << this
00212        << ", m_UseDerivativeOperator = " << m_UseDerivativeOperator
00213        << ", m_NormalizeAcrossScale = " << m_NormalizeAcrossScale
00214        << ", m_Order = " << m_Order
00215        << ", m_Spacing = " << m_Spacing
00216        << ", m_Variance = " << m_Variance
00217        << ", m_MaximumError = " << m_MaximumError
00218        << ", m_MaximumKernelWidth = " << m_MaximumKernelWidth
00219        << "} "  << std::endl;
00220     Superclass::PrintSelf(os, i.GetNextIndent());
00221     }
00223 
00224 protected:
00225 
00226   typedef typename Superclass::CoefficientVector CoefficientVector;
00227 
00229   double ModifiedBesselI0(double);
00230 
00233   double ModifiedBesselI1(double);
00234 
00237   double ModifiedBesselI(int, double);
00238 
00240   CoefficientVector GenerateCoefficients();
00241 
00243   void Fill(const CoefficientVector& coeff)
00244     { this->FillCenteredDirectional(coeff); }
00245 
00246 private:
00247 
00249   const char *GetNameOfClass()
00250     { return "itkGaussianDerivativeOperator"; }
00251 
00253   bool m_UseDerivativeOperator;
00254 
00256   bool m_NormalizeAcrossScale;
00257 
00259   double m_Variance;
00260 
00263   double m_MaximumError;
00264 
00268   unsigned int m_MaximumKernelWidth;
00269 
00271   unsigned int m_Order; 
00272 
00274   double m_Spacing;
00275 };
00276 
00277 } // namespace itk
00278 
00279 // Define instantiation macro for this template.
00280 #define ITK_TEMPLATE_GaussianDerivativeOperator(_, EXPORT, x, y) namespace itk { \
00281   _(2(class EXPORT GaussianDerivativeOperator< ITK_TEMPLATE_2 x >)) \
00282   namespace Templates { typedef GaussianDerivativeOperator< ITK_TEMPLATE_2 x > \
00283                                                   GaussianDerivativeOperator##y; } \
00284   }
00285 
00286 #if ITK_TEMPLATE_EXPLICIT
00287 # include "Templates/itkGaussianDerivativeOperator+-.h"
00288 #endif
00289 
00290 #if ITK_TEMPLATE_TXX
00291 # include "itkGaussianDerivativeOperator.txx"
00292 #endif
00293 
00294 #endif
00295 

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