KWStyle - itkLaplacianOperator.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkLaplacianOperator.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:40 $
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 #ifndef __itkLaplacianOperator_h
18 #define __itkLaplacianOperator_h
19
20 #include "itkExceptionObject.h"
21 #include "itkNeighborhoodOperator.h"
22
23 namespace itk {
24
25 /**
26  * \class LaplacianOperator
27  *
28  *  A NeighborhoodOperator for use in calculating the Laplacian at a pixel.
29  *  The LaplacianOperator's coefficients are a tightest-fitting convolution
30  *  kernel.
31  *
32  *  For example, the simplest Laplacian Operator for 2D has the form:
33  *  \code
34  *              0   1   0  
35  *              1  -4   1
36  *              0   1   0
37  *  \endcode
38  *              
39  *  \par
40  *  The LaplacianOperator is a non-directional NeighborhoodOperator that
41  *  should be applied to a Neighborhood or NeighborhoodIterator using an inner
42 LEN  *  product method (itkNeighborhoodInnerProduct).  To initialize the operator, you
43  *  need call CreateOperator() before using it.
44  *
45  *  \par
46  *  By default the operator will be created for an isotropic image, but you can
47  *  modify the operator to handle different pixel spacings by calling
48  *  SetDerivativeScalings.  The argument to SetDerivativeScalings is an array
49  *  of doubles that is of length VDimension (the dimensionality of the image).
50  *  Make sure to use 1/pixel_spacing to properly scale derivatives.
51  *
52  * \sa NeighborhoodOperator
53  * \sa Neighborhood
54  * \ingroup Operators */
55 template<class TPixel, unsigned int VDimension=2,
56   class TAllocator = NeighborhoodAllocator<TPixel> >
57 class ITK_EXPORT LaplacianOperator
58 IND **: public NeighborhoodOperator<TPixel, VDimension, TAllocator>
59 {
60 public:
61   /** Standard "Self" typedef support.   */
62   typedef LaplacianOperator Self;
63
64   /** Standard "Superclass" typedef.   */
65   typedef NeighborhoodOperator<TPixel, VDimension, TAllocator>  Superclass;
66
67   typedef typename Superclass::PixelType PixelType;
68 TDA   typedef typename Superclass::SizeType SizeType;
69
70 IND */**  Default constructor  */
71   LaplacianOperator()
72 IND **{
73     for (unsigned i = 0; i < VDimension; ++i)
74       {
75       m_DerivativeScalings[i] = 1.0;
76       }
77   }
78
79   /** Copy constructor   */
80   LaplacianOperator(const Self& other)
81     : NeighborhoodOperator<TPixel, VDimension, TAllocator>(other) 
82 IND **{
83     for (unsigned i = 0; i < VDimension; ++i)
84       {
85       m_DerivativeScalings[i] = other.m_DerivativeScalings[i];
86       }
87 IND **}
88   
89   /** This function is called to create the operator  */ 
90   void CreateOperator();  
91
92  
93   /** Assignment operator   */
94   Self &operator=(const Self& other)
95 IND **{
96     Superclass::operator=(other);
97     return *this;
98 IND **}
99   
100   /** Prints some debugging information   */
101   virtual void PrintSelf(std::ostream &os, Indent i) const  
102 IND **{ 
103     os << i << "LaplacianOperator { this=" << this
104 IND *******<< "}" << std::endl;
105     Superclass::PrintSelf(os, i.GetNextIndent());
106 IND **}
107
108   /** Sets the weights that are applied to the derivative in each axial
109    *  direction when the kernel is computed.  These weights are all 1.0 by
110    *  default. This method must be called BEFORE CreateOperator */
111   void SetDerivativeScalings( const double *s );
112            
113 protected:
114   /** Typedef support for coefficient vector type.  Necessary to
115    * work around compiler bug on VC++.   */
116   typedef typename Superclass::CoefficientVector CoefficientVector;
117
118   /** Calculates operator coefficients.   */
119   CoefficientVector GenerateCoefficients();
120
121   /** Arranges coefficients spatially in the memory buffer, default
122    * function was NOT used.   */
123   void Fill(const CoefficientVector &);
124
125 private:
126   /** Weights applied to derivatives in each axial direction */
127   double m_DerivativeScalings[VDimension];
128   
129 };
130
131 // namespace itk
132
133 #ifndef ITK_MANUAL_INSTANTIATION
134 #include "itkLaplacianOperator.txx"
135 #endif
136
137 #endif
138
139 EOF
140 EOF,EML

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