ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodOperator.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 itkNeighborhoodOperator_h
19 #define itkNeighborhoodOperator_h
20 
21 #include "itkNeighborhood.h"
22 #include "itkNumericTraits.h"
23 #include <vector>
24 
25 namespace itk
26 {
64 template< typename TPixel, unsigned int VDimension,
65  typename TAllocator = NeighborhoodAllocator< TPixel > >
66 class ITK_TEMPLATE_EXPORT NeighborhoodOperator:
67  public Neighborhood< TPixel, VDimension, TAllocator >
68 {
69 public:
73 
75 
77  typedef typename Superclass::SizeType SizeType;
78 
80  typedef TPixel PixelType;
81 
84 
87  { m_Direction = 0; }
88 
90  NeighborhoodOperator(const Self & orig):
91  Neighborhood< TPixel, VDimension, TAllocator >(orig)
92  { m_Direction = orig.m_Direction; }
93 
95  Self & operator=(const Self & orig)
96  {
97  Superclass::operator=(orig);
98  m_Direction = orig.m_Direction;
99  return *this;
100  }
102 
104  void SetDirection(const unsigned long & direction)
105  { m_Direction = direction; }
106 
108  unsigned long GetDirection() const
109  { return m_Direction; }
110 
115  virtual void CreateDirectional();
116 
121  virtual void CreateToRadius(const SizeType &);
122 
127  virtual void CreateToRadius(const SizeValueType);
128 
131  virtual void FlipAxes();
132 
134  virtual void PrintSelf(std::ostream & os, Indent i) const ITK_OVERRIDE
135  {
136  os << i << "NeighborhoodOperator { this=" << this
137  << " Direction = " << m_Direction << " }" << std::endl;
138  Superclass::PrintSelf( os, i.GetNextIndent() );
139  }
141 
143 
146  void ScaleCoefficients(PixelRealType);
147 
148 protected:
151  typedef std::vector< PixelRealType > CoefficientVector;
152 
155  virtual CoefficientVector GenerateCoefficients() = 0;
156 
159  virtual void Fill(const CoefficientVector &) = 0;
160 
166  virtual void FillCenteredDirectional(const CoefficientVector &);
167 
170  {
171  for ( unsigned int i = 0; i < this->Size(); ++i )
172  {
173  this->operator[](i) = NumericTraits< PixelType >::ZeroValue();
174  }
175  }
177 
178 private:
180  unsigned long m_Direction;
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
Neighborhood< TPixel, VDimension, TAllocator > Superclass
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
A light-weight container object for storing an N-dimensional neighborhood of values.
virtual void PrintSelf(std::ostream &os, Indent i) const override
unsigned long GetDirection() const
unsigned long SizeValueType
Definition: itkIntTypes.h:143
void SetDirection(const unsigned long &direction)
NumericTraits< TPixel >::RealType PixelRealType
std::vector< PixelRealType > CoefficientVector
Virtual class that defines a common interface to all neighborhood operator subtypes.
A flexible iterator for itk containers(i.e. itk::Neighborhood) that support pixel access through oper...
SliceIterator< TPixel, Self > SliceIteratorType
Self & operator=(const Self &orig)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
NeighborhoodOperator(const Self &orig)