| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkFloodFilledSpatialFunctionConditionalIterator.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:35 $ |
| 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 __itkFloodFilledSpatialFunctionConditionalIterator_h |
| 18 |
|
#define __itkFloodFilledSpatialFunctionConditionalIterator_h |
| 19 |
|
|
| 20 |
|
#include "itkFloodFilledSpatialFunctionConditionalConstIterator.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
|
* \class FloodFilledSpatialFunctionConditionalIterator |
| 27 |
|
* \brief Iterates over a flood-filled spatial function. |
| 28 |
|
* |
| 29 |
|
* \ingroup ImageIterators |
| 30 |
|
* |
| 31 |
|
*/ |
| 32 |
|
template<class TImage, class TFunction> |
| 33 |
LEN |
class ITK_EXPORT FloodFilledSpatialFunctionConditionalIterator: public FloodFilledSpatialFunctionConditionalConstIterator<TImage, TFunction> |
| 34 |
|
{ |
| 35 |
|
public: |
| 36 |
|
/** Standard class typedefs. */ |
| 37 |
|
typedef FloodFilledSpatialFunctionConditionalIterator Self; |
| 38 |
LEN,TDA |
typedef FloodFilledSpatialFunctionConditionalConstIterator<TImage, TFunction> Superclass; |
| 39 |
|
|
| 40 |
|
/** Type of function */ |
| 41 |
|
typedef typename Superclass::FunctionType FunctionType; |
| 42 |
|
|
| 43 |
|
/** Type of vector used to store location info in the spatial function */ |
| 44 |
|
typedef typename Superclass::FunctionInputType FunctionInputType; |
| 45 |
|
|
| 46 |
|
/** Index typedef support. */ |
| 47 |
|
typedef typename Superclass::IndexType IndexType; |
| 48 |
|
|
| 49 |
|
/** Size typedef support. */ |
| 50 |
|
typedef typename Superclass::SizeType SizeType; |
| 51 |
|
|
| 52 |
|
/** Region typedef support */ |
| 53 |
|
typedef typename Superclass::RegionType RegionType; |
| 54 |
|
|
| 55 |
|
/** Image typedef support. */ |
| 56 |
|
typedef typename Superclass::ImageType ImageType; |
| 57 |
|
|
| 58 |
|
/** Internal Pixel Type */ |
| 59 |
|
typedef typename Superclass::InternalPixelType InternalPixelType; |
| 60 |
|
|
| 61 |
|
/** External Pixel Type */ |
| 62 |
|
typedef typename Superclass::PixelType PixelType; |
| 63 |
|
|
| 64 |
|
/** Constructor establishes an iterator to walk a particular image and a |
| 65 |
|
* particular region of that image. This version of the constructor uses |
| 66 |
|
* an explicit seed pixel for the flood fill, the "startIndex" */ |
| 67 |
|
FloodFilledSpatialFunctionConditionalIterator(ImageType *imagePtr, |
| 68 |
|
FunctionType *fnPtr, |
| 69 |
LEN |
IndexType startIndex): Superclass(imagePtr, fnPtr, startIndex) {} |
| 70 |
|
|
| 71 |
|
/** Constructor establishes an iterator to walk a particular image and a |
| 72 |
|
* particular region of that image. This version of the constructor |
| 73 |
|
* should be used when the seed pixel is unknown. */ |
| 74 |
|
FloodFilledSpatialFunctionConditionalIterator(ImageType *imagePtr, |
| 75 |
LEN |
FunctionType *fnPtr): Superclass(imagePtr, fnPtr) {} |
| 76 |
|
|
| 77 |
|
/** Get the pixel value, const version to avoid overload warnings */ |
| 78 |
|
const PixelType & Get(void) const |
| 79 |
LEN |
{ return const_cast<ImageType *>(this->m_Image.GetPointer())->GetPixel(this->m_IndexStack.front() ); } |
| 80 |
|
|
| 81 |
|
/** Get the pixel value, non-const version is sometimes useful*/ |
| 82 |
|
PixelType & Get(void) |
| 83 |
LEN |
{ return const_cast<ImageType *>(this->m_Image.GetPointer())->GetPixel(this->m_IndexStack.front() ); } |
| 84 |
|
|
| 85 |
|
/** Set the pixel value */ |
| 86 |
|
void Set( const PixelType & value) |
| 87 |
LEN |
{ const_cast<ImageType *>(this->m_Image.GetPointer())->GetPixel(this->m_IndexStack.front() ) = value; } |
| 88 |
|
|
| 89 |
|
/** Default Destructor. */ |
| 90 |
|
virtual ~FloodFilledSpatialFunctionConditionalIterator() {}; |
| 91 |
|
}; |
| 92 |
|
|
| 93 |
|
} // end namespace itk |
| 94 |
|
|
| 95 |
|
#endif |
| 96 |
|
|