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 ConstSmartNeighborhoodIterator<
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)
virtual void PrintSelf (std::ostream &, Indent) const
InternalPixelTypeGetCenterPointer ()
virtual void SetCenterPixel (const PixelType &p)
virtual void SetNeighborhood (NeighborhoodType &)
virtual void SetPixel (const unsigned long i, const PixelType &v)
virtual void SetPixel (const unsigned long i, const PixelType &v, bool &status)
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::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 117 of file itkSmartNeighborhoodIterator.h.

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

Typedef for generic boundary condition pointer

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 116 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 109 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< 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::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 107 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstNeighborhoodIterator< TImage >.

Definition at line 119 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 112 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 114 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< 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::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 108 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< 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::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 103 of file itkSmartNeighborhoodIterator.h.

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

Typedef support for common objects

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 111 of file itkSmartNeighborhoodIterator.h.

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

Reimplemented from itk::ConstSmartNeighborhoodIterator< 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.

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

Copy constructor

Definition at line 130 of file itkSmartNeighborhoodIterator.h.

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 144 of file itkSmartNeighborhoodIterator.h.

References HardConnectedComponentImageFilter::RegionType.


Member Function Documentation

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

Returns the central memory pointer of the neighborhood.

Definition at line 153 of file itkSmartNeighborhoodIterator.h.

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

Extract some type information from the superclass.

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

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

Assignment operator

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

Definition at line 134 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
virtual void itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::PrintSelf std::ostream &   ,
Indent   
const [virtual]
 

Prints information about the neighborhood pointer structure to std::cout for debugging purposes.

Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
virtual void itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SetCenterPixel const PixelType   p [inline, virtual]
 

Set the central pixel value of the neighborhood.

Definition at line 157 of file itkSmartNeighborhoodIterator.h.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
virtual void itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SetNeighborhood NeighborhoodType   [virtual]
 

Sets the values in the itk::Image at the iterator location to the values contained in a Neighborhood.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
virtual void itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SetPixel const unsigned long    i,
const PixelType   v,
bool &    status
[virtual]
 

Special SetPixel method which quietly ignores out-of-bounds attempts. Sets status TRUE if pixel has been set, FALSE otherwise.

template<class TImage, class TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
virtual void itk::SmartNeighborhoodIterator< TImage, TBoundaryCondition >::SetPixel const unsigned long    i,
const PixelType   v
[virtual]
 

Set the pixel value at the ith location. Out-of-bounds attempts will generate and exception.


The documentation for this class was generated from the following file:
Generated at Wed Mar 12 01:20:46 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000