ITK  5.4.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  * https://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 typename Superclass::SizeType;
83 
85  using PixelType = TPixel;
86 
89 
91 
93  void
94  SetDirection(const unsigned long direction)
95  {
96  m_Direction = direction;
97  }
98 
100  unsigned long
101  GetDirection() const
102  {
103  return m_Direction;
104  }
105 
110  virtual void
111  CreateDirectional();
112 
117  virtual void
118  CreateToRadius(const SizeType &);
119 
124  virtual void
125  CreateToRadius(const SizeValueType);
126 
129  virtual void
130  FlipAxes();
131 
132  void
133  PrintSelf(std::ostream & os, Indent indent) const override
134  {
135  Superclass::PrintSelf(os, indent);
136 
137  os << indent << "Direction: " << m_Direction << std::endl;
138  }
139 
142  void ScaleCoefficients(PixelRealType);
143 
144 protected:
147  using CoefficientVector = typename std::vector<PixelRealType>;
148 
151  virtual CoefficientVector
152  GenerateCoefficients() = 0;
153 
156  virtual void
157  Fill(const CoefficientVector &) = 0;
158 
164  virtual void
165  FillCenteredDirectional(const CoefficientVector &);
166 
168  void
170  {
171  for (unsigned int i = 0; i < this->Size(); ++i)
172  {
173  this->operator[](i) = PixelType{};
174  }
175  }
178 private:
180  unsigned long m_Direction{ 0 };
181 };
182 } // namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 # include "itkNeighborhoodOperator.hxx"
186 #endif
187 
188 /*
189 #ifndef ITK_MANUAL_INSTANTIATION
190 #include "itkNeighborhoodOperator.hxx"
191 #endif
192 */
193 #endif
itk::NeighborhoodOperator::SetDirection
void SetDirection(const unsigned long direction)
Definition: itkNeighborhoodOperator.h:94
itk::NeighborhoodOperator::GetDirection
unsigned long GetDirection() const
Definition: itkNeighborhoodOperator.h:101
itk::NeighborhoodOperator< TPixel, TDimension, TAllocator >::PixelRealType
typename NumericTraits< TPixel >::RealType PixelRealType
Definition: itkNeighborhoodOperator.h:90
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:71
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::NeighborhoodOperator< TPixel, TDimension, TAllocator >::CoefficientVector
typename std::vector< PixelRealType > CoefficientVector
Definition: itkNeighborhoodOperator.h:147
itkOverrideGetNameOfClassMacro
itkOverrideGetNameOfClassMacro(AddImageFilter)
itk::Neighborhood::PixelType
TPixel PixelType
Definition: itkNeighborhood.h:70
itk::NeighborhoodOperator::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkNeighborhoodOperator.h:133
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:85
itk::NeighborhoodOperator::InitializeToZero
void InitializeToZero()
Definition: itkNeighborhoodOperator.h:169
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83