|
open_iA 2024.7
|
Base class for fuzzy classifiers that take an image as input and produce a membership itk::VectorImage as output. More...
#include <itkFuzzyClassifierInitializationImageFilter.h>
Classes | |
| struct | ThreadStruct |
| Internal structure used for passing image data into the threading library. More... | |
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. | |
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.
| typedef std::vector< CentroidType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::CentroidArrayType |
Typdef for the array of centroids.
| typedef itk::Vector< CentroidValueType, InputImagePixelDimension > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::CentroidType |
Centroid typedef.
The type of the components of the centroid is the template parameter TCentroidValuePrecision (i.e. CentroidValueType).
| typedef NumericTraits< CentroidValueType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::CentroidValueNumericTraitsType |
Other centroid typedefs.
| typedef TCentroidValuePrecision itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::CentroidValueType |
| typedef SmartPointer< const Self > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::ConstPointer |
| typedef ImageRegionConstIterator< InputImageType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImageConstIterator |
| typedef Superclass::InputImageConstPointer itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImageConstPointer |
| typedef InputImageType::IndexType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImageIndexType |
| typedef NumericTraits< InputImagePixelType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImagePixelNumericTraitsType |
Input image pixel typedefs.
| typedef PixelTraits< InputImagePixelType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImagePixelTraitsType |
| typedef Superclass::InputImagePixelType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImagePixelType |
| typedef InputImagePixelTraitsType::ValueType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImagePixelValueType |
| typedef Superclass::InputImagePointer itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImagePointer |
Input image typedef support (types inherited from the superclass).
| typedef Superclass::InputImageRegionType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImageRegionType |
| typedef InputImageType::SizeType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImageSizeType |
Other input image typedefs.
| typedef TInputImage itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InputImageType |
Convenient typedefs for simplifying declarations.
| typedef ImageRegionConstIterator< InternalImageType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InternalImageConstIterator |
| typedef InternalImageType::ConstPointer itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InternalImageConstPointer |
| typedef ImageRegionIterator< InternalImageType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InternalImageIterator |
Other internal image typedefs.
| typedef InternalImageType::Pointer itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::InternalImagePointer |
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.
| typedef ImageRegionIterator< MembershipImageType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::MembershipImageIterator |
| typedef MembershipImageType::PixelType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::MembershipImagePixelType |
| typedef MembershipImageType::Pointer itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::MembershipImagePointer |
| typedef OutputImageType itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::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.
| typedef TProbabilityPrecision itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::MembershipValueType |
Convenient typedefs for simplifying declarations.
| typedef SmartPointer< Self > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::Pointer |
| typedef FuzzyClassifierInitializationImageFilter itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::Self |
Standard class typedefs.
| typedef ImageToImageFilter< InputImageType, OutputImageType > itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::Superclass |
Standard class typedefs.
|
protected |
Constructor.
|
inlineprotectedvirtual |
Destructor.
|
virtual |
Computes the mean square error between centroids and the centroid array passed as parameter.
|
protected |
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.
|
inlineprotected |
Transforms a given pixel of the input image to the equivalent pixel of centroid type.
|
overrideprotected |
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.
|
overrideprotected |
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.
|
virtual |
Get cluster centroids.
|
inlineprotectedvirtual |
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 >.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkBooleanMacro | ( | IgnoreBackgroundPixels | ) |
Turn on and off the IgnoreBackgroundPixels flag.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | BackgroundPixel | , |
| InputImagePixelType | ) |
Get the pixel used as background value in the input image.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | Error | , |
| double | ) |
Get error between the new class centroids and their values from the previous iteration.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | IgnoreBackgroundPixels | , |
| bool | ) |
Get true/false depending on whether the algorithm ignores the background pixels or not.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | M | , |
| double | ) |
Get m fuzziness degree value.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | MaximumError | , |
| double | ) |
Get maximum error used to stop the algorithm.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | MaximumNumberOfIterations | , |
| unsigned int | ) |
Get maximum number of iterations.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | NumberOfClasses | , |
| unsigned int | ) |
Get the number of classes.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkGetConstMacro | ( | NumberOfIterations | , |
| unsigned int | ) |
Get number of iterations performed.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkSetClampMacro | ( | M | , |
| double | , | ||
| 1. | 0, | ||
| NumericTraits< double > | ::max() ) |
Set m fuzziness degree value.
This value should be greater than 1 .
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkSetClampMacro | ( | MaximumError | , |
| double | , | ||
| 0. | 0, | ||
| NumericTraits< double > | ::max() ) |
Set maximum error used to stop the algorithm.
This error value can't be negative.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkSetClampMacro | ( | MaximumNumberOfIterations | , |
| unsigned int | , | ||
| 1 | , | ||
| NumericTraits< unsigned int > | ::max() ) |
Set maximum number of iterations.
This value should be positive and greater than 1.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkSetMacro | ( | BackgroundPixel | , |
| InputImagePixelType | ) |
Set the pixel used as background value in the input image.
The image pixels with this value will be ignored.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkSetMacro | ( | IgnoreBackgroundPixels | , |
| bool | ) |
Set true/false depending on whether the algorithm ignores the background pixels or not.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkStaticConstMacro | ( | InputImageDimension | , |
| unsigned int | , | ||
| InputImageType::ImageDimension | ) |
Extract dimension from input image.
Extract dimension from the pixel of the input image.
| itk::FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >::itkTypeMacro | ( | FuzzyClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision > | , |
| ImageToImageFilter | ) |
Run-time type information (and related methods).
|
overrideprotected |
Write the name-value pairs of the filter data members to the supplied output stream.
|
virtual |
Set class centroids.
The number of centroids must equal the number of classes.
|
virtual |
Set the number of classes.
This method also sets the size of the vector of centroids. The user must supply it.
Reimplemented in itk::FCMClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >, itk::KFCMSClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >, and itk::MSKFCMClassifierInitializationImageFilter< TInputImage, TProbabilityPrecision, TCentroidValuePrecision >.
|
protected |
Pixel of the input image used as background value.
|
protected |
Array of class centroids.
|
protected |
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.
|
protected |
Flag indicating whether to ignore the background pixels.
|
protected |
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.
|
protected |
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.
|
protected |
Error threshold used to stop the algorithm.
|
protected |
Maximum number of iterations allowed.
|
protected |
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.
|
protected |
Number of iterations performed.
During the execution of the algorithm it represents the current iteration.