| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
LEN |
Module: $RCSfile: itkFloodFilledSpatialFunctionConditionalConstIterator.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 __itkFloodFilledSpatialFunctionConditionalConstIterator_h |
| 18 |
|
#define __itkFloodFilledSpatialFunctionConditionalConstIterator_h |
| 19 |
|
|
| 20 |
|
#include "itkFloodFilledFunctionConditionalConstIterator.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
|
* \class FloodFilledSpatialFunctionConditionalConstIterator |
| 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 FloodFilledSpatialFunctionConditionalConstIterator: public FloodFilledFunctionConditionalConstIterator<TImage, TFunction> |
| 34 |
|
{ |
| 35 |
|
public: |
| 36 |
|
/** Standard class typedefs. */ |
| 37 |
|
typedef FloodFilledSpatialFunctionConditionalConstIterator Self; |
| 38 |
LEN,TDA |
typedef FloodFilledFunctionConditionalConstIterator<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 |
|
FloodFilledSpatialFunctionConditionalConstIterator(const ImageType *imagePtr, |
| 68 |
|
FunctionType *fnPtr, |
| 69 |
|
IndexType 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 |
|
FloodFilledSpatialFunctionConditionalConstIterator(const ImageType *imagePtr, |
| 75 |
|
FunctionType *fnPtr); |
| 76 |
|
/** Default Destructor. */ |
| 77 |
|
virtual ~FloodFilledSpatialFunctionConditionalConstIterator() {}; |
| 78 |
|
|
| 79 |
|
/** Compute whether the index of interest should be included in the flood */ |
| 80 |
|
bool IsPixelIncluded(const IndexType & index) const; |
| 81 |
|
|
| 82 |
|
/** Set the inclusion strategy to origin */ |
| 83 |
|
void SetOriginInclusionStrategy() { m_InclusionStrategy = 0; } |
| 84 |
|
|
| 85 |
|
/** Set the inclusion strategy to center */ |
| 86 |
|
void SetCenterInclusionStrategy() { m_InclusionStrategy = 1; } |
| 87 |
|
|
| 88 |
|
/** Set the inclusion strategy to complete */ |
| 89 |
|
void SetCompleteInclusionStrategy() { m_InclusionStrategy = 2; } |
| 90 |
|
|
| 91 |
|
/** Set the inclusion strategy to intersect */ |
| 92 |
|
void SetIntersectInclusionStrategy() { m_InclusionStrategy = 3; } |
| 93 |
|
|
| 94 |
|
protected: //made protected so other iterators can access |
| 95 |
|
|
| 96 |
IND |
****/** How the pixel (index) is examined in order to decide whether or not |
| 97 |
|
* it's included. The strategies are: |
| 98 |
LEN |
* 0) Origin: if the origin of the pixel in physical space is inside the function, |
| 99 |
|
* then the pixel is inside the function |
| 100 |
LEN |
* 1) Center: if the center of a pixel, in physical space, is inside the function, |
| 101 |
|
* then the pixel is inside the function |
| 102 |
LEN |
* 2) Complete: if all of the corners of the pixel in physical space are inside the function, |
| 103 |
|
* then the pixel is inside the function |
| 104 |
LEN |
* 3) Intersect: if any of the corners of the pixel in physical space are inside the function, |
| 105 |
|
* then the pixel is inside the function */ |
| 106 |
|
|
| 107 |
|
unsigned char m_InclusionStrategy; |
| 108 |
|
|
| 109 |
|
}; |
| 110 |
|
|
| 111 |
|
} // end namespace itk |
| 112 |
|
|
| 113 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 114 |
|
#include "itkFloodFilledSpatialFunctionConditionalConstIterator.txx" |
| 115 |
|
#endif |
| 116 |
|
|
| 117 |
|
#endif |
| 118 |
|
|