ITK  4.8.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | 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 >:

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 49 of file itkOtsuMultipleThresholdsCalculator.h.

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef
TInputHistogram::AbsoluteFrequencyType 
FrequencyType
 
typedef std::vector
< FrequencyType
FrequencyVectorType
 
typedef
TInputHistogram::InstanceIdentifier 
InstanceIdentifierType
 
typedef std::vector
< InstanceIdentifierType
InstanceIdentifierVectorType
 
typedef NumericTraits
< MeasurementType >::RealType 
MeanType
 
typedef std::vector< MeanTypeMeanVectorType
 
typedef
TInputHistogram::MeasurementType 
MeasurementType
 
typedef std::vector
< MeasurementType
OutputType
 
typedef SmartPointer< SelfPointer
 
typedef
OtsuMultipleThresholdsCalculator 
Self
 
typedef HistogramAlgorithmBase
< TInputHistogram > 
Superclass
 
typedef NumericTraits
< MeasurementType >::RealType 
VarianceType
 
typedef NumericTraits
< MeasurementType >::RealType 
WeightType
 
typedef std::vector< WeightTypeWeightVectorType
 
- Public Types inherited from itk::HistogramAlgorithmBase< TInputHistogram >
typedef SmartPointer< const SelfConstPointer
 
typedef TInputHistogram InputHistogramType
 
typedef SmartPointer< SelfPointer
 
typedef HistogramAlgorithmBase Self
 
typedef Object Superclass
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

void Compute () override
 
const OutputTypeGetOutput ()
 
virtual void SetNumberOfThresholds (SizeValueType _arg)
 
virtual SizeValueType GetNumberOfThresholds () const
 
virtual void SetValleyEmphasis (bool _arg)
 
virtual const bool & GetValleyEmphasis () const
 
virtual void ValleyEmphasisOn ()
 
virtual void ValleyEmphasisOff ()
 
- Public Member Functions inherited from itk::HistogramAlgorithmBase< TInputHistogram >
const TInputHistogram * GetInputHistogram () const
 
void Update ()
 
void SetInputHistogram (const TInputHistogram *histogram)
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) 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
 
virtual void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetReferenceCount (int) override
 
virtual void UnRegister () const noexceptoverride
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Protected Member Functions

bool IncrementThresholds (InstanceIdentifierVectorType &thresholdIds, MeanType totalMean, MeanVectorType &classMean, FrequencyVectorType &classFrequency)
 
 OtsuMultipleThresholdsCalculator ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual ~OtsuMultipleThresholdsCalculator ()
 
- Protected Member Functions inherited from itk::HistogramAlgorithmBase< TInputHistogram >
 HistogramAlgorithmBase ()
 
virtual ~HistogramAlgorithmBase ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
virtual ~Object ()
 
- 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 ()
 

Private Attributes

SizeValueType m_NumberOfThresholds
 
OutputType m_Output
 
bool m_ValleyEmphasis
 
virtual const char * GetNameOfClass () const
 
virtual ::itk::LightObject::Pointer CreateAnother () const
 
static Pointer New ()
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
- Protected Attributes inherited from itk::LightObject
AtomicInt< int > m_ReferenceCount
 

Member Typedef Documentation

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

Definition at line 57 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
typedef TInputHistogram::AbsoluteFrequencyType itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::FrequencyType

Definition at line 60 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 67 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
typedef TInputHistogram::InstanceIdentifier itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::InstanceIdentifierType

Definition at line 70 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 71 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 62 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 66 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
typedef TInputHistogram::MeasurementType itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::MeasurementType

Definition at line 59 of file itkOtsuMultipleThresholdsCalculator.h.

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

Typedef for the thresholds output

Definition at line 75 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
typedef SmartPointer< Self > itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Pointer

Definition at line 56 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
typedef OtsuMultipleThresholdsCalculator itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Self

Standard class typedefs.

Definition at line 54 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
typedef HistogramAlgorithmBase< TInputHistogram > itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::Superclass

Definition at line 55 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 63 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 64 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 68 of file itkOtsuMultipleThresholdsCalculator.h.

Constructor & Destructor Documentation

template<typename TInputHistogram>
itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::OtsuMultipleThresholdsCalculator ( )
protected
template<typename TInputHistogram>
virtual itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::~OtsuMultipleThresholdsCalculator ( )
inlineprotectedvirtual

Definition at line 100 of file itkOtsuMultipleThresholdsCalculator.h.

Member Function Documentation

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

Calculates the thresholds and save them

Implements itk::HistogramAlgorithmBase< TInputHistogram >.

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

Standard Macros

Reimplemented from itk::Object.

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

Standard Macros

Reimplemented from itk::HistogramAlgorithmBase< TInputHistogram >.

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

Set/Get the number of thresholds.

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

Returns the thresholds vector

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

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

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

Increment the thresholds of one position

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

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::HistogramAlgorithmBase< TInputHistogram >.

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

Set/Get the number of thresholds.

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

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

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

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

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

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

Member Data Documentation

template<typename TInputHistogram>
SizeValueType itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::m_NumberOfThresholds
private

Internal thresholds storage

Definition at line 111 of file itkOtsuMultipleThresholdsCalculator.h.

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

Definition at line 112 of file itkOtsuMultipleThresholdsCalculator.h.

template<typename TInputHistogram>
bool itk::OtsuMultipleThresholdsCalculator< TInputHistogram >::m_ValleyEmphasis
private

Definition at line 113 of file itkOtsuMultipleThresholdsCalculator.h.


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