Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itk::AdaptiveThresholdIterator< TImage, TFunction > Class Template Reference

Iterates over an image using a variable image function, which threshold can be varied during the iteration process. More...

#include <itkAdaptiveThresholdIterator.h>

Inheritance diagram for itk::AdaptiveThresholdIterator< TImage, TFunction >:
Collaboration diagram for itk::AdaptiveThresholdIterator< TImage, TFunction >:

Public Types

typedef AdaptiveThresholdIterator Self
 
typedef ConditionalConstIterator< TImage > Superclass
 
typedef TImage ImageType
 
typedef TImage TTempImage
 
typedef TFunction FunctionType
 
typedef TFunction::InputType FunctionInputType
 
typedef TImage::SizeType SizeType
 
typedef TImage::RegionType RegionType
 
typedef TImage::IndexType IndexType
 
typedef TImage::InternalPixelType InternalPixelType
 
typedef TImage::PixelType PixelType
 
typedef std::queue< IndexType > IndexQueueType
 
typedef std::map< unsigned int, IndexQueueType > QueueMapType
 

Public Member Functions

 itkStaticConstMacro (NDimensions, unsigned int, TImage::ImageDimension)
 
 AdaptiveThresholdIterator (ImageType *imagePtr, FunctionType *fnPtr, IndexType startIndex)
 
 AdaptiveThresholdIterator (ImageType *imagePtr, FunctionType *fnPtr, std::vector< IndexType > &startIndex)
 
 AdaptiveThresholdIterator (ImageType *imagePtr, FunctionType *fnPtr)
 
 ~AdaptiveThresholdIterator () override
 Default Destructor. More...
 
void InitializeIterator ()
 Initialize the iterator, called from constructor. More...
 
void DoExtendedFloodStep ()
 Advance the iterator by one step of the extended flood fill. More...
 
void SetExpansionDirection (bool upwards)
 Set the expansion direction for adaptive thresholding. More...
 
void InitRegionGrowingState ()
 Initialize the region growing state machine. More...
 
void SetMinTH (int min)
 Set the minimum threshold value. More...
 
void SetMaxTH (int max)
 Set the maximum threshold value. More...
 
int GetSeedPointValue (void)
 Get the pixel value at the seed point. More...
 
void SetFineDetectionMode (bool fine=false)
 
const IndexType GetIndex () override
 
const PixelType Get (void) const override
 Get the pixel value at the current iterator position. More...
 
void Set (const PixelType &value)
 Set the pixel value at the current iterator position. More...
 
void GoToBegin ()
 Reset the iterator to the beginning. More...
 
bool IsAtEnd () const override
 Check whether the iterator has reached the end of the region. More...
 
void operator++ () override
 Walk forward one index by performing an extended flood step. More...
 
virtual SmartPointer< FunctionType > GetFunction () const
 Get the function used for threshold evaluation. More...
 
Self & operator= (const Self &it)
 
bool IsPixelIncluded (const IndexType &index) const override
 Compute whether the pixel at the given index should be included in the flood fill. More...
 
int GetLeakagePoint (void)
 Get the detected leakage point in the region growing state space. More...
 

Static Public Member Functions

static int CalculateInitializeValue (int lower, int upper)
 Calculate the initialization value for the output image based on threshold range. More...
 

Public Attributes

TTempImage::Pointer tempPtr
 

Protected Member Functions

void ExpandThresholdUpwards ()
 Expand the threshold range upwards by one step. More...
 
void ExpandThresholdDownwards ()
 Expand the threshold range downwards by one step. More...
 
void IncrementRegionGrowingState ()
 Increment the region growing state counter. More...
 
int EstimateDistance (IndexType)
 Estimate the distance (in expansion steps) of a voxel from the current state. More...
 
unsigned int CalculateMaxRGS ()
 Calculate the maximum number of region growing expansion steps. More...
 

Protected Attributes

SmartPointer< ImageType > m_OutputImage
 Pointer to the output image to which the result shall be written. More...
 
SmartPointer< FunctionType > m_Function
 
std::vector< IndexType > m_StartIndices
 
ImageType::PointType m_ImageOrigin
 
ImageType::SpacingType m_ImageSpacing
 
RegionType m_ImageRegion
 
bool m_UpwardsExpansion
 
int m_InitializeValue
 

Detailed Description

template<class TImage, class TFunction>
class itk::AdaptiveThresholdIterator< TImage, TFunction >

Iterates over an image using a variable image function, which threshold can be varied during the iteration process.

Definition at line 34 of file itkAdaptiveThresholdIterator.h.

Member Typedef Documentation

◆ FunctionInputType

template<class TImage , class TFunction >
typedef TFunction::InputType itk::AdaptiveThresholdIterator< TImage, TFunction >::FunctionInputType

Type of vector used to store location info in the spatial function

Definition at line 54 of file itkAdaptiveThresholdIterator.h.

◆ FunctionType

template<class TImage , class TFunction >
typedef TFunction itk::AdaptiveThresholdIterator< TImage, TFunction >::FunctionType

Type of function

Definition at line 51 of file itkAdaptiveThresholdIterator.h.

◆ ImageType

template<class TImage , class TFunction >
typedef TImage itk::AdaptiveThresholdIterator< TImage, TFunction >::ImageType

Definition at line 42 of file itkAdaptiveThresholdIterator.h.

◆ IndexQueueType

template<class TImage , class TFunction >
typedef std::queue<IndexType> itk::AdaptiveThresholdIterator< TImage, TFunction >::IndexQueueType

Queue containing indices representing a voxel position

Definition at line 71 of file itkAdaptiveThresholdIterator.h.

◆ IndexType

template<class TImage , class TFunction >
typedef TImage::IndexType itk::AdaptiveThresholdIterator< TImage, TFunction >::IndexType

Definition at line 62 of file itkAdaptiveThresholdIterator.h.

◆ InternalPixelType

template<class TImage , class TFunction >
typedef TImage::InternalPixelType itk::AdaptiveThresholdIterator< TImage, TFunction >::InternalPixelType

Internal Pixel Type

Definition at line 65 of file itkAdaptiveThresholdIterator.h.

◆ PixelType

template<class TImage , class TFunction >
typedef TImage::PixelType itk::AdaptiveThresholdIterator< TImage, TFunction >::PixelType

External Pixel Type

Definition at line 68 of file itkAdaptiveThresholdIterator.h.

◆ QueueMapType

template<class TImage , class TFunction >
typedef std::map<unsigned int, IndexQueueType> itk::AdaptiveThresholdIterator< TImage, TFunction >::QueueMapType

Map used to generate the output result

Definition at line 74 of file itkAdaptiveThresholdIterator.h.

◆ RegionType

template<class TImage , class TFunction >
typedef TImage::RegionType itk::AdaptiveThresholdIterator< TImage, TFunction >::RegionType

Region typedef support

Definition at line 60 of file itkAdaptiveThresholdIterator.h.

◆ Self

template<class TImage , class TFunction >
typedef AdaptiveThresholdIterator itk::AdaptiveThresholdIterator< TImage, TFunction >::Self

Standard class typedefs.

Definition at line 38 of file itkAdaptiveThresholdIterator.h.

◆ SizeType

template<class TImage , class TFunction >
typedef TImage::SizeType itk::AdaptiveThresholdIterator< TImage, TFunction >::SizeType

Size typedef support.

Definition at line 57 of file itkAdaptiveThresholdIterator.h.

◆ Superclass

template<class TImage , class TFunction >
typedef ConditionalConstIterator<TImage> itk::AdaptiveThresholdIterator< TImage, TFunction >::Superclass

Definition at line 40 of file itkAdaptiveThresholdIterator.h.

◆ TTempImage

template<class TImage , class TFunction >
typedef TImage itk::AdaptiveThresholdIterator< TImage, TFunction >::TTempImage

Definition at line 45 of file itkAdaptiveThresholdIterator.h.

Constructor & Destructor Documentation

◆ AdaptiveThresholdIterator() [1/3]

template<class TImage , class TFunction >
itk::AdaptiveThresholdIterator< TImage, TFunction >::AdaptiveThresholdIterator ( ImageType *  imagePtr,
FunctionType *  fnPtr,
IndexType  startIndex 
)

Constructor establishes an iterator to walk a particular image and a particular region of that image. This version of the constructor uses an explicit seed pixel for the flood fill, the "startIndex"

◆ AdaptiveThresholdIterator() [2/3]

template<class TImage , class TFunction >
itk::AdaptiveThresholdIterator< TImage, TFunction >::AdaptiveThresholdIterator ( ImageType *  imagePtr,
FunctionType *  fnPtr,
std::vector< IndexType > &  startIndex 
)

Constructor establishes an iterator to walk a particular image and a particular region of that image. This version of the constructor uses an explicit list of seed pixels for the flood fill, the "startIndex"

◆ AdaptiveThresholdIterator() [3/3]

template<class TImage , class TFunction >
itk::AdaptiveThresholdIterator< TImage, TFunction >::AdaptiveThresholdIterator ( ImageType *  imagePtr,
FunctionType *  fnPtr 
)

Constructor establishes an iterator to walk a particular image and a particular region of that image. This version of the constructor should be used when the seed pixel is unknown

◆ ~AdaptiveThresholdIterator()

template<class TImage , class TFunction >
itk::AdaptiveThresholdIterator< TImage, TFunction >::~AdaptiveThresholdIterator ( )
inlineoverride

Default Destructor.

Definition at line 98 of file itkAdaptiveThresholdIterator.h.

Member Function Documentation

◆ CalculateInitializeValue()

template<class TImage , class TFunction >
static int itk::AdaptiveThresholdIterator< TImage, TFunction >::CalculateInitializeValue ( int  lower,
int  upper 
)
inlinestatic

Calculate the initialization value for the output image based on threshold range.

Parameters
lowerThe lower threshold.
upperThe upper threshold.
Returns
The initialization value.

Definition at line 194 of file itkAdaptiveThresholdIterator.h.

◆ CalculateMaxRGS()

template<class TImage , class TFunction >
unsigned int itk::AdaptiveThresholdIterator< TImage, TFunction >::CalculateMaxRGS ( )
protected

Calculate the maximum number of region growing expansion steps.

◆ DoExtendedFloodStep()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::DoExtendedFloodStep ( )

Advance the iterator by one step of the extended flood fill.

◆ EstimateDistance()

template<class TImage , class TFunction >
int itk::AdaptiveThresholdIterator< TImage, TFunction >::EstimateDistance ( IndexType  )
protected

Estimate the distance (in expansion steps) of a voxel from the current state.

◆ ExpandThresholdDownwards()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::ExpandThresholdDownwards ( )
protected

Expand the threshold range downwards by one step.

◆ ExpandThresholdUpwards()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::ExpandThresholdUpwards ( )
protected

Expand the threshold range upwards by one step.

◆ Get()

template<class TImage , class TFunction >
const PixelType itk::AdaptiveThresholdIterator< TImage, TFunction >::Get ( void  ) const
inlineoverride

Get the pixel value at the current iterator position.

Definition at line 144 of file itkAdaptiveThresholdIterator.h.

◆ GetFunction()

template<class TImage , class TFunction >
virtual SmartPointer<FunctionType> itk::AdaptiveThresholdIterator< TImage, TFunction >::GetFunction ( ) const
inlinevirtual

Get the function used for threshold evaluation.

Definition at line 167 of file itkAdaptiveThresholdIterator.h.

◆ GetIndex()

template<class TImage , class TFunction >
const IndexType itk::AdaptiveThresholdIterator< TImage, TFunction >::GetIndex ( )
inlineoverride

Get the index. This provides a read only reference to the index. This causes the index to be calculated from pointer arithmetic and is therefore an expensive operation.

See also
SetIndex

Definition at line 138 of file itkAdaptiveThresholdIterator.h.

◆ GetLeakagePoint()

template<class TImage , class TFunction >
int itk::AdaptiveThresholdIterator< TImage, TFunction >::GetLeakagePoint ( void  )
inline

Get the detected leakage point in the region growing state space.

Definition at line 197 of file itkAdaptiveThresholdIterator.h.

◆ GetSeedPointValue()

template<class TImage , class TFunction >
int itk::AdaptiveThresholdIterator< TImage, TFunction >::GetSeedPointValue ( void  )

Get the pixel value at the seed point.

◆ GoToBegin()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::GoToBegin ( )

Reset the iterator to the beginning.

◆ IncrementRegionGrowingState()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::IncrementRegionGrowingState ( )
protected

Increment the region growing state counter.

◆ InitializeIterator()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::InitializeIterator ( )

Initialize the iterator, called from constructor.

◆ InitRegionGrowingState()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::InitRegionGrowingState ( )

Initialize the region growing state machine.

◆ IsAtEnd()

template<class TImage , class TFunction >
bool itk::AdaptiveThresholdIterator< TImage, TFunction >::IsAtEnd ( ) const
inlineoverride

Check whether the iterator has reached the end of the region.

Definition at line 161 of file itkAdaptiveThresholdIterator.h.

◆ IsPixelIncluded()

template<class TImage , class TFunction >
bool itk::AdaptiveThresholdIterator< TImage, TFunction >::IsPixelIncluded ( const IndexType &  index) const
override

Compute whether the pixel at the given index should be included in the flood fill.

◆ itkStaticConstMacro()

template<class TImage , class TFunction >
itk::AdaptiveThresholdIterator< TImage, TFunction >::itkStaticConstMacro ( NDimensions  ,
unsigned int  ,
TImage::ImageDimension   
)

Dimension of the image the iterator walks. This constant is needed so that functions that are templated over image iterator type (as opposed to being templated over pixel type and dimension) can have compile time access to the dimension of the image that the iterator walks.

◆ operator++()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::operator++ ( )
inlineoverride

Walk forward one index by performing an extended flood step.

Definition at line 164 of file itkAdaptiveThresholdIterator.h.

◆ operator=()

template<class TImage , class TFunction >
Self& itk::AdaptiveThresholdIterator< TImage, TFunction >::operator= ( const Self &  it)
inline

operator= is provided to make sure the handle to the image is properly reference counted.

Definition at line 170 of file itkAdaptiveThresholdIterator.h.

References itk::AdaptiveThresholdIterator< TImage, TFunction >::m_InitializeValue.

◆ Set()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::Set ( const PixelType &  value)
inline

Set the pixel value at the current iterator position.

Definition at line 151 of file itkAdaptiveThresholdIterator.h.

◆ SetExpansionDirection()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::SetExpansionDirection ( bool  upwards)

Set the expansion direction for adaptive thresholding.

Parameters
upwardsIf true, threshold expands upwards; otherwise downwards.

◆ SetFineDetectionMode()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::SetFineDetectionMode ( bool  fine = false)
inline

switch between fine and raw leakage detection

Definition at line 128 of file itkAdaptiveThresholdIterator.h.

◆ SetMaxTH()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::SetMaxTH ( int  max)

Set the maximum threshold value.

Parameters
maxThe maximum threshold.

◆ SetMinTH()

template<class TImage , class TFunction >
void itk::AdaptiveThresholdIterator< TImage, TFunction >::SetMinTH ( int  min)

Set the minimum threshold value.

Parameters
minThe minimum threshold.

Member Data Documentation

◆ m_Function

template<class TImage , class TFunction >
SmartPointer<FunctionType> itk::AdaptiveThresholdIterator< TImage, TFunction >::m_Function
protected

Definition at line 202 of file itkAdaptiveThresholdIterator.h.

◆ m_ImageOrigin

template<class TImage , class TFunction >
ImageType::PointType itk::AdaptiveThresholdIterator< TImage, TFunction >::m_ImageOrigin
protected

The origin of the source image

Definition at line 208 of file itkAdaptiveThresholdIterator.h.

◆ m_ImageRegion

template<class TImage , class TFunction >
RegionType itk::AdaptiveThresholdIterator< TImage, TFunction >::m_ImageRegion
protected

Region of the source image

Definition at line 214 of file itkAdaptiveThresholdIterator.h.

◆ m_ImageSpacing

template<class TImage , class TFunction >
ImageType::SpacingType itk::AdaptiveThresholdIterator< TImage, TFunction >::m_ImageSpacing
protected

The spacing of the source image

Definition at line 211 of file itkAdaptiveThresholdIterator.h.

◆ m_InitializeValue

template<class TImage , class TFunction >
int itk::AdaptiveThresholdIterator< TImage, TFunction >::m_InitializeValue
protected

◆ m_OutputImage

template<class TImage , class TFunction >
SmartPointer<ImageType> itk::AdaptiveThresholdIterator< TImage, TFunction >::m_OutputImage
protected

Pointer to the output image to which the result shall be written.

Definition at line 200 of file itkAdaptiveThresholdIterator.h.

◆ m_StartIndices

template<class TImage , class TFunction >
std::vector<IndexType> itk::AdaptiveThresholdIterator< TImage, TFunction >::m_StartIndices
protected

A list of locations to start the recursive fill

Definition at line 205 of file itkAdaptiveThresholdIterator.h.

◆ m_UpwardsExpansion

template<class TImage , class TFunction >
bool itk::AdaptiveThresholdIterator< TImage, TFunction >::m_UpwardsExpansion
protected

Definition at line 216 of file itkAdaptiveThresholdIterator.h.

◆ tempPtr

template<class TImage , class TFunction >
TTempImage::Pointer itk::AdaptiveThresholdIterator< TImage, TFunction >::tempPtr

Definition at line 47 of file itkAdaptiveThresholdIterator.h.


The documentation for this class was generated from the following file: