13 #ifndef itkAdaptiveThresholdIterator_h
14 #define itkAdaptiveThresholdIterator_h
16 #include <itkConditionalConstIterator.h>
33 template <
class TImage,
class TFunction>
130 m_FineDetectionMode = fine;
131 m_DetectionStop =
false;
140 return (*m_QueueMap.find(m_RegionGrowingState)).second.front();
146 return const_cast<ImageType *
>(this->m_Image.GetPointer())
147 ->GetPixel((*m_QueueMap.find(m_RegionGrowingState)).second.front());
153 const_cast<ImageType *
>(this->m_Image.GetPointer())
154 ->GetPixel((*m_QueueMap.find(m_RegionGrowingState)).second.front()) = value;
161 bool IsAtEnd()
const override {
return this->m_IsAtEnd; };
172 this->m_Image = it.m_Image;
173 this->m_Region = it.m_Region;
175 this->m_RegionGrowingState = it.m_RegionGrowingState;
176 this->m_MinTH = it.m_MinTH;
177 this->m_MaxTH = it.m_MaxTH;
178 this->m_SeedPointValue = it.m_SeedPointValue;
179 this->m_VoxelCounter = it.m_VoxelCounter;
180 this->m_LastVoxelNumber = it.m_LastVoxelNumber;
181 this->m_DetectedLeakagePoint = it.m_DetectedLeakagePoint;
182 this->m_CurrentLeakageRatio = it.m_CurrentLeakageRatio;
236 void InsertIndexTypeIntoQueueMap(
unsigned int key,
IndexType index);
238 int m_RegionGrowingState;
246 int m_SeedPointValue;
248 unsigned int m_VoxelCounter;
249 unsigned int m_LastVoxelNumber;
251 int m_DetectedLeakagePoint;
252 float m_CurrentLeakageRatio;
254 void CheckSeedPointValue();
259 bool m_FineDetectionMode;
260 bool m_DetectionStop;
264 #ifndef ITK_MANUAL_INSTANTIATION
265 #include <itkAdaptiveThresholdIterator.tpp>
Iterates over an image using a variable image function, which threshold can be varied during the iter...
TImage::InternalPixelType InternalPixelType
void SetExpansionDirection(bool upwards)
Set the expansion direction for adaptive thresholding.
unsigned int CalculateMaxRGS()
Calculate the maximum number of region growing expansion steps.
bool IsAtEnd() const override
Check whether the iterator has reached the end of the region.
int GetSeedPointValue(void)
Get the pixel value at the seed point.
void SetFineDetectionMode(bool fine=false)
TTempImage::Pointer tempPtr
void IncrementRegionGrowingState()
Increment the region growing state counter.
TFunction::InputType FunctionInputType
itkStaticConstMacro(NDimensions, unsigned int, TImage::ImageDimension)
SmartPointer< FunctionType > m_Function
AdaptiveThresholdIterator(ImageType *imagePtr, FunctionType *fnPtr, IndexType startIndex)
TImage::SizeType SizeType
void operator++() override
Walk forward one index by performing an extended flood step.
std::map< unsigned int, IndexQueueType > QueueMapType
SmartPointer< ImageType > m_OutputImage
Pointer to the output image to which the result shall be written.
TImage::IndexType IndexType
int GetLeakagePoint(void)
Get the detected leakage point in the region growing state space.
void ExpandThresholdUpwards()
Expand the threshold range upwards by one step.
void DoExtendedFloodStep()
Advance the iterator by one step of the extended flood fill.
void ExpandThresholdDownwards()
Expand the threshold range downwards by one step.
AdaptiveThresholdIterator(ImageType *imagePtr, FunctionType *fnPtr, std::vector< IndexType > &startIndex)
void InitializeIterator()
Initialize the iterator, called from constructor.
TImage::RegionType RegionType
void SetMinTH(int min)
Set the minimum threshold value.
bool IsPixelIncluded(const IndexType &index) const override
Compute whether the pixel at the given index should be included in the flood fill.
void Set(const PixelType &value)
Set the pixel value at the current iterator position.
void GoToBegin()
Reset the iterator to the beginning.
static int CalculateInitializeValue(int lower, int upper)
Calculate the initialization value for the output image based on threshold range.
std::vector< IndexType > m_StartIndices
const PixelType Get(void) const override
Get the pixel value at the current iterator position.
ImageType::SpacingType m_ImageSpacing
ImageType::PointType m_ImageOrigin
std::queue< IndexType > IndexQueueType
~AdaptiveThresholdIterator() override
Default Destructor.
void SetMaxTH(int max)
Set the maximum threshold value.
int EstimateDistance(IndexType)
Estimate the distance (in expansion steps) of a voxel from the current state.
AdaptiveThresholdIterator Self
Self & operator=(const Self &it)
TImage::PixelType PixelType
const IndexType GetIndex() override
void InitRegionGrowingState()
Initialize the region growing state machine.
virtual SmartPointer< FunctionType > GetFunction() const
Get the function used for threshold evaluation.
ConditionalConstIterator< TImage > Superclass
AdaptiveThresholdIterator(ImageType *imagePtr, FunctionType *fnPtr)