ITK  5.2.0
Insight Toolkit
itkNeighborhoodOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkNeighborhoodOperator_h
19 #define itkNeighborhoodOperator_h
20 
21 #include "itkNeighborhood.h"
22 #include "itkNumericTraits.h"
23 #include <vector>
24 
25 namespace itk
26 {
71 template <typename TPixel, unsigned int VDimension, typename TAllocator = NeighborhoodAllocator<TPixel>>
72 class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDimension, TAllocator>
73 {
74 public:
78 
80 
82  using SizeType = typename Superclass::SizeType;
83 
85  using PixelType = TPixel;
86 
89 
91  void
92  SetDirection(const unsigned long & direction)
93  {
94  m_Direction = direction;
95  }
96 
98  unsigned long
99  GetDirection() const
100  {
101  return m_Direction;
102  }
103 
108  virtual void
109  CreateDirectional();
110 
115  virtual void
116  CreateToRadius(const SizeType &);
117 
122  virtual void
123  CreateToRadius(const SizeValueType);
124 
127  virtual void
128  FlipAxes();
129 
131  void
132  PrintSelf(std::ostream & os, Indent i) const override
133  {
134  os << i << "NeighborhoodOperator { this=" << this << " Direction = " << m_Direction << " }" << std::endl;
135  Superclass::PrintSelf(os, i.GetNextIndent());
136  }
138 
140 
143  void ScaleCoefficients(PixelRealType);
144 
145 protected:
148  using CoefficientVector = std::vector<PixelRealType>;
149 
152  virtual CoefficientVector
153  GenerateCoefficients() = 0;
154 
157  virtual void
158  Fill(const CoefficientVector &) = 0;
159 
165  virtual void
166  FillCenteredDirectional(const CoefficientVector &);
167 
169  void
171  {
172  for (unsigned int i = 0; i < this->Size(); ++i)
173  {
174  this->operator[](i) = NumericTraits<PixelType>::ZeroValue();
175  }
176  }
178 
179 private:
181  unsigned long m_Direction{ 0 };
182 };
183 } // namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 # include "itkNeighborhoodOperator.hxx"
187 #endif
188 
189 /*
190 #ifndef ITK_MANUAL_INSTANTIATION
191 #include "itkNeighborhoodOperator.hxx"
192 #endif
193 */
194 #endif
itk::Indent::GetNextIndent
Indent GetNextIndent() const
itk::NeighborhoodOperator::GetDirection
unsigned long GetDirection() const
Definition: itkNeighborhoodOperator.h:99
itk::NeighborhoodOperator< TPixel, TDimension, TAllocator >::PixelRealType
typename NumericTraits< TPixel >::RealType PixelRealType
Definition: itkNeighborhoodOperator.h:139
itk::NeighborhoodOperator::PrintSelf
void PrintSelf(std::ostream &os, Indent i) const override
Definition: itkNeighborhoodOperator.h:132
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
itk::SliceIterator
A flexible iterator for itk containers(i.e. itk::Neighborhood) that support pixel access through oper...
Definition: itkSliceIterator.h:48
itk::NeighborhoodOperator
Virtual class that defines a common interface to all neighborhood operator subtypes.
Definition: itkNeighborhoodOperator.h:72
itk::Neighborhood
A light-weight container object for storing an N-dimensional neighborhood of values.
Definition: itkNeighborhood.h:54
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkNeighborhood.h
itk::Neighborhood::PixelType
TPixel PixelType
Definition: itkNeighborhood.h:70
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:148
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkNumericTraits.h
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::NeighborhoodOperator::InitializeToZero
void InitializeToZero()
Definition: itkNeighborhoodOperator.h:170
itk::NeighborhoodOperator::SetDirection
void SetDirection(const unsigned long &direction)
Definition: itkNeighborhoodOperator.h:92
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::NeighborhoodOperator< TPixel, TDimension, TAllocator >::CoefficientVector
std::vector< PixelRealType > CoefficientVector
Definition: itkNeighborhoodOperator.h:148