| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkImageRandomIteratorWithIndex.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:39 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
|
#ifndef __itkImageRandomIteratorWithIndex_h |
| 18 |
|
#define __itkImageRandomIteratorWithIndex_h |
| 19 |
|
|
| 20 |
|
#include "itkImageRandomConstIteratorWithIndex.h" |
| 21 |
|
#include "itkImageIteratorWithIndex.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** \class ImageRandomIteratorWithIndex |
| 27 |
|
* \brief A multi-dimensional image iterator that visits a random set of pixels |
| 28 |
|
* within an image region. |
| 29 |
|
* |
| 30 |
|
* This class is a subclass of itkImageRandomConstIteratorWithIndex that adds |
| 31 |
|
* write-access functionality. Please see itkImageRandomConstIteratorWithIndex |
| 32 |
|
* for more information. |
| 33 |
|
* |
| 34 |
|
* \par MORE INFORMATION |
| 35 |
|
* For a complete description of the ITK Image Iterators and their API, please |
| 36 |
|
* see the Iterators chapter in the ITK Software Guide. The ITK Software Guide |
| 37 |
|
* is available in print and as a free .pdf download from http://www.itk.org. |
| 38 |
|
* |
| 39 |
|
* \ingroup ImageIterators |
| 40 |
|
* |
| 41 |
|
* \sa ImageConstIterator \sa ConditionalConstIterator |
| 42 |
|
* \sa ConstNeighborhoodIterator \sa ConstShapedNeighborhoodIterator |
| 43 |
|
* \sa ConstSliceIterator \sa CorrespondenceDataStructureIterator |
| 44 |
|
* \sa FloodFilledFunctionConditionalConstIterator |
| 45 |
|
* \sa FloodFilledImageFunctionConditionalConstIterator |
| 46 |
|
* \sa FloodFilledImageFunctionConditionalIterator |
| 47 |
|
* \sa FloodFilledSpatialFunctionConditionalConstIterator |
| 48 |
|
* \sa FloodFilledSpatialFunctionConditionalIterator |
| 49 |
|
* \sa ImageConstIterator \sa ImageConstIteratorWithIndex |
| 50 |
|
* \sa ImageIterator \sa ImageIteratorWithIndex |
| 51 |
|
* \sa ImageLinearConstIteratorWithIndex \sa ImageLinearIteratorWithIndex |
| 52 |
|
* \sa ImageRandomConstIteratorWithIndex \sa ImageRandomIteratorWithIndex |
| 53 |
|
* \sa ImageRegionConstIterator \sa ImageRegionConstIteratorWithIndex |
| 54 |
|
* \sa ImageRegionExclusionConstIteratorWithIndex |
| 55 |
|
* \sa ImageRegionExclusionIteratorWithIndex |
| 56 |
|
* \sa ImageRegionIterator \sa ImageRegionIteratorWithIndex |
| 57 |
|
* \sa ImageRegionReverseConstIterator \sa ImageRegionReverseIterator |
| 58 |
|
* \sa ImageReverseConstIterator \sa ImageReverseIterator |
| 59 |
|
* \sa ImageSliceConstIteratorWithIndex \sa ImageSliceIteratorWithIndex |
| 60 |
|
* \sa NeighborhoodIterator \sa PathConstIterator \sa PathIterator |
| 61 |
|
* \sa ShapedNeighborhoodIterator \sa SliceIterator |
| 62 |
|
* \sa ImageConstIteratorWithIndex */ |
| 63 |
|
template<typename TImage> |
| 64 |
LEN |
class ITK_EXPORT ImageRandomIteratorWithIndex : public ImageRandomConstIteratorWithIndex<TImage> |
| 65 |
|
{ |
| 66 |
|
public: |
| 67 |
|
/** Standard class typedefs. */ |
| 68 |
|
typedef ImageRandomIteratorWithIndex Self; |
| 69 |
TDA |
typedef ImageRandomConstIteratorWithIndex<TImage> Superclass; |
| 70 |
|
|
| 71 |
IND |
***/** Types inherited from the Superclass */ |
| 72 |
|
typedef typename Superclass::IndexType IndexType; |
| 73 |
|
typedef typename Superclass::IndexValueType IndexValueType; |
| 74 |
|
typedef typename Superclass::SizeType SizeType; |
| 75 |
|
typedef typename Superclass::SizeValueType SizeValueType; |
| 76 |
|
typedef typename Superclass::OffsetType OffsetType; |
| 77 |
|
typedef typename Superclass::OffsetValueType OffsetValueType; |
| 78 |
|
typedef typename Superclass::RegionType RegionType; |
| 79 |
|
typedef typename Superclass::ImageType ImageType; |
| 80 |
|
typedef typename Superclass::PixelContainer PixelContainer; |
| 81 |
|
typedef typename Superclass::PixelContainerPointer PixelContainerPointer; |
| 82 |
|
typedef typename Superclass::InternalPixelType InternalPixelType; |
| 83 |
|
typedef typename Superclass::PixelType PixelType; |
| 84 |
|
typedef typename Superclass::AccessorType AccessorType; |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
/** Default constructor. Needed since we provide a cast constructor. */ |
| 88 |
|
ImageRandomIteratorWithIndex(); |
| 89 |
|
|
| 90 |
|
/** Constructor establishes an iterator to walk a particular image and a |
| 91 |
|
* particular region of that image. */ |
| 92 |
|
ImageRandomIteratorWithIndex(ImageType *ptr, const RegionType& region); |
| 93 |
|
|
| 94 |
|
/** Constructor that can be used to cast from an ImageIterator to an |
| 95 |
LEN |
* ImageRandomIteratorWithIndex. Many routines return an ImageIterator but for a |
| 96 |
|
* particular task, you may want an ImageRandomIteratorWithIndex. Rather than |
| 97 |
|
* provide overloaded APIs that return different types of Iterators, itk |
| 98 |
|
* returns ImageIterators and uses constructors to cast from an |
| 99 |
|
* ImageIterator to a ImageRandomIteratorWithIndex. */ |
| 100 |
|
ImageRandomIteratorWithIndex( const ImageIteratorWithIndex<TImage> &it); |
| 101 |
|
|
| 102 |
|
/** Set the pixel value */ |
| 103 |
|
void Set( const PixelType & value) const |
| 104 |
LEN |
{ this->m_PixelAccessorFunctor.Set(*(const_cast<InternalPixelType *>(this->m_Position)),value); } |
| 105 |
|
|
| 106 |
|
/** Return a reference to the pixel |
| 107 |
|
* This method will provide the fastest access to pixel |
| 108 |
|
* data, but it will NOT support ImageAdaptors. */ |
| 109 |
|
PixelType & Value(void) |
| 110 |
|
{ return *(const_cast<InternalPixelType *>(this->m_Position)); } |
| 111 |
|
|
| 112 |
|
protected: |
| 113 |
|
/** the construction from a const iterator is declared protected |
| 114 |
IND |
******in order to enforce const correctness. */ |
| 115 |
LEN |
ImageRandomIteratorWithIndex( const ImageRandomConstIteratorWithIndex<TImage> &it); |
| 116 |
|
Self & operator=(const ImageRandomConstIteratorWithIndex<TImage> & it); |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
}; |
| 120 |
|
|
| 121 |
|
} // end namespace itk |
| 122 |
|
|
| 123 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 124 |
|
#include "itkImageRandomIteratorWithIndex.txx" |
| 125 |
|
#endif |
| 126 |
|
|
| 127 |
|
#endif |
| 128 |
|
|
| 129 |
EOF |
|
| 130 |
EOF,EML |
|
| 131 |
EOF,EML |
|