ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkLaplacianOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkLaplacianOperator_h
19 #define __itkLaplacianOperator_h
20 
22 
23 namespace itk
24 {
62 template< class TPixel, unsigned int VDimension = 2,
63  class TAllocator = NeighborhoodAllocator< TPixel > >
64 class ITK_EXPORT LaplacianOperator:
65  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
66 {
67 public:
68 
71 
74 
75  typedef typename Superclass::PixelType PixelType;
76  typedef typename Superclass::SizeType SizeType;
77 
80  {
81  for ( unsigned i = 0; i < VDimension; ++i )
82  {
83  m_DerivativeScalings[i] = 1.0;
84  }
85  }
87 
89  LaplacianOperator(const Self & other):
90  NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
91  {
92  for ( unsigned i = 0; i < VDimension; ++i )
93  {
94  m_DerivativeScalings[i] = other.m_DerivativeScalings[i];
95  }
96  }
98 
100  void CreateOperator();
101 
103  Self & operator=(const Self & other)
104  {
105  Superclass::operator=(other);
106  return *this;
107  }
109 
111  virtual void PrintSelf(std::ostream & os, Indent i) const
112  {
113  os << i << "LaplacianOperator { this=" << this
114  << "}" << std::endl;
115  Superclass::PrintSelf( os, i.GetNextIndent() );
116  }
118 
122  void SetDerivativeScalings(const double *s);
123 
124 protected:
128 
130  CoefficientVector GenerateCoefficients();
131 
134  void Fill(const CoefficientVector &);
135 
136 private:
138  double m_DerivativeScalings[VDimension];
139 };
140 } // namespace itk
141 
142 // Define instantiation macro for this template.
143 #define ITK_TEMPLATE_LaplacianOperator(_, EXPORT, TypeX, TypeY) \
144  namespace itk \
145  { \
146  _( 2 ( class EXPORT LaplacianOperator< ITK_TEMPLATE_2 TypeX > ) ) \
147  namespace Templates \
148  { \
149  typedef LaplacianOperator< ITK_TEMPLATE_2 TypeX > \
150  LaplacianOperator##TypeY; \
151  } \
152  }
153 
154 #if ITK_TEMPLATE_EXPLICIT
155 #include "Templates/itkLaplacianOperator+-.h"
156 #endif
157 
158 #if ITK_TEMPLATE_TXX
159 #include "itkLaplacianOperator.hxx"
160 #endif
161 
162 #endif
163