ITK  5.0.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< typename TPixel, unsigned int VDimension = 2,
63  typename TAllocator = NeighborhoodAllocator< TPixel > >
64 class ITK_TEMPLATE_EXPORT LaplacianOperator:
65  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
66 {
67 public:
68 
71 
74 
75  using PixelType = typename Superclass::PixelType;
76  using SizeType = typename Superclass::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  void PrintSelf(std::ostream & os, Indent i) const override
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() override;
131 
134  void Fill(const CoefficientVector &) override;
135 
136 private:
138  double m_DerivativeScalings[VDimension];
139 };
140 } // namespace itk
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "itkLaplacianOperator.hxx"
144 #endif
145 
146 #endif
A NeighborhoodOperator for use in calculating the Laplacian at a pixel.
double m_DerivativeScalings[VDimension]
typename Superclass::SizeType SizeType
void PrintSelf(std::ostream &os, Indent i) const override
Self & operator=(const Self &other)
Virtual class that defines a common interface to all neighborhood operator subtypes.
typename Superclass::CoefficientVector CoefficientVector
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::PixelType PixelType
LaplacianOperator(const Self &other)
std::vector< PixelRealType > CoefficientVector
Indent GetNextIndent()