ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkSobelOperator.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 __itkSobelOperator_h
19 #define __itkSobelOperator_h
20 
22 
23 namespace itk
24 {
94 template< class TPixel, unsigned int VDimension = 2,
95  class TAllocator = NeighborhoodAllocator< TPixel > >
96 class ITK_EXPORT SobelOperator:
97  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
98 {
99 public:
100 
104 
105  itkTypeMacro(SobelOperator, NeighborhoodOperator);
106 
108  SobelOperator(const Self & other):
109  NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
110  {}
111 
117  virtual void CreateDirectional()
118  {
119  this->CreateToRadius(1);
120  }
121 
126  // virtual void CreateToRadius(const unsigned long);
127 
131  Self & operator=(const Self & other)
132  {
133  Superclass::operator=(other);
134  return *this;
135  }
137 
141  virtual void PrintSelf(std::ostream & os, Indent i) const
142  {
143  os << i << "SobelOperator { this=" << this << "}" << std::endl;
144  Superclass::PrintSelf( os, i.GetNextIndent() );
145  }
147 
148 protected:
153  typedef typename Superclass::CoefficientVector CoefficientVector;
155 
159  CoefficientVector GenerateCoefficients();
160 
164  void Fill(const CoefficientVector & c);
165 };
166 } // namespace itk
167 
168 // Define instantiation macro for this template.
169 #define ITK_TEMPLATE_SobelOperator(_, EXPORT, TypeX, TypeY) \
170  namespace itk \
171  { \
172  _( 2 ( class EXPORT SobelOperator< ITK_TEMPLATE_2 TypeX > ) ) \
173  namespace Templates \
174  { \
175  typedef SobelOperator< ITK_TEMPLATE_2 TypeX > \
176  SobelOperator##TypeY; \
177  } \
178  }
179 
180 #if ITK_TEMPLATE_EXPLICIT
181 #include "Templates/itkSobelOperator+-.h"
182 #endif
183 
184 #if ITK_TEMPLATE_TXX
185 #include "itkSobelOperator.hxx"
186 #endif
187 
188 #endif
189