#include <itkSmartNeighborhoodIterator.h>
Inheritance diagram for itk::SmartNeighborhoodIterator:
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 ®ion) | |
virtual void | PrintSelf (std::ostream &, Indent) const |
InternalPixelType * | GetCenterPointer () |
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) |
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::ConstSmartNeighborhoodIterator< TImage >. Definition at line 117 of file itkSmartNeighborhoodIterator.h. |
|
Typedef for generic boundary condition pointer Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 116 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 109 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 113 of file itkSmartNeighborhoodIterator.h. |
|
Extract some type information from the superclass. Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 107 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstNeighborhoodIterator< TImage >. Definition at line 119 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 112 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 114 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 118 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 108 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 110 of file itkSmartNeighborhoodIterator.h. |
|
Standard class typdefs. Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 103 of file itkSmartNeighborhoodIterator.h. |
|
Typedef support for common objects Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 111 of file itkSmartNeighborhoodIterator.h. |
|
Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 104 of file itkSmartNeighborhoodIterator.h. |
|
Default constructor. Definition at line 126 of file itkSmartNeighborhoodIterator.h. |
|
Copy constructor Definition at line 130 of file itkSmartNeighborhoodIterator.h. |
|
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. |
|
Returns the central memory pointer of the neighborhood. Definition at line 153 of file itkSmartNeighborhoodIterator.h. |
|
Extract some type information from the superclass. Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. |
|
Assignment operator Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. Definition at line 134 of file itkSmartNeighborhoodIterator.h. |
|
Prints information about the neighborhood pointer structure to std::cout for debugging purposes. Reimplemented from itk::ConstSmartNeighborhoodIterator< TImage >. |
|
Set the central pixel value of the neighborhood. Definition at line 157 of file itkSmartNeighborhoodIterator.h. |
|
Sets the values in the itk::Image at the iterator location to the values contained in a Neighborhood. |
|
Special SetPixel method which quietly ignores out-of-bounds attempts. Sets status TRUE if pixel has been set, FALSE otherwise. |
|
Set the pixel value at the ith location. Out-of-bounds attempts will generate and exception. |