#include <itkSmartNeighborhoodIterator.h>
Inheritance diagram for itk::SmartNeighborhoodIterator:
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 ®ion) | |
Self & | operator= (const Self &orig) |
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.
Definition at line 98 of file itkSmartNeighborhoodIterator.h.
|
Reimplemented from itk::ConstNeighborhoodIterator< TImage >. Definition at line 117 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 116 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 109 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 113 of file itkSmartNeighborhoodIterator.h. |
|
Extract some type information from the superclass. Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 107 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 119 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 112 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 114 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 118 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 108 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 110 of file itkSmartNeighborhoodIterator.h. |
|
Standard class typdefs. Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 103 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 111 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 104 of file itkSmartNeighborhoodIterator.h. |
|
Default constructor. Definition at line 126 of file itkSmartNeighborhoodIterator.h. References itkGenericOutputMacro. |
|
Copy constructor Definition at line 131 of file itkSmartNeighborhoodIterator.h. References itkGenericOutputMacro. |
|
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. |
|
Extract some type information from the superclass. |
|
Assignment operator Reimplemented from itk::NeighborhoodIterator< TImage >. Definition at line 135 of file itkSmartNeighborhoodIterator.h. |