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

itkGradientMagnitudeRecursiveGaussianImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGradientMagnitudeRecursiveGaussianImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-25 12:27:23 $
00007   Version:   $Revision: 1.19 $
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 __itkGradientMagnitudeRecursiveGaussianImageFilter_h
00018 #define __itkGradientMagnitudeRecursiveGaussianImageFilter_h
00019 
00020 #include "itkNthElementImageAdaptor.h"
00021 #include "itkImage.h"
00022 #include "itkPixelTraits.h"
00023 #include "itkRecursiveGaussianImageFilter.h"
00024 #include "itkInPlaceImageFilter.h"
00025 #include "itkSqrtImageFilter.h"
00026 #include "itkBinaryFunctorImageFilter.h"
00027 
00028 namespace itk
00029 {
00030 
00042 // NOTE that the ITK_TYPENAME macro has to be used here in lieu 
00043 // of "typename" because VC++ doesn't like the typename keyword 
00044 // on the defaults of template parameters
00045 template <typename TInputImage, 
00046           typename TOutputImage= TInputImage >
00047 class ITK_EXPORT GradientMagnitudeRecursiveGaussianImageFilter:
00048     public InPlaceImageFilter<TInputImage,TOutputImage>
00049 {
00050 public:
00052   typedef GradientMagnitudeRecursiveGaussianImageFilter  Self;
00053   typedef InPlaceImageFilter<TInputImage,TOutputImage>   Superclass;
00054   typedef SmartPointer<Self>                             Pointer;
00055   typedef SmartPointer<const Self>                       ConstPointer;
00056 
00057   
00059   typedef TInputImage                                    InputImageType;
00060   typedef typename InputImageType::PixelType             PixelType;
00061 
00062 
00064   itkStaticConstMacro(ImageDimension, unsigned int,
00065                       TInputImage::ImageDimension);
00066 
00067   typedef typename NumericTraits<PixelType>::RealType      RealType;
00068 
00073   typedef float                                            InternalRealType;
00074   typedef Image<InternalRealType, 
00075                 itkGetStaticConstMacro(ImageDimension) >   RealImageType;
00076 
00078   typedef RecursiveGaussianImageFilter<
00079     RealImageType,
00080     RealImageType
00081     >    GaussianFilterType;
00082 
00084   typedef RecursiveGaussianImageFilter<
00085     InputImageType,
00086     RealImageType
00087     >    DerivativeFilterType;
00088 
00090   typedef SqrtImageFilter<
00091     RealImageType,
00092     TOutputImage
00093     >    SqrtFilterType;
00094 
00096   typedef typename GaussianFilterType::Pointer     GaussianFilterPointer;
00097 
00099   typedef typename DerivativeFilterType::Pointer   DerivativeFilterPointer;
00100 
00101   typedef typename SqrtFilterType::Pointer         SqrtFilterPointer;
00102 
00104   typedef typename TOutputImage::Pointer           OutputImagePointer;
00105 
00107   typedef TOutputImage                             OutputImageType;
00108   typedef typename OutputImageType::PixelType      OutputPixelType;
00109 
00111   typedef Image< InternalRealType, 
00112                  itkGetStaticConstMacro(ImageDimension) >      CumulativeImageType;
00113   typedef typename CumulativeImageType::Pointer                CumulativeImagePointer;
00114 
00116   itkNewMacro(Self);
00117 
00119   itkTypeMacro(GradientMagnitudeRecursiveGaussianImageFilter, 
00120                InPlaceImageFilter);
00121 
00123   void SetSigma( RealType sigma );
00124   RealType GetSigma();
00126 
00128   void SetNormalizeAcrossScale( bool normalizeInScaleSpace );
00129   itkGetConstMacro( NormalizeAcrossScale, bool );
00131 
00132   void SetNumberOfThreads( int nb );
00133 
00134 
00135 #ifdef ITK_USE_CONCEPT_CHECKING
00136 
00137   itkConceptMacro(InputHasNumericTraitsCheck,
00138                   (Concept::HasNumericTraits<PixelType>));
00139 
00141 #endif
00142 
00143 protected:
00144   GradientMagnitudeRecursiveGaussianImageFilter();
00145   virtual ~GradientMagnitudeRecursiveGaussianImageFilter() {};
00146   void PrintSelf(std::ostream& os, Indent indent) const;
00147   
00149   void GenerateData( void );
00150 
00157   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00158 
00162   void EnlargeOutputRequestedRegion(DataObject *output);
00163 
00164 private:
00165   GradientMagnitudeRecursiveGaussianImageFilter(const Self&); //purposely not implemented
00166   void operator=(const Self&); //purposely not implemented
00167   
00168   class SqrSpacing
00169     {
00170     public:
00171     SqrSpacing() : m_Spacing(0) {};
00172     ~SqrSpacing() {};
00173     bool operator!=( const SqrSpacing & other ) const
00174       {
00175       return !(*this == other);
00176       }
00177     bool operator==( const SqrSpacing & other ) const
00178       {
00179       return other.m_Spacing == m_Spacing;
00180       }
00181     inline InternalRealType operator()( const InternalRealType & a, const InternalRealType & b )
00182       {
00183       return a + vnl_math_sqr( b / m_Spacing );
00184       }
00185     
00186     double m_Spacing;
00187     };
00188   
00189   typedef BinaryFunctorImageFilter< RealImageType, RealImageType, RealImageType, SqrSpacing > SqrSpacingFilterType;
00190   typedef typename SqrSpacingFilterType::Pointer SqrSpacingFilterPointer;
00191 
00192   GaussianFilterPointer         m_SmoothingFilters[ImageDimension-1];
00193   DerivativeFilterPointer       m_DerivativeFilter;
00194   SqrSpacingFilterPointer       m_SqrSpacingFilter;
00195   SqrtFilterPointer             m_SqrtFilter;
00196 
00198   bool m_NormalizeAcrossScale; 
00199 
00200 
00201 };
00202 
00203 } // end namespace itk
00204 
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.txx"
00207 #endif
00208 
00209 #endif
00210 

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