Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition > Class Template Reference
[Image Iterators]

An extension of NeighborhoodIterator that automatically performs bounds checking on the image and returns user-supplied boundary conditions for out-of-bounds pixels. More...

#include <itkSmartNeighborhoodIterator.h>

Inheritance diagram for itk::SmartNeighborhoodIterator:

Inheritance graph
[legend]
Collaboration diagram for itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef SmartNeighborhoodIterator Self
typedef NeighborhoodIterator<
TImage > 
Superclass
typedef Superclass::InternalPixelType InternalPixelType
typedef Superclass::PixelType PixelType
typedef Superclass::ImageType ImageType
typedef Superclass::RegionType RegionType
typedef Superclass::SizeType SizeType
typedef Superclass::NeighborhoodType NeighborhoodType
typedef Superclass::IndexType IndexType
typedef Superclass::OffsetType OffsetType
typedef Superclass::ImageBoundaryConditionPointerType ImageBoundaryConditionPointerType
typedef Superclass::BoundaryConditionType BoundaryConditionType
typedef Superclass::OffsetValueType OffsetValueType
typedef Superclass::Iterator Iterator

Public Methods

 itkStaticConstMacro (Dimension, unsigned int, Superclass::Dimension)
 SmartNeighborhoodIterator ()
 SmartNeighborhoodIterator (const Self &orig)
 SmartNeighborhoodIterator (const SizeType &radius, ImageType *ptr, const RegionType &region)
Selfoperator= (const Self &orig)

Detailed Description

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
class itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >

An extension of NeighborhoodIterator that automatically performs bounds checking on the image and returns user-supplied boundary conditions for out-of-bounds pixels.

SmartNeighborhoodIterator checks boundary conditions when it is dereferenced (i.e., when GetNeighborhood() or GetPixel() is called). A boundary condition is supplied either as a template parameter or through the OverrideBoundaryCondition() method. The iterator returns a value accoding to the boundary condition for each out-of-bounds pixel.

An out out-of-bounds pixel is a pixel that lies outside of Image::BufferedRegion (regardless of the region over which the iterator is defined).

Here is an example of how SmartNeighborhoodIterator can be used. This is the same example given for NeighborhoodIterator, extended to automatically detect and handle out-of-bounds pixel references. (See NeighborhoodIteratorfor a more complete explanation of the code.)

 itk::NeighborhoodInnerProduct<ImageType> IP;

 itk::ConstantBoundaryCondition<ImageType> BC;
 BC->SetConstant(0);

 itk::DerivativeOperator<ImageType> operator;
  operator->SetOrder(1);
  operator->SetDirection(0);
  operator->CreateDirectional();

 itk::SmartNeighborhoodIterator<ImageType>
   iterator(operator->GetRadius(), myImage, myImage->GetRequestedRegion());

 iterator->OverrideBoundaryCondition(&BC);

 iterator.SetToBegin();
 while ( ! iterator.IsAtEnd() )
 {
   std::cout << "Derivative at index " << iterator.GetIndex() << is <<
     IP(iterator, operator) << std::endl;
   ++iterator;
 } 

In the code above, the iterator will replace all references to out-of-bound values with the value zero. Other boundary conditions exist and can be created by the user. See ImageBoundaryCondition for more information.

Care should be taken to ensure that the overriding boundary condition is a persistent object during the time it is referenced. The overriding condition can be of a different type than the default type as long as it is a subclass of ImageBoundaryCondition. A default type can be supplied as an optional template parameter.

Bounds checking introduces considerable penalties during processing. A more efficient approach is to only use the SmartNeighborhoodIterator on regions known to contain out-of-bounds pixels, then use NeighborhoodIterator on the remaining in-bounds regions. See NeighborhoodAlgorithm::ImageBoundaryFacesCalculator.

Attempting to Set an out-of-bounds pixel will result in a thrown exception.

The default template boundary condition type for SmartNeighborhoodIterator is ZeroFluxNeumanBoundaryCondition.

See also:
NeighborhoodIterator , ImageBoundaryCondition , NeighborhoodAlgorithm

Definition at line 98 of file itkSmartNeighborhoodIterator.h.


Member Typedef Documentation

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::BoundaryConditionType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::BoundaryConditionType
 

Reimplemented from itk::ConstNeighborhoodIterator< TImage >.

Definition at line 117 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::ImageBoundaryConditionPointerType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::ImageBoundaryConditionPointerType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 116 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::ImageType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::ImageType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 109 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::IndexType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::IndexType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 113 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::InternalPixelType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::InternalPixelType
 

Extract some type information from the superclass.

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 107 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::Iterator itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::Iterator
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 119 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::NeighborhoodType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::NeighborhoodType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 112 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::OffsetType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::OffsetType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 114 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::OffsetValueType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::OffsetValueType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 118 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::PixelType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::PixelType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 108 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::RegionType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::RegionType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 110 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef SmartNeighborhoodIterator itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::Self
 

Standard class typdefs.

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 103 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef Superclass::SizeType itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SizeType
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 111 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
typedef NeighborhoodIterator<TImage> itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::Superclass
 

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 104 of file itkSmartNeighborhoodIterator.h.


Constructor & Destructor Documentation

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SmartNeighborhoodIterator   [inline]
 

Default constructor.

Definition at line 126 of file itkSmartNeighborhoodIterator.h.

References itkGenericOutputMacro.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SmartNeighborhoodIterator const Self   orig [inline]
 

Copy constructor

Definition at line 131 of file itkSmartNeighborhoodIterator.h.

References itkGenericOutputMacro.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SmartNeighborhoodIterator const SizeType   radius,
ImageType   ptr,
const RegionType   region
[inline]
 

Constructor establishes a neighborhood of iterators of a specified dimension to walk a particular image and a particular region of that image.

Definition at line 145 of file itkSmartNeighborhoodIterator.h.

References itkGenericOutputMacro, and HardConnectedComponentImageFilter::RegionType.


Member Function Documentation

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::itkStaticConstMacro Dimension   ,
unsigned    int,
Superclass::Dimension   
 

Extract some type information from the superclass.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
Self& itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::operator= const Self   orig [inline]
 

Assignment operator

Reimplemented from itk::NeighborhoodIterator< TImage >.

Definition at line 135 of file itkSmartNeighborhoodIterator.h.


The documentation for this class was generated from the following file:
Generated at Fri May 21 01:40:14 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000