ITK  4.6.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 {
215 template< typename TImage, typename TBoundaryCondition =
218  public ConstNeighborhoodIterator< TImage, TBoundaryCondition >
219 {
220 public:
221 
225 
229  typedef typename Superclass::SizeType SizeType;
236  typedef typename Superclass::Iterator Iterator;
240 
243 
246 
248  Self & operator=(const Self & orig)
249  {
250  Superclass::operator=(orig);
251  return *this;
252  }
254 
258  const RegionType & region):
259  Superclass(radius, ptr, region) {}
260 
262  virtual void PrintSelf(std::ostream &, Indent) const;
263 
266  { return ( this->operator[]( ( this->Size() ) >> 1 ) ); }
267 
269  virtual void SetCenterPixel(const PixelType & p)
270  { this->m_NeighborhoodAccessorFunctor.Set(this->operator[]( ( this->Size() ) >> 1 ), p); }
271 
275  virtual void SetNeighborhood(const NeighborhoodType &);
276 
279  virtual void SetPixel(const unsigned i, const PixelType & v,
280  bool & status);
281 
283  virtual void SetPixel(const unsigned i, const PixelType & v);
284 
285  // { *(this->operator[](i)) = v; }
286 
288  virtual void SetPixel(const OffsetType o, const PixelType & v)
289  { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
290  // { *(this->operator[](o)) = v; }
292 
296  virtual void SetNext(const unsigned axis, const unsigned i,
297  const PixelType & v)
298  {
300  + ( i * this->GetStride(axis) ), v);
301  }
302 
306  virtual void SetNext(const unsigned axis, const PixelType & v)
307  {
309  + this->GetStride(axis), v);
310  }
311 
315  virtual void SetPrevious(const unsigned axis, const unsigned i,
316  const PixelType & v)
317  {
319  - ( i * this->GetStride(axis) ), v);
320  }
321 
325  virtual void SetPrevious(const unsigned axis,
326  const PixelType & v)
327  {
329  - this->GetStride(axis), v);
330  }
331 };
332 } // namespace itk
334 
335 #ifndef ITK_MANUAL_INSTANTIATION
336 #include "itkNeighborhoodIterator.hxx"
337 #endif
338 
339 #endif
virtual void SetPixel(const OffsetType o, const PixelType &v)
virtual void SetPrevious(const unsigned axis, const unsigned i, const PixelType &v)
NeighborhoodAccessorFunctorType m_NeighborhoodAccessorFunctor
virtual void PrintSelf(std::ostream &, Indent) const
Neighborhood< PixelType, itkGetStaticConstMacro(Dimension) > NeighborhoodType
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)
virtual NeighborIndexType GetNeighborhoodIndex(const OffsetType &) const
NeighborhoodIterator(const SizeType &radius, ImageType *ptr, const RegionType &region)
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
ImageBoundaryCondition< ImageType > * ImageBoundaryConditionPointerType
Superclass::RegionType RegionType
virtual void SetNext(const unsigned axis, const PixelType &v)
Self & operator=(const Self &orig)
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
Index< itkGetStaticConstMacro(Dimension) > IndexType
Superclass::ImageBoundaryConditionPointerType ImageBoundaryConditionPointerType
Superclass::InternalPixelType InternalPixelType
virtual void SetPixel(const unsigned i, const PixelType &v, bool &status)
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
virtual void SetNeighborhood(const NeighborhoodType &)
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
TImage::InternalPixelType InternalPixelType