ITK  6.0.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
25namespace itk
26{
71template <typename TPixel, unsigned int VDimension, typename TAllocator = NeighborhoodAllocator<TPixel>>
72class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDimension, TAllocator>
73{
74public:
78
79 itkOverrideGetNameOfClassMacro(NeighborhoodOperator);
82 using typename Superclass::SizeType;
83
85 using PixelType = TPixel;
86
89
91
93 void
94 SetDirection(const unsigned long direction)
95 {
96 if (direction >= VDimension)
97 {
98 itkExceptionMacro(<< " Can not set direction " << direction << " greater than dimensionality of neighborhood "
99 << VDimension);
100 }
101 m_Direction = direction;
102 }
106 unsigned long
108 {
109 return m_Direction;
110 }
111
116 virtual void
118
123 virtual void
125
130 virtual void
131 CreateToRadius(const SizeValueType);
132
135 virtual void
137
138 void
139 PrintSelf(std::ostream & os, Indent indent) const override
140 {
141 Superclass::PrintSelf(os, indent);
142
143 os << indent << "Direction: " << m_Direction << std::endl;
144 }
145
149
150protected:
153 using CoefficientVector = typename std::vector<PixelRealType>;
154
157 virtual CoefficientVector
159
162 virtual void
164
170 virtual void
172
174 void
176 {
177 for (unsigned int i = 0; i < this->Size(); ++i)
178 {
179 this->operator[](i) = PixelType{};
180 }
181 }
184private:
186 unsigned long m_Direction{ 0 };
187};
188} // namespace itk
189
190#ifndef ITK_MANUAL_INSTANTIATION
191# include "itkNeighborhoodOperator.hxx"
192#endif
193
195#ifndef ITK_MANUAL_INSTANTIATION
196#include "itkNeighborhoodOperator.hxx"
197#endif
198*/
199#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Virtual class that defines a common interface to all neighborhood operator subtypes.
void SetDirection(const unsigned long direction)
virtual void FillCenteredDirectional(const CoefficientVector &)
virtual CoefficientVector GenerateCoefficients()=0
unsigned long GetDirection() const
typename NumericTraits< TPixel >::RealType PixelRealType
virtual void Fill(const CoefficientVector &)=0
void ScaleCoefficients(PixelRealType)
typename std::vector< PixelRealType > CoefficientVector
virtual void CreateDirectional()
virtual void CreateToRadius(const SizeType &)
void PrintSelf(std::ostream &os, Indent indent) const override
A light-weight container object for storing an N-dimensional neighborhood of values.
A flexible iterator for itk containers(i.e. itk::Neighborhood) that support pixel access through oper...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....