ITK  6.0.0
Insight Toolkit
itkShapedNeighborhoodIterator.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 itkShapedNeighborhoodIterator_h
19 #define itkShapedNeighborhoodIterator_h
20 
21 #include <vector>
22 #include <list>
24 
25 namespace itk
26 {
148 template <typename TImage, typename TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
149 class ITK_TEMPLATE_EXPORT ShapedNeighborhoodIterator
150  : public ConstShapedNeighborhoodIterator<TImage, TBoundaryCondition>
151 {
152 public:
154  using InternalPixelType = typename TImage::InternalPixelType;
155  using PixelType = typename TImage::PixelType;
156 
158  static constexpr unsigned int Dimension = TImage::ImageDimension;
159 
163 
165  using typename Superclass::OffsetType;
167  using typename Superclass::RadiusType;
168  using typename Superclass::SizeType;
169  using typename Superclass::SizeValueType;
170  using typename Superclass::ConstIterator;
171  using typename Superclass::IndexListType;
172  using typename Superclass::BoundaryConditionType;
173  using typename Superclass::ImageBoundaryConditionPointerType;
174  using typename Superclass::NeighborhoodType;
175  using typename Superclass::IndexType;
176  using typename Superclass::ImageType;
177  using typename Superclass::RegionType;
178  using typename Superclass::IndexValueType;
179 
182  {
183  Iterator() = default;
185  : ConstIterator(s)
186  {}
187 
188  ~Iterator() = default;
189  Iterator &
190  operator=(const Iterator & o)
191  {
192  ConstIterator::operator=(o);
193  return *this;
194  }
195 
196  // Promote to public
197  void
198  Set(const PixelType & v) const
199  {
200  ConstIterator::ProtectedSet(v);
201  }
202 
203  protected:
204  friend Self;
205 
206  Iterator(const Self * s, const typename IndexListType::const_iterator & li)
207  : ConstIterator(s, li)
208  {}
209  };
210 
212  ShapedNeighborhoodIterator() = default;
213 
215  ~ShapedNeighborhoodIterator() override = default;
216 
219 
222  ShapedNeighborhoodIterator(const SizeType & radius, const ImageType * ptr, const RegionType & region)
223  : Superclass(radius, const_cast<ImageType *>(ptr), region)
224  {}
225 
226  // Expose the following methods from the superclass. This is a restricted
227  // subset of the methods available for NeighborhoodIterator.
228  using Superclass::SetPixel;
229  using Superclass::SetCenterPixel;
230 
231 
233  Self &
234  operator=(const Self & orig)
235  {
236  Superclass::operator=(orig);
237  return *this;
238  }
243  Iterator
245  {
246  return Iterator(this, this->m_ActiveIndexList.begin());
247  }
248  Iterator
249  End()
250  {
251  return Iterator(this, this->m_ActiveIndexList.end());
252  }
255  using Superclass::Begin;
256  using Superclass::End;
257 
258 protected:
259  friend Superclass;
260 
261  using typename Superclass::NeighborIndexType;
262 };
263 } // namespace itk
264 
265 #endif
itk::ShapedNeighborhoodIterator::operator=
Self & operator=(const Self &orig)
Definition: itkShapedNeighborhoodIterator.h:234
itkConstShapedNeighborhoodIterator.h
itk::ShapedNeighborhoodIterator::ShapedNeighborhoodIterator
ShapedNeighborhoodIterator(const SizeType &radius, const ImageType *ptr, const RegionType &region)
Definition: itkShapedNeighborhoodIterator.h:222
itk::ShapedNeighborhoodIterator::Iterator::Set
void Set(const PixelType &v) const
Definition: itkShapedNeighborhoodIterator.h:198
itk::ShapedNeighborhoodIterator::Iterator::Iterator
Iterator(Self *s)
Definition: itkShapedNeighborhoodIterator.h:184
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
itk::ConstNeighborhoodIterator< ImageType, ZeroFluxNeumannBoundaryCondition< ImageType > >::PixelType
typename ImageType ::PixelType PixelType
Definition: itkConstNeighborhoodIterator.h:57
itk::ShapedNeighborhoodIterator::Iterator::Self
friend Self
Definition: itkShapedNeighborhoodIterator.h:204
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::ConstNeighborhoodIterator::ConstIterator
typename AllocatorType::const_iterator ConstIterator
Definition: itkNeighborhood.h:76
itk::ShapedNeighborhoodIterator
A neighborhood iterator which can take on an arbitrary shape.
Definition: itkShapedNeighborhoodIterator.h:149
itk::ShapedNeighborhoodIterator::Iterator::Iterator
Iterator(const Self *s, const typename IndexListType::const_iterator &li)
Definition: itkShapedNeighborhoodIterator.h:206
itk::IndexValueType
long IndexValueType
Definition: itkIntTypes.h:93
itk::ConstNeighborhoodIterator< ImageType, ZeroFluxNeumannBoundaryCondition< ImageType > >::ImageType
ImageType ImageType
Definition: itkConstNeighborhoodIterator.h:77
itk::ShapedNeighborhoodIterator::Iterator::operator=
Iterator & operator=(const Iterator &o)
Definition: itkShapedNeighborhoodIterator.h:190
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ConstNeighborhoodIterator< ImageType, ZeroFluxNeumannBoundaryCondition< ImageType > >::InternalPixelType
typename ImageType ::InternalPixelType InternalPixelType
Definition: itkConstNeighborhoodIterator.h:56
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ConstShapedNeighborhoodIterator
Const version of ShapedNeighborhoodIterator, defining iteration of a local N-dimensional neighborhood...
Definition: itkConstShapedNeighborhoodIterator.h:72
itk::OffsetValueType
long OffsetValueType
Definition: itkIntTypes.h:97
itk::ShapedNeighborhoodIterator::End
Iterator End()
Definition: itkShapedNeighborhoodIterator.h:249
itk::Neighborhood::ConstIterator
typename AllocatorType::const_iterator ConstIterator
Definition: itkNeighborhood.h:76
itk::Offset
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
Definition: itkOffset.h:66
itk::ShapedNeighborhoodIterator::Iterator
Definition: itkShapedNeighborhoodIterator.h:181
itk::ConstShapedNeighborhoodIterator< ImageType, ZeroFluxNeumannBoundaryCondition< ImageType > >::OffsetValueType
typename OffsetType::OffsetValueType OffsetValueType
Definition: itkConstShapedNeighborhoodIterator.h:88
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itk::ConstNeighborhoodIterator< ImageType, ZeroFluxNeumannBoundaryCondition< ImageType > >::RegionType
typename ImageType ::RegionType RegionType
Definition: itkConstNeighborhoodIterator.h:78
itk::ShapedNeighborhoodIterator::Superclass
friend Superclass
Definition: itkShapedNeighborhoodIterator.h:259
AddImageFilter
Definition: itkAddImageFilter.h:81
itk::Neighborhood::NeighborIndexType
SizeValueType NeighborIndexType
Definition: itkNeighborhood.h:96
itk::ShapedNeighborhoodIterator::Begin
Iterator Begin()
Definition: itkShapedNeighborhoodIterator.h:244
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::ConstNeighborhoodIterator< ImageType, ZeroFluxNeumannBoundaryCondition< ImageType > >::Iterator
typename AllocatorType::iterator Iterator
Definition: itkNeighborhood.h:75
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86