ITK  5.2.0
Insight Toolkit
Public Types | List of all members
itk::OtsuMultipleThresholdsCalculator< TInputHistogram > Class Template Reference

#include <itkOtsuMultipleThresholdsCalculator.h>

+ Inheritance diagram for itk::OtsuMultipleThresholdsCalculator< TInputHistogram >:
+ Collaboration diagram for itk::OtsuMultipleThresholdsCalculator< TInputHistogram >:

Public Types

using ConstPointer = SmartPointer< const Self >
 
using FrequencyType = typename TInputHistogram::AbsoluteFrequencyType
 
using FrequencyVectorType = std::vector< FrequencyType >
 
using InstanceIdentifierType = typename TInputHistogram::InstanceIdentifier
 
using InstanceIdentifierVectorType = std::vector< InstanceIdentifierType >
 
using MeanType = typename NumericTraits< MeasurementType >::RealType
 
using MeanVectorType = std::vector< MeanType >
 
using MeasurementType = typename TInputHistogram::MeasurementType
 
using Pointer = SmartPointer< Self >
 
using Self = OtsuMultipleThresholdsCalculator
 
using Superclass = HistogramAlgorithmBase< TInputHistogram >
 
using VarianceType = typename NumericTraits< MeasurementType >::RealType
 
using WeightType = typename NumericTraits< MeasurementType >::RealType
 
using WeightVectorType = std::vector< WeightType >
 
- Public Types inherited from itk::HistogramAlgorithmBase< TInputHistogram >
using ConstPointer = SmartPointer< const Self >
 
using InputHistogramType = TInputHistogram
 
using Pointer = SmartPointer< Self >
 
using Self = HistogramAlgorithmBase
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 
using OutputType = std::vector< MeasurementType >
 
SizeValueType m_NumberOfThresholds { 1 }
 
OutputType m_Output
 
bool m_ValleyEmphasis { false }
 
bool m_ReturnBinMidpoint { false }
 
virtual const char * GetNameOfClass () const
 
virtual ::itk::LightObject::Pointer CreateAnother () const
 
const OutputTypeGetOutput ()
 
virtual void SetNumberOfThresholds (SizeValueType _arg)
 
virtual SizeValueType GetNumberOfThresholds () const
 
void Compute () override
 
virtual void SetValleyEmphasis (bool _arg)
 
virtual const bool & GetValleyEmphasis () const
 
virtual void ValleyEmphasisOn ()
 
virtual void ValleyEmphasisOff ()
 
virtual void SetReturnBinMidpoint (bool _arg)
 
virtual const bool & GetReturnBinMidpoint () const
 
virtual void ReturnBinMidpointOn ()
 
virtual void ReturnBinMidpointOff ()
 
static Pointer New ()
 
 OtsuMultipleThresholdsCalculator ()
 
 ~OtsuMultipleThresholdsCalculator () override=default
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
bool IncrementThresholds (InstanceIdentifierVectorType &thresholdIndexes, MeanType globalMean, MeanVectorType &classMean, FrequencyVectorType &classFrequency)
 

Additional Inherited Members

- Public Member Functions inherited from itk::HistogramAlgorithmBase< TInputHistogram >
void SetInputHistogram (const TInputHistogram *histogram)
 
const TInputHistogram * GetInputHistogram () const
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
- Protected Member Functions inherited from itk::HistogramAlgorithmBase< TInputHistogram >
 HistogramAlgorithmBase ()
 
 ~HistogramAlgorithmBase () override=default
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Detailed Description

template<typename TInputHistogram>
class itk::OtsuMultipleThresholdsCalculator< TInputHistogram >

Computes Otsu's multiple thresholds for a histogram.

You plug in the target histogram using SetInputHistogram method and specify the number of thresholds you want to be computed. Then call the Compute() method to run the algorithm.

The thresholds are computed so that the between-class variance is maximized.

This calculator also includes an option to use the valley emphasis algorithm from H.F. Ng, "Automatic thresholding for defect detection", Pattern Recognition Letters, (27): 1644-1649, 2006. The valley emphasis algorithm is particularly effective when the object to be thresholded is small. See the following tests for examples: itkOtsuMultipleThresholdsImageFilterTest3 and itkOtsuMultipleThresholdsImageFilterTest4 To use this algorithm, simple call the setter: SetValleyEmphasis(true) It is turned off by default.

Examples
Examples/Filtering/OtsuMultipleThresholdImageFilter.cxx.

Definition at line 50 of file itkOtsuMultipleThresholdsCalculator.h.

Member Typedef Documentation

◆ ConstPointer

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::ConstPointer = SmartPointer<const Self>

Definition at line 57 of file itkOtsuMultipleThresholdsCalculator.h.

◆ FrequencyType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::FrequencyType = typename TInputHistogram::AbsoluteFrequencyType

Definition at line 60 of file itkOtsuMultipleThresholdsCalculator.h.

◆ FrequencyVectorType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::FrequencyVectorType = std::vector<FrequencyType>

Definition at line 67 of file itkOtsuMultipleThresholdsCalculator.h.

◆ InstanceIdentifierType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::InstanceIdentifierType = typename TInputHistogram::InstanceIdentifier

Definition at line 70 of file itkOtsuMultipleThresholdsCalculator.h.

◆ InstanceIdentifierVectorType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::InstanceIdentifierVectorType = std::vector<InstanceIdentifierType>

Definition at line 71 of file itkOtsuMultipleThresholdsCalculator.h.

◆ MeanType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::MeanType = typename NumericTraits<MeasurementType>::RealType

Definition at line 62 of file itkOtsuMultipleThresholdsCalculator.h.

◆ MeanVectorType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::MeanVectorType = std::vector<MeanType>

Definition at line 66 of file itkOtsuMultipleThresholdsCalculator.h.

◆ MeasurementType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::MeasurementType = typename TInputHistogram::MeasurementType

Definition at line 59 of file itkOtsuMultipleThresholdsCalculator.h.

◆ OutputType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::OutputType = std::vector<MeasurementType>

Typedef for the thresholds output

Definition at line 79 of file itkOtsuMultipleThresholdsCalculator.h.

◆ Pointer

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Pointer = SmartPointer<Self>

Definition at line 56 of file itkOtsuMultipleThresholdsCalculator.h.

◆ Self

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Self = OtsuMultipleThresholdsCalculator

Standard class type aliases.

Definition at line 54 of file itkOtsuMultipleThresholdsCalculator.h.

◆ Superclass

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Superclass = HistogramAlgorithmBase<TInputHistogram>

Definition at line 55 of file itkOtsuMultipleThresholdsCalculator.h.

◆ VarianceType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::VarianceType = typename NumericTraits<MeasurementType>::RealType

Definition at line 63 of file itkOtsuMultipleThresholdsCalculator.h.

◆ WeightType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::WeightType = typename NumericTraits<MeasurementType>::RealType

Definition at line 64 of file itkOtsuMultipleThresholdsCalculator.h.

◆ WeightVectorType

template<typename TInputHistogram>
using itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::WeightVectorType = std::vector<WeightType>

Definition at line 68 of file itkOtsuMultipleThresholdsCalculator.h.

Constructor & Destructor Documentation

◆ OtsuMultipleThresholdsCalculator()

template<typename TInputHistogram>
itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::OtsuMultipleThresholdsCalculator ( )
protected

Typedef for the thresholds output

◆ ~OtsuMultipleThresholdsCalculator()

template<typename TInputHistogram>
itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::~OtsuMultipleThresholdsCalculator ( )
overrideprotecteddefault

Typedef for the thresholds output

Member Function Documentation

◆ Compute()

template<typename TInputHistogram>
void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Compute ( )
overridevirtual

Calculates Otsu's thresholds and saves them.

Implements itk::HistogramAlgorithmBase< TInputHistogram >.

◆ CreateAnother()

template<typename TInputHistogram>
virtual::itk::LightObject::Pointer itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::CreateAnother ( ) const
virtual

Typedef for the thresholds output

Reimplemented from itk::Object.

◆ GetNameOfClass()

template<typename TInputHistogram>
virtual const char* itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::GetNameOfClass ( ) const
virtual

Standard Macros

Reimplemented from itk::HistogramAlgorithmBase< TInputHistogram >.

◆ GetNumberOfThresholds()

template<typename TInputHistogram>
virtual SizeValueType itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::GetNumberOfThresholds ( ) const
virtual

Typedef for the thresholds output

◆ GetOutput()

template<typename TInputHistogram>
const OutputType& itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::GetOutput ( )

Returns the thresholds vector

◆ GetReturnBinMidpoint()

template<typename TInputHistogram>
virtual const bool& itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::GetReturnBinMidpoint ( ) const
virtual

Typedef for the thresholds output

◆ GetValleyEmphasis()

template<typename TInputHistogram>
virtual const bool& itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::GetValleyEmphasis ( ) const
virtual

Typedef for the thresholds output

◆ IncrementThresholds()

template<typename TInputHistogram>
bool itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::IncrementThresholds ( InstanceIdentifierVectorType thresholdIndexes,
MeanType  globalMean,
MeanVectorType classMean,
FrequencyVectorType classFrequency 
)
protected

Increment the thresholds of one position along the histogram.

◆ New()

template<typename TInputHistogram>
static Pointer itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::New ( )
static

◆ PrintSelf()

template<typename TInputHistogram>
void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotectedvirtual

Typedef for the thresholds output

Reimplemented from itk::HistogramAlgorithmBase< TInputHistogram >.

◆ ReturnBinMidpointOff()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::ReturnBinMidpointOff ( )
virtual

Typedef for the thresholds output

◆ ReturnBinMidpointOn()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::ReturnBinMidpointOn ( )
virtual

Typedef for the thresholds output

◆ SetNumberOfThresholds()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::SetNumberOfThresholds ( SizeValueType  _arg)
virtual

Set/Get the number of thresholds.

◆ SetReturnBinMidpoint()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::SetReturnBinMidpoint ( bool  _arg)
virtual

Should the threshold value be mid-point of the bin or the maximum? Default is to return bin maximum.

◆ SetValleyEmphasis()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::SetValleyEmphasis ( bool  _arg)
virtual

Set/Get the use of valley emphasis. Default is false.

◆ ValleyEmphasisOff()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::ValleyEmphasisOff ( )
virtual

Typedef for the thresholds output

◆ ValleyEmphasisOn()

template<typename TInputHistogram>
virtual void itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::ValleyEmphasisOn ( )
virtual

Typedef for the thresholds output

Member Data Documentation

◆ m_NumberOfThresholds

template<typename TInputHistogram>
SizeValueType itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::m_NumberOfThresholds { 1 }
private

Typedef for the thresholds output

Definition at line 122 of file itkOtsuMultipleThresholdsCalculator.h.

◆ m_Output

template<typename TInputHistogram>
OutputType itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::m_Output
private

Typedef for the thresholds output

Definition at line 123 of file itkOtsuMultipleThresholdsCalculator.h.

◆ m_ReturnBinMidpoint

template<typename TInputHistogram>
bool itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::m_ReturnBinMidpoint { false }
private

Typedef for the thresholds output

Definition at line 128 of file itkOtsuMultipleThresholdsCalculator.h.

◆ m_ValleyEmphasis

template<typename TInputHistogram>
bool itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::m_ValleyEmphasis { false }
private

Typedef for the thresholds output

Definition at line 124 of file itkOtsuMultipleThresholdsCalculator.h.


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