KWStyle - itkGaussianDerivativeImageFunction.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkGaussianDerivativeImageFunction.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:36 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 DEF #ifndef _itkGaussianDerivativeImageFunction_h
18 DEF #define _itkGaussianDerivativeImageFunction_h
19
20 #include "itkNeighborhoodOperatorImageFunction.h"
21 #include "itkImageFunction.h"
22 #include "itkGaussianDerivativeSpatialFunction.h"
23 #include "itkGaussianSpatialFunction.h"
24
25 namespace itk
26 {
27
28 /**
29  * \class GaussianDerivativeImageFunction
30  * \brief Compute the gaussian derivatives of an the image
31  *        at a specific location in space, i.e. point, index or continuous
32  *        index.
33  * This class is templated over the input image type.
34  * \sa NeighborhoodOperator
35  * \sa ImageFunction
36  */
37 template <class TInputImage,class TOutput=double>
38 class ITK_EXPORT GaussianDerivativeImageFunction :
39 IND **public ImageFunction< TInputImage,
40     Vector<TOutput,::itk::GetImageDimension<TInputImage>::ImageDimension>,
41 IND ****TOutput >
42 {
43 public:
44
45   /**Standard "Self" typedef */
46   typedef GaussianDerivativeImageFunction Self;
47
48   /** Standard "Superclass" typedef*/
49   typedef ImageFunction<TInputImage,
50     Vector<TOutput,::itk::GetImageDimension<TInputImage>::ImageDimension>,
51 IND ****TOutput > Superclass;
52
53   /** Smart pointer typedef support. */
54   typedef SmartPointer<Self> Pointer;
55 TDA   typedef SmartPointer<const Self>  ConstPointer;
56
57   /** Method for creation through the object factory.*/
58   itkNewMacro(Self);
59
60   /** Run-time type information (and related methods). */
61   itkTypeMacro( GaussianDerivativeImageFunction, ImageFunction );
62
63   /** InputImageType typedef support.*/
64   typedef TInputImage                                 InputImageType;
65   typedef typename InputImageType::PixelType          InputPixelType;
66 TDA   typedef typename InputImageType::IndexType IndexType;
67
68   /** Dimension of the underlying image. */
69   itkStaticConstMacro(ImageDimension2, unsigned int,
70                       InputImageType::ImageDimension);
71   
72   typedef ContinuousIndex<TOutput,itkGetStaticConstMacro(ImageDimension2)>
73 IND **********ContinuousIndexType;
74
75
76 LEN   typedef Neighborhood<InputPixelType, itkGetStaticConstMacro(ImageDimension2)> NeighborhoodType;
77 LEN,TDA   typedef Neighborhood<TOutput, itkGetStaticConstMacro(ImageDimension2)> OperatorNeighborhoodType;
78
79   typedef Vector<TOutput,itkGetStaticConstMacro(ImageDimension2)>  VectorType;
80 TDA   typedef typename Superclass::OutputType  OutputType;
81 LEN,TDA   typedef FixedArray<OperatorNeighborhoodType,2*itkGetStaticConstMacro(ImageDimension2)> OperatorArrayType;
82   typedef NeighborhoodOperatorImageFunction<InputImageType,
83 TDA                                              TOutput> OperatorImageFunctionType;
84 LEN,TDA   typedef typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer;
85
86 LEN   typedef GaussianDerivativeSpatialFunction<TOutput,1>  GaussianDerivativeFunctionType;
87 LEN,TDA   typedef typename GaussianDerivativeFunctionType::Pointer GaussianDerivativeFunctionPointer;
88
89   typedef GaussianSpatialFunction<TOutput,1>  GaussianFunctionType;
90 TDA   typedef typename GaussianFunctionType::Pointer GaussianFunctionPointer;
91
92   /** Point typedef support. */
93   typedef Point<TOutput,itkGetStaticConstMacro(ImageDimension2)> PointType;
94   
95   /** Evalutate the  in the given dimension at specified point */
96   virtual OutputType Evaluate(const PointType& point) const;
97
98
99   /** Evaluate the function at specified Index position*/
100   virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
101
102   /** Evaluate the function at specified ContinousIndex position.*/
103   virtual OutputType EvaluateAtContinuousIndex( 
104     const ContinuousIndexType & index ) const;
105
106   /** The variance for the discrete Gaussian kernel.  Sets the variance
107    * independently for each dimension, but 
108    * see also SetVariance(const double v). The default is 0.0 in each
109    * dimension. If UseImageSpacing is true, the units are the physical units
110    * of your image.  If UseImageSpacing is false then the units are pixels.*/
111   void SetSigma( const double* sigma);
112   void SetSigma( const double sigma);
113   const double* GetSigma() const {return m_Sigma;}
114  
115   /** Set the extent of the kernel */
116   void SetExtent( const double* extent);
117   void SetExtent( const double extent);
118   const double* GetExtent() const {return m_Extent;}
119
120   /** Set the input image.
121    * \warning this method caches BufferedRegion information.
122    * If the BufferedRegion has changed, user must call
123    * SetInputImage again to update cached values. */
124   virtual void SetInputImage( const InputImageType * ptr );
125
126 protected:
127   GaussianDerivativeImageFunction();
128   GaussianDerivativeImageFunction( const Self& ){};
129
130   ~GaussianDerivativeImageFunction(){};
131
132   void operator=( const Self& ){};
133   void PrintSelf(std::ostream& os, Indent indent) const;
134
135   void RecomputeGaussianKernel();
136   void RecomputeContinuousGaussianKernel(
137            const double* offset) const;
138
139
140 private:
141
142   double                        m_Sigma[ImageDimension2];
143
144 LEN   /** Array of 1D operators. Contains a derivative kernel and a gaussian kernel for
145    *  each dimension */
146   mutable OperatorArrayType     m_OperatorArray;
147   mutable OperatorArrayType     m_ContinuousOperatorArray;
148
149   /** OperatorImageFunction */
150   OperatorImageFunctionPointer  m_OperatorImageFunction;
151   double m_Extent[ImageDimension2];
152
153   /** Flag to indicate whether to use image spacing */
154   bool m_UseImageSpacing;
155
156   /** Neighborhood Image Function */
157   GaussianDerivativeFunctionPointer m_GaussianDerivativeFunction;
158   GaussianFunctionPointer           m_GaussianFunction;
159
160 };
161
162 // namespace itk
163
164 #ifndef ITK_MANUAL_INSTANTIATION
165 #include "itkGaussianDerivativeImageFunction.txx"
166 #endif
167
168 #endif
169
170 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:09PM
© Kitware Inc.