open_iA 2024.7
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision > Class Template Reference

Base class for fuzzy classifiers that take an image as input and produce a membership itk::VectorImage as output. More...

#include <itkFuzzyClassifierInitializationImageFilter.h>

Inheritance diagram for itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >:
[legend]
Collaboration diagram for itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >:
[legend]

Classes

struct  ThreadStruct
 Internal structure used for passing image data into the threading library. More...
 

Public Types

typedef std::vector< CentroidTypeCentroidArrayType
 Typdef for the array of centroids.
 
typedef itk::Vector< CentroidValueType, InputImagePixelDimensionCentroidType
 Centroid typedef.
 
typedef NumericTraits< CentroidValueTypeCentroidValueNumericTraitsType
 Other centroid typedefs.
 
typedef TCentroidValuePrecision CentroidValueType
 
typedef SmartPointer< const SelfConstPointer
 
typedef ImageRegionConstIterator< InputImageTypeInputImageConstIterator
 
typedef Superclass::InputImageConstPointer InputImageConstPointer
 
typedef InputImageType::IndexType InputImageIndexType
 
typedef NumericTraits< InputImagePixelTypeInputImagePixelNumericTraitsType
 Input image pixel typedefs.
 
typedef PixelTraits< InputImagePixelTypeInputImagePixelTraitsType
 
typedef Superclass::InputImagePixelType InputImagePixelType
 
typedef InputImagePixelTraitsType::ValueType InputImagePixelValueType
 
typedef Superclass::InputImagePointer InputImagePointer
 Input image typedef support (types inherited from the superclass).
 
typedef Superclass::InputImageRegionType InputImageRegionType
 
typedef InputImageType::SizeType InputImageSizeType
 Other input image typedefs.
 
typedef TInputImage InputImageType
 Convenient typedefs for simplifying declarations.
 
typedef ImageRegionConstIterator< InternalImageTypeInternalImageConstIterator
 
typedef InternalImageType::ConstPointer InternalImageConstPointer
 
typedef ImageRegionIterator< InternalImageTypeInternalImageIterator
 Other internal image typedefs.
 
typedef InternalImageType::Pointer InternalImagePointer
 
typedef Image< CentroidType, itkGetStaticConstMacro(InputImageDimension) > InternalImageType
 Internal image typedef support.
 
typedef ImageRegionIterator< MembershipImageTypeMembershipImageIterator
 
typedef MembershipImageType::PixelType MembershipImagePixelType
 
typedef MembershipImageType::Pointer MembershipImagePointer
 
typedef OutputImageType MembershipImageType
 Membership image typedef support.
 
typedef TProbabilityPrecision MembershipValueType
 
typedef VectorImage< MembershipValueType, itkGetStaticConstMacro(InputImageDimension) > OutputImageType
 Convenient typedefs for simplifying declarations.
 
typedef SmartPointer< SelfPointer
 
typedef FuzzyClassifierInitializationImageFilter Self
 Standard class typedefs.
 
typedef ImageToImageFilter< InputImageType, OutputImageTypeSuperclass
 Standard class typedefs.
 

Public Member Functions

virtual double ComputeDifference (const CentroidArrayType &arrayOfCentroids)
 Computes the mean square error between centroids and the centroid array passed as parameter.
 
virtual CentroidArrayType GetCentroids () const
 Get cluster centroids.
 
 itkBooleanMacro (IgnoreBackgroundPixels)
 Turn on and off the IgnoreBackgroundPixels flag.
 
 itkGetConstMacro (BackgroundPixel, InputImagePixelType)
 Get the pixel used as background value in the input image.
 
 itkGetConstMacro (Error, double)
 Get error between the new class centroids and their values from the previous iteration.
 
 itkGetConstMacro (IgnoreBackgroundPixels, bool)
 Get true/false depending on whether the algorithm ignores the background pixels or not.
 
 itkGetConstMacro (M, double)
 Get m fuzziness degree value.
 
 itkGetConstMacro (MaximumError, double)
 Get maximum error used to stop the algorithm.
 
 itkGetConstMacro (MaximumNumberOfIterations, unsigned int)
 Get maximum number of iterations.
 
 itkGetConstMacro (NumberOfClasses, unsigned int)
 Get the number of classes.
 
 itkGetConstMacro (NumberOfIterations, unsigned int)
 Get number of iterations performed.
 
 itkSetClampMacro (M, double, 1.0, NumericTraits< double >::max())
 Set m fuzziness degree value.
 
 itkSetClampMacro (MaximumError, double, 0.0, NumericTraits< double >::max())
 Set maximum error used to stop the algorithm.
 
 itkSetClampMacro (MaximumNumberOfIterations, unsigned int, 1, NumericTraits< unsigned int >::max())
 Set maximum number of iterations.
 
 itkSetMacro (BackgroundPixel, InputImagePixelType)
 Set the pixel used as background value in the input image.
 
 itkSetMacro (IgnoreBackgroundPixels, bool)
 Set true/false depending on whether the algorithm ignores the background pixels or not.
 
 itkStaticConstMacro (InputImageDimension, unsigned int, InputImageType::ImageDimension)
 Extract dimension from input image.
 
 itkStaticConstMacro (InputImagePixelDimension, unsigned int, InputImagePixelTraitsType::Dimension)
 Extract dimension from the pixel of the input image.
 
 itkTypeMacro (FuzzyClassifierInitializationImageFilter, ImageToImageFilter)
 Run-time type information (and related methods).
 
virtual void SetCentroids (const CentroidArrayType newCentroids)
 Set class centroids.
 
virtual void SetNumberOfClasses (const unsigned int &numOfClasses)
 Set the number of classes.
 

Protected Member Functions

 FuzzyClassifierInitializationImageFilter ()
 Constructor.
 
virtual ~FuzzyClassifierInitializationImageFilter ()
 Destructor.
 
void ComputeImageToProcess (InternalImageType *imageToProcess)
 Get the internal image to process.
 
void ComputePixelAsCentroid (const InputImagePixelType &pixel, CentroidType &pixelAsCentroid)
 Transforms a given pixel of the input image to the equivalent pixel of centroid type.
 
void GenerateData () override
 A version of GenerateData() specific for fuzzy classifiers.
 
void GenerateOutputInformation () override
 Generate the information describing the output data.
 
virtual void Initialize ()
 If a subclass of FuzzyClassifierInitializationImageFilter needs to initialize some data or perform some calculations before to start the first iteration, it should provide an implementation of Initialize().
 
void PrintSelf (std::ostream &os, Indent indent) const override
 Write the name-value pairs of the filter data members to the supplied output stream.
 

Protected Attributes

InputImagePixelType m_BackgroundPixel
 Pixel of the input image used as background value.
 
CentroidArrayType m_Centroids
 Array of class centroids.
 
double m_Error
 Error obtained between the new class centroids and the old values of the centroids (i.e.
 
bool m_IgnoreBackgroundPixels
 Flag indicating whether to ignore the background pixels.
 
InternalImagePointer m_ImageToProcess
 Pointer to the image to be used internally by the algorithm.
 
double m_M
 Fuzzification parameter (m) in the range [1, n], which determines the degree of fuzziness in the clusters.
 
double m_MaximumError
 Error threshold used to stop the algorithm.
 
unsigned int m_MaximumNumberOfIterations
 Maximum number of iterations allowed.
 
unsigned int m_NumberOfClasses
 Number of fuzzy clusters used to classify the image.
 
unsigned int m_NumberOfIterations
 Number of iterations performed.
 

Detailed Description

template<class TInputImage, class TProbabilityPrecision = double, class TCentroidValuePrecision = double>
class itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >

Base class for fuzzy classifiers that take an image as input and produce a membership itk::VectorImage as output.

FuzzyClassifierInitializationImageFilter class provides the infrastructure for supporting multithread. This class provides a GenerateData() method based on the superclass (ImageSource) implementation. If a derived class provides an implementation of ThreadedGenerateData(), this implementation of GenerateData() allocates the output buffer and an image used internally. It also calls the method called Initialize(). This method is used by derived classes that need to initialize some data or perform some calculations before to start the first iteration. Then it performs the iterations of the fuzzy algorithm. At each iteration, the BeforeThreadedGenerateData() method is called (if provided). Then, the image is divided into a number of pieces and a number of threads are spawned each calling ThreadedGenerateData(). After all the threads have completed processing, the AfterThreadedGenerateData() method is called (if provided). To halt the iteration process the error (usually the difference between the new values of the centroids and the previous values) must lie below a determined threshold or the number of iteration must exceed the maximum number of iterations, otherwise a new iteration will start.

If a derived class provides an implementation of GenerateData() instead, the fuzzy algorithm will run in a single thread and the implementation is responsible for allocating its output data.

Inputs and Outputs
The input to this filter is the image to classify.
The output of the filter is an itk::VectorImage, that represents pixel memberships to 'n' classes.
Template parameters
This filter is templated over the input image type, the data type used to represent the probabilities (defaults to double) and the data type used to represent the values of the centroids (defaults to double). Note that the precision types used to instantiate this filter should be real valued scalar types. In other words: doubles or floats.
Internal image
This class uses an internal image to speed up execution. This image is obtained by a numeric conversion of the pixels of the input image to the type of centroids. This will avoid doing a conversion each time the algorithm accesses the pixels.
Caveats
When using Iterators on the output vector image, you cannot use the it.Value(). You must use Set/Get() methods instead.
Version
0.1
Author
Alberto Rey, Alfonso Castro and Bernardino Arcay. University of A Coruña. Spain
See also
FuzzyClassifierImageFilter
FCMClassifierInitializationImageFilter
KFCMSClassifierInitializationImageFilter
MSKFCMClassifierInitializationImageFilter
MSFKCMClassifierInitializationImageFilter
VectorImage

Member Typedef Documentation

◆ CentroidArrayType

Typdef for the array of centroids.

◆ CentroidType

Centroid typedef.

The type of the components of the centroid is the template parameter TCentroidValuePrecision (i.e. CentroidValueType).

◆ CentroidValueNumericTraitsType

Other centroid typedefs.

◆ CentroidValueType

◆ ConstPointer

◆ InputImageConstIterator

◆ InputImageConstPointer

◆ InputImageIndexType

◆ InputImagePixelNumericTraitsType

Input image pixel typedefs.

◆ InputImagePixelTraitsType

◆ InputImagePixelType

◆ InputImagePixelValueType

◆ InputImagePointer

Input image typedef support (types inherited from the superclass).

◆ InputImageRegionType

◆ InputImageSizeType

Other input image typedefs.

◆ InputImageType

Convenient typedefs for simplifying declarations.

◆ InternalImageConstIterator

◆ InternalImageConstPointer

◆ InternalImageIterator

Other internal image typedefs.

◆ InternalImagePointer

◆ InternalImageType

Internal image typedef support.

This image is used for internal processing. It's obtained by converting the pixels of the input image to the type of centroid.

◆ MembershipImageIterator

◆ MembershipImagePixelType

◆ MembershipImagePointer

◆ MembershipImageType

Membership image typedef support.

The pixels of the vector image represent the membership of that pixel to each particular class. The pixels are arrays and the number of elements in the array is the same as the number of classes to be used.

◆ MembershipValueType

◆ OutputImageType

Convenient typedefs for simplifying declarations.

◆ Pointer

◆ Self

Standard class typedefs.

◆ Superclass

Standard class typedefs.

Constructor & Destructor Documentation

◆ FuzzyClassifierInitializationImageFilter()

Constructor.

◆ ~FuzzyClassifierInitializationImageFilter()

Destructor.

Member Function Documentation

◆ ComputeDifference()

Computes the mean square error between centroids and the centroid array passed as parameter.

◆ ComputeImageToProcess()

Get the internal image to process.

This image will be used for internal processing and is obtained from the original input image by transforming its pixels to the type of centroids.

◆ ComputePixelAsCentroid()

Transforms a given pixel of the input image to the equivalent pixel of centroid type.

◆ GenerateData()

A version of GenerateData() specific for fuzzy classifiers.

This implementation will split the processing across multiple threads. The buffer is allocated by this method. It also calls Initialize(). Then it performs the iterations of the fuzzy algorithm. At each iteration the BeforeThreadedGenerateData() method is called (if provided). Then, the image is divided into a number of pieces and a number of threads are spawned each calling ThreadedGenerateData(). After all the threads have completed processing, the AfterThreadedGenerateData() method is called (if provided). To halt the iteration process the error (i.e., the difference between the new values of the centroids and the previous values) must lie below a determined thresold or the number of iteration must exceed the maximum number of iterations, otherwise a new iteration will start. If a derived class cannot be threaded, that class should provide an implementation of GenerateData(). That implementation is responsible for allocating the output buffer. If a subclass can be threaded, it should NOT provide a GenerateData() method but should provide a ThreadedGenerateData() instead.

See also
ThreadedGenerateData()

◆ GenerateOutputInformation()

Generate the information describing the output data.

The default implementation of this method will copy information from the input to the output. The filter calls that superclass' implementation of this method and then it sets the length of the output image pixel (i.e., the array of memberships) to the number of classes.

◆ GetCentroids()

Get cluster centroids.

◆ Initialize()

If a subclass of FuzzyClassifierInitializationImageFilter needs to initialize some data or perform some calculations before to start the first iteration, it should provide an implementation of Initialize().

Reimplemented in itk::KFCMSClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >, and itk::MSKFCMClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >.

◆ itkBooleanMacro()

Turn on and off the IgnoreBackgroundPixels flag.

◆ itkGetConstMacro() [1/8]

Get the pixel used as background value in the input image.

◆ itkGetConstMacro() [2/8]

Get error between the new class centroids and their values from the previous iteration.

◆ itkGetConstMacro() [3/8]

Get true/false depending on whether the algorithm ignores the background pixels or not.

◆ itkGetConstMacro() [4/8]

Get m fuzziness degree value.

◆ itkGetConstMacro() [5/8]

Get maximum error used to stop the algorithm.

◆ itkGetConstMacro() [6/8]

Get maximum number of iterations.

◆ itkGetConstMacro() [7/8]

Get the number of classes.

◆ itkGetConstMacro() [8/8]

Get number of iterations performed.

◆ itkSetClampMacro() [1/3]

Set m fuzziness degree value.

This value should be greater than 1 .

◆ itkSetClampMacro() [2/3]

Set maximum error used to stop the algorithm.

This error value can't be negative.

◆ itkSetClampMacro() [3/3]

Set maximum number of iterations.

This value should be positive and greater than 1.

◆ itkSetMacro() [1/2]

Set the pixel used as background value in the input image.

The image pixels with this value will be ignored.

◆ itkSetMacro() [2/2]

Set true/false depending on whether the algorithm ignores the background pixels or not.

◆ itkStaticConstMacro() [1/2]

Extract dimension from input image.

◆ itkStaticConstMacro() [2/2]

Extract dimension from the pixel of the input image.

◆ itkTypeMacro()

Run-time type information (and related methods).

◆ PrintSelf()

Write the name-value pairs of the filter data members to the supplied output stream.

◆ SetCentroids()

Set class centroids.

The number of centroids must equal the number of classes.

◆ SetNumberOfClasses()

Member Data Documentation

◆ m_BackgroundPixel

Pixel of the input image used as background value.

◆ m_Centroids

Array of class centroids.

◆ m_Error

Error obtained between the new class centroids and the old values of the centroids (i.e.

the values in the previous iteration). During the execution of the algorithm it represents the current error and it's updated at each iteration.

◆ m_IgnoreBackgroundPixels

Flag indicating whether to ignore the background pixels.

◆ m_ImageToProcess

Pointer to the image to be used internally by the algorithm.

This image is obtained by a numeric conversion of the pixels of the input image to the type of centroids.

◆ m_M

Fuzzification parameter (m) in the range [1, n], which determines the degree of fuzziness in the clusters.

When m = 1 the effect is a crisp clustering of points. When m > 1 the degree of fuzziness among points in the decision space increases.

◆ m_MaximumError

Error threshold used to stop the algorithm.

◆ m_MaximumNumberOfIterations

Maximum number of iterations allowed.

◆ m_NumberOfClasses

Number of fuzzy clusters used to classify the image.

The number of classes will determine the number of membership images that will be generated. The user must specify the number of expected classes before calling the classifier.

◆ m_NumberOfIterations

Number of iterations performed.

During the execution of the algorithm it represents the current iteration.


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