ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodIterator.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 itkNeighborhoodIterator_h
19 #define itkNeighborhoodIterator_h
20 
21 #include <vector>
22 #include <cstring>
23 #include <iostream>
25 
26 namespace itk
27 {
210 template< typename TImage, typename TBoundaryCondition =
212 class ITK_TEMPLATE_EXPORT NeighborhoodIterator:
213  public ConstNeighborhoodIterator< TImage, TBoundaryCondition >
214 {
215 public:
219 
221  typedef typename Superclass::InternalPixelType InternalPixelType;
223  typedef typename Superclass::SizeType SizeType;
224  typedef typename Superclass::ImageType ImageType;
225  typedef typename Superclass::RegionType RegionType;
228  typedef typename Superclass::RadiusType RadiusType;
229  typedef typename Superclass::NeighborhoodType NeighborhoodType;
230  typedef typename Superclass::Iterator Iterator;
232  typedef typename Superclass::ImageBoundaryConditionPointerType
234 
237 
240 
242  Self & operator=(const Self & orig)
243  {
244  Superclass::operator=(orig);
245  return *this;
246  }
248 
252  const RegionType & region):
253  Superclass(radius, ptr, region) {}
254 
256  virtual void PrintSelf(std::ostream &, Indent) const;
257 
260  { return ( this->operator[]( ( this->Size() ) >> 1 ) ); }
261 
263  virtual void SetCenterPixel(const PixelType & p)
264  { this->m_NeighborhoodAccessorFunctor.Set(this->operator[]( ( this->Size() ) >> 1 ), p); }
265 
269  virtual void SetNeighborhood(const NeighborhoodType &);
270 
273  virtual void SetPixel(const unsigned i, const PixelType & v,
274  bool & status);
275 
277  virtual void SetPixel(const unsigned i, const PixelType & v);
278 
279  // { *(this->operator[](i)) = v; }
280 
282  virtual void SetPixel(const OffsetType o, const PixelType & v)
283  { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
284  // { *(this->operator[](o)) = v; }
286 
290  virtual void SetNext(const unsigned axis, const unsigned i,
291  const PixelType & v)
292  {
293  this->SetPixel(this->GetCenterNeighborhoodIndex()
294  + ( i * this->GetStride(axis) ), v);
295  }
296 
300  virtual void SetNext(const unsigned axis, const PixelType & v)
301  {
302  this->SetPixel(this->GetCenterNeighborhoodIndex()
303  + this->GetStride(axis), v);
304  }
305 
309  virtual void SetPrevious(const unsigned axis, const unsigned i,
310  const PixelType & v)
311  {
312  this->SetPixel(this->GetCenterNeighborhoodIndex()
313  - ( i * this->GetStride(axis) ), v);
314  }
315 
319  virtual void SetPrevious(const unsigned axis,
320  const PixelType & v)
321  {
322  this->SetPixel(this->GetCenterNeighborhoodIndex()
323  - this->GetStride(axis), v);
324  }
325 };
326 } // namespace itk
328 
329 #ifndef ITK_MANUAL_INSTANTIATION
330 #include "itkNeighborhoodIterator.hxx"
331 #endif
332 
333 #endif
virtual void SetPixel(const OffsetType o, const PixelType &v)
virtual void SetPrevious(const unsigned axis, const unsigned i, const PixelType &v)
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 SetNext(const unsigned axis, const unsigned i, const PixelType &v)
NeighborhoodIterator(const SizeType &radius, ImageType *ptr, const RegionType &region)
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Superclass::RegionType RegionType
virtual void SetNext(const unsigned axis, const PixelType &v)
NeighborhoodIterator(const NeighborhoodIterator &n)
ConstNeighborhoodIterator< TImage, TBoundaryCondition > Superclass
virtual void SetCenterPixel(const PixelType &p)
Superclass::NeighborhoodType NeighborhoodType
Superclass::ConstIterator ConstIterator
Superclass::OffsetType OffsetType
Superclass::RadiusType RadiusType
Superclass::ImageBoundaryConditionPointerType ImageBoundaryConditionPointerType
Superclass::InternalPixelType InternalPixelType
Self & operator=(const Self &orig)
AllocatorType::iterator Iterator
InternalPixelType * GetCenterPointer()
virtual void SetPrevious(const unsigned axis, const PixelType &v)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
AllocatorType::const_iterator ConstIterator
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.