ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkShapedNeighborhoodIterator.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 itkShapedNeighborhoodIterator_h
19 #define itkShapedNeighborhoodIterator_h
20 
21 #include <vector>
22 #include <list>
24 
25 namespace itk
26 {
150 template< typename TImage,
151  typename TBoundaryCondition = ZeroFluxNeumannBoundaryCondition< TImage >
152  >
153 class ITK_TEMPLATE_EXPORT ShapedNeighborhoodIterator:
154  public ConstShapedNeighborhoodIterator< TImage,
155  TBoundaryCondition >
156 {
157 public:
159  using InternalPixelType = typename TImage::InternalPixelType;
160  using PixelType = typename TImage::PixelType;
161 
163  static constexpr unsigned int Dimension = TImage::ImageDimension;
164 
168  TBoundaryCondition>;
169 
174  using SizeType = typename Superclass::SizeType;
177  using IndexListType = typename Superclass::IndexListType;
178  using BoundaryConditionType = typename Superclass::BoundaryConditionType;
179  using ImageBoundaryConditionPointerType = typename Superclass::ImageBoundaryConditionPointerType;
180  using NeighborhoodType = typename Superclass::NeighborhoodType;
182  using ImageType = typename Superclass::ImageType;
185 
187  struct Iterator:public ConstIterator {
188  Iterator() = default;
190  ConstIterator(s) {}
191 
192  ~Iterator() ITK_ITERATOR_OVERRIDE = default;
193  Iterator & operator=(const Iterator & o)
194  {
195  ConstIterator::operator=(o);
196  return *this;
197  }
198 
199  // Promote to public
200  void Set(const PixelType & v) const
201  { ConstIterator::ProtectedSet(v); }
202  protected:
203 
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 
220  const ImageType *ptr,
221  const RegionType & region
222  ):Superclass(radius, const_cast< ImageType * >( ptr ),
223  region)
224  {
225  }
226 
227  // Expose the following methods from the superclass. This is a restricted
228  // subset of the methods available for NeighborhoodIterator.
229  using Superclass::SetPixel;
230  using Superclass::SetCenterPixel;
231 
232 
234  Self & operator=(const Self & orig)
235  {
236  Superclass::operator=(orig);
237  return *this;
238  }
240 
242  void PrintSelf(std::ostream &, Indent) const override;
243 
246  Iterator Begin() { return Iterator(this, this->m_ActiveIndexList.begin()); }
247  Iterator End() { return Iterator(this, this->m_ActiveIndexList.end()); }
249 
250  using Superclass::Begin;
251  using Superclass::End;
252 
253 protected:
254 
255  friend Superclass;
256 
259 
261 
262 };
263 } // namespace itk
264 
265 #ifndef ITK_MANUAL_INSTANTIATION
266 #include "itkShapedNeighborhoodIterator.hxx"
267 #endif
268 
269 #endif
Const version of ShapedNeighborhoodIterator, defining iteration of a local N-dimensional neighborhood...
unsigned long SizeValueType
Definition: itkIntTypes.h:83
A light-weight container object for storing an N-dimensional neighborhood of values.
SizeValueType NeighborIndexType
Iterator(const Self *s, const typename IndexListType::const_iterator &li)
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
A neighborhood iterator which can take on an arbitrary shape.
typename AllocatorType::const_iterator ConstIterator
ShapedNeighborhoodIterator(const SizeType &radius, const ImageType *ptr, const RegionType &region)
signed long IndexValueType
Definition: itkIntTypes.h:90
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:68
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image...
Definition: itkOffset.h:67
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::ConstIterator ConstIterator
signed long OffsetValueType
Definition: itkIntTypes.h:94