IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ipsdk::imaproc::classif::KMeansImgLvl1 Class Reference

See K-means algorithm for a complete algorithm description. More...

#include <KMeansImgLvl1.h>

Inheritance diagram for ipsdk::imaproc::classif::KMeansImgLvl1:
ipsdk::processor::BaseProcessor< ipsdk::core::BaseRepeatedAsync1Action >

Public Member Functions

 ~KMeansImgLvl1 ()
 destructor
 
const std::string & getObjectName () const
 method allowing to retrieve object name
 
const std::string & getToolTip () const
 method allowing to retrieve object tooltip
 
const boost::filesystem::path getHeaderPath () const
 retrieve relative header path associated to processor
 
const std::string getLibraryName () const
 retrieve library name associated processor
 
template<typename TAttribute >
TAttribute::StorageType getStorage ()
 retrieve storage associated to a given attribute More...
 
Attribute accessors

Setters and Getters for attributes

template<>
const ipsdk::imaproc::attr::InHomogeneousImgget () const
 Getter for attribute InHomogeneousImg.
 
template<>
void set (const typename ipsdk::imaproc::attr::InHomogeneousImg::StorageType &value)
 Setter for attribute InHomogeneousImg.
 
template<>
const ipsdk::imaproc::attr::InOptSingleGreyMaskImgget () const
 Getter for attribute InOptSingleGreyMaskImg.
 
template<>
void set (const typename ipsdk::imaproc::attr::InOptSingleGreyMaskImg::StorageType &value)
 Setter for attribute InOptSingleGreyMaskImg.
 
template<>
const ipsdk::imaproc::attr::InOptNbAttemptsget () const
 Getter for attribute InOptNbAttempts.
 
template<>
void set (const typename ipsdk::imaproc::attr::InOptNbAttempts::StorageType &value)
 Setter for attribute InOptNbAttempts.
 
template<>
const ipsdk::imaproc::attr::InOptNbMaxIterget () const
 Getter for attribute InOptNbMaxIter.
 
template<>
void set (const typename ipsdk::imaproc::attr::InOptNbMaxIter::StorageType &value)
 Setter for attribute InOptNbMaxIter.
 
template<>
const ipsdk::imaproc::attr::InNbClustersget () const
 Getter for attribute InNbClusters.
 
template<>
void set (const typename ipsdk::imaproc::attr::InNbClusters::StorageType &value)
 Setter for attribute InNbClusters.
 
template<>
const ipsdk::imaproc::attr::InOptClustersCentersShiftToleranceget () const
 Getter for attribute InOptClustersCentersShiftTolerance.
 
template<>
void set (const typename ipsdk::imaproc::attr::InOptClustersCentersShiftTolerance::StorageType &value)
 Setter for attribute InOptClustersCentersShiftTolerance.
 
template<>
const ipsdk::imaproc::attr::OutClustersCentersget () const
 Getter for attribute OutClustersCenters.
 
template<>
void set (const typename ipsdk::imaproc::attr::OutClustersCenters::StorageType &value)
 Setter for attribute OutClustersCenters.
 
template<>
const ipsdk::imaproc::attr::OutCompactnessget () const
 Getter for attribute OutCompactness.
 
template<>
void set (const typename ipsdk::imaproc::attr::OutCompactness::StorageType &value)
 Setter for attribute OutCompactness.
 
template<>
const ipsdk::imaproc::attr::OutOptWkClassImgget () const
 Getter for attribute OutOptWkClassImg.
 
template<>
void set (const typename ipsdk::imaproc::attr::OutOptWkClassImg::StorageType &value)
 Setter for attribute OutOptWkClassImg.
 
template<>
const ipsdk::imaproc::attr::OutOptPosterizedImgget () const
 Getter for attribute OutOptPosterizedImg.
 
template<>
void set (const typename ipsdk::imaproc::attr::OutOptPosterizedImg::StorageType &value)
 Setter for attribute OutOptPosterizedImg.
 
template<>
const ipsdk::imaproc::attr::OutClassImgget () const
 Getter for attribute OutClassImg.
 
template<>
void set (const typename ipsdk::imaproc::attr::OutClassImg::StorageType &value)
 Setter for attribute OutClassImg.
 
- Public Member Functions inherited from ipsdk::processor::BaseProcessor< ipsdk::core::BaseRepeatedAsync1Action >
virtual eProcessorType getProcessorType () const =0
 
BoolResult init (const eProcessorRulePolicy rulePolicy=eProcessorRulePolicy::ePRP_DisableSubRules)
 
const eProcessorRulePolicygetProcessorRulePolicy () const
 
std::string getFullInfoStr () const
 
const BaseRulegetGlobalRule () const
 
const ProcessorDispatchPolicygetDispatchPolicy () const
 
void restrictDispatchPolicy (const ProcessorDispatchPolicy &policy)
 
bool isProgressAvailable () const
 
ipsdk::processor::eProcessorProgressAvailability getProgressAvailability () const
 
ipsdk::ipUInt64 getTotalNbIterations () const
 
bool existsHeaderKey (const std::string &key) const
 
bool existsHeaderKey (const std::string &key) const
 
ItemNames getHeaderKeys () const
 
ItemNames getHeaderKeys () const
 
const BaseDataItemgetHeaderItem (const std::string &key) const
 
BaseDataItemgetHeaderItem (const std::string &key)
 
const BaseDataItemgetHeaderItem (const std::string &key) const
 
BaseDataItemgetHeaderItem (const std::string &key)
 
void addHeaderItem (const std::string &key, const DataItemPtr &pItem)
 
void addHeaderItem (const std::string &key, const DataItemPtr &pItem)
 
void removeHeaderItem (const std::string &key)
 
void removeHeaderItem (const std::string &key)
 
void clearHeader ()
 
void clearHeader ()
 
ipUInt32 getNbAttributes () const
 
ipUInt32 getNbAttributes () const
 
const BaseAttributegetAttribute (ipUInt32 index) const
 
BaseAttributegetAttribute (ipUInt32 index)
 
const BaseAttributegetAttribute (const std::string &attributeName) const
 
BaseAttributegetAttribute (const std::string &attributeName)
 
const BaseAttributegetAttribute (ipUInt32 index) const
 
BaseAttributegetAttribute (ipUInt32 index)
 
const BaseAttributegetAttribute (const std::string &attributeName) const
 
BaseAttributegetAttribute (const std::string &attributeName)
 
bool existsAttribute (const std::string &attributeName) const
 
bool existsAttribute (const std::string &attributeName) const
 
StringVector getAttributeNameColl () const
 
StringVector getAttributeNameColl () const
 
bool hasOutputInitializer (const std::string &attributeName) const
 
bool hasOutputInitializer (const std::string &attributeName) const
 
const BaseOutputInitializergetOutputInitializer (const std::string &attributeName) const
 
const BaseOutputInitializergetOutputInitializer (const std::string &attributeName) const
 

Static Public Member Functions

static boost::shared_ptr< KMeansImgLvl1createProcessor ()
 processor creation function
 
static const std::string & getObjectNameStr ()
 method allowing to retrieve object name
 
static const std::string & getToolTipStr ()
 method allowing to retrieve object tooltip
 
static const boost::filesystem::path getHeaderPathStr ()
 retrieve relative header path associated to processor
 
static const std::string getLibraryNameStr ()
 retrieve library name associated processor
 

Protected Member Functions

 KMeansImgLvl1 ()
 constructor
 
ipsdk::processor::RetrievalResult retrieveProvider (const ipsdk::core::BasePriority &priority, ipsdk::ipUInt32 curNbIter, ipsdk::core::ActionProviderPtr &pProvider)
 method allowing to retrieve provider associated to asynchronous processing in derived class More...
 
void finalizeClustersCenters ()
 
void computeNewCenters ()
 
bool checkCentersShift ()
 
processor::RetrievalResult assignClasses (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult updateCenters (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult checkNoEmptyCluster (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult initRandomCenters (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult locateMostEccentricPtInBiggestCluster (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult replaceEmptyCluster (ipUInt64 emptyClusterIx, const attr::ClusterEltInfo &mostEccentricClusterEltInfo, const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult checkCentersShift (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult processOnCurAttemptComplete (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult setCurClassImgAsBest (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult copyBestClassImgToOutClassImg (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult posterizeImg (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult computeCompactnessForCurrentAttempt (const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
processor::RetrievalResult compactnessForCurrentAttemptComputed (const core::BasePriority &priority, core::ActionProviderPtr &pProvider, ipReal64 compactness)
 
processor::RetrievalResult provideProcessor (const boost::shared_ptr< core::BaseAction > &pProcessor, const core::BasePriority &priority, core::ActionProviderPtr &pProvider)
 
ipUInt64 findBiggestCluster ()
 
 IPSDK_DECLARE_STATIC_RESULT_COLL (attr::OutKMeansAssignmentInfo, KMeansAssignmentInfoColl)
 
- Protected Member Functions inherited from ipsdk::processor::BaseProcessor< ipsdk::core::BaseRepeatedAsync1Action >
virtual BoolResult initDerived (AttributeColl &attributeColl, OutputInitializerColl &outputInitializerColl, ProcessorDispatchPolicy &dispatchPolicy, RulePtr &pGlobalRule, const eProcessorRulePolicy &rulePolicy)=0
 

Protected Attributes

image::ImageConstPtr _pReinterpretedInImg
 
image::ImagePtr _pReinterpretedOutPosterizedImg
 
ipUInt32 _iterIx
 
ipUInt32 _attemptIx
 
boost::shared_ptr< KMeansAssignImgLvl1_pKMeansAssignProcessor
 
boost::shared_ptr< KMeansPPClusterInitLvl1_pKMeansInitCentersProcessor
 
boost::shared_ptr< LocateMostEccentricClusterEltLvl1 > _pLocateEmptyClusterSubstituteProcessor
 
boost::shared_ptr< KMeansComputeCompactnessLvl1_pKMeansComputeCompactnessProcessor
 
boost::shared_ptr< util::CopyImgLvl1_pSetCurClassImgAsBestProcessor
 
boost::shared_ptr< util::CopyImgLvl1_pCopyBestClassImgToOutClassImgProcessor
 
boost::shared_ptr< KMeansPosterizeImgLvl1_pPosterizeProcessor
 
attr::KMeansAssignmentInfoPtr _pKMeansAssignmentInfo
 
ipUInt64 _lastEmptyClusterIx
 
std::vector< ipReal64_oldFlattenedClustersCenters
 
std::vector< ipReal64_flattenedClustersCenters
 
std::vector< ipReal64_flattenedClustersStdDeviations
 
std::vector< ipReal64_bestFlattenedClustersCenters
 
ipReal64 _bestCompactness
 
Attribute members
boost::shared_ptr< ipsdk::imaproc::attr::InHomogeneousImg_pInHomogeneousImg
 
boost::shared_ptr< ipsdk::imaproc::attr::InOptSingleGreyMaskImg_pInOptSingleGreyMaskImg
 
boost::shared_ptr< ipsdk::imaproc::attr::InOptNbAttempts_pInOptNbAttempts
 
boost::shared_ptr< ipsdk::imaproc::attr::InOptNbMaxIter_pInOptNbMaxIter
 
boost::shared_ptr< ipsdk::imaproc::attr::InNbClusters_pInNbClusters
 
boost::shared_ptr< ipsdk::imaproc::attr::InOptClustersCentersShiftTolerance_pInOptClustersCentersShiftTolerance
 
boost::shared_ptr< ipsdk::imaproc::attr::OutClustersCenters_pOutClustersCenters
 
boost::shared_ptr< ipsdk::imaproc::attr::OutCompactness_pOutCompactness
 
boost::shared_ptr< ipsdk::imaproc::attr::OutOptWkClassImg_pOutOptWkClassImg
 
boost::shared_ptr< ipsdk::imaproc::attr::OutOptPosterizedImg_pOutOptPosterizedImg
 
boost::shared_ptr< ipsdk::imaproc::attr::OutClassImg_pOutClassImg
 
- Protected Attributes inherited from ipsdk::processor::BaseProcessor< ipsdk::core::BaseRepeatedAsync1Action >
eProcessorProgressAvailability _processorProgressAvailability
 
ipUInt32 _nbIter
 

Additional Inherited Members

- Protected Types inherited from ipsdk::processor::BaseProcessor< ipsdk::core::BaseRepeatedAsync1Action >
typedef std::vector< AttributePtrAttributeColl
 
typedef std::map< std::string, OutputInitializerPtrOutputInitializerColl
 

Detailed Description

See K-means algorithm for a complete algorithm description.

Algorithm associated library :

IPSDKIPLClassification

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InHomogeneousImg [Input] Homogeneous image X
ipsdk::imaproc::attr::InOptSingleGreyMaskImg [Input Optional] Binary image for masking operation for each (x, y, z) coordinate regardless to (c, t) coordinates X
ipsdk::imaproc::attr::InOptNbAttempts [Input Optional] Number of times k-means is executed using different initial clusters centers X
ipsdk::imaproc::attr::InOptNbMaxIter [Input Optional] Maximum number of iterations (ignored if equals to 0) X
ipsdk::imaproc::attr::InNbClusters [Input] Number of clusters X
ipsdk::imaproc::attr::InOptClustersCentersShiftTolerance [Input Optional] Tolerance on clusters centers shift between 2 iterations of k-means algorithm X
ipsdk::imaproc::attr::OutClustersCenters [Output] Centers of clusters allocate (_pOutClustersCenters)
ipsdk::imaproc::attr::OutCompactness [Output] Compactness, used in k-means algorithm X
ipsdk::imaproc::attr::OutOptWkClassImg [Output Optional] Temporary working image for algorithm customOutput (_pOutOptWkClassImg, outputKMeans(_pOutClassImg,_pInHomogeneousImg,_pInNbClusters))
ipsdk::imaproc::attr::OutOptPosterizedImg [Output Optional] Posterized image X
ipsdk::imaproc::attr::OutClassImg [Output] Image of classes customOutput (_pOutClassImg, outputKMeans(_pInHomogeneousImg,_pInNbClusters))

Global attributes rule :

Global rule on attributes is given by
ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_3d,_pInHomogeneousImg,_pOutClassImg) && 
ipsdk::processor::ifIsSet (_pOutOptPosterizedImg,
 ipsdk::imaproc::matchSizeAndType (_pInHomogeneousImg,_pOutOptPosterizedImg)) && 
ipsdk::processor::ifIsSet (_pOutOptWkClassImg,
 ipsdk::imaproc::matchSizeAndType (_pOutClassImg,_pOutOptWkClassImg)) && 
ipsdk::imaproc::customImageProperty (_pOutClassImg,
 allowedClassImgBuffersFromNbClusters (_pInNbClusters)) && 
ipsdk::processor::If (
 ipsdk::processor::isSet (_pInOptSingleGreyMaskImg),
 ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_3d,_pInHomogeneousImg,_pInOptSingleGreyMaskImg),
 ipsdk::processor::none ())

Member Function Documentation

◆ getStorage()

template<typename TAttribute >
TAttribute::StorageType ipsdk::imaproc::classif::KMeansImgLvl1::getStorage ( )

retrieve storage associated to a given attribute

Note
This method is only available for Output and In/Out attributes
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionif isInit() == false

◆ retrieveProvider()

ipsdk::processor::RetrievalResult ipsdk::imaproc::classif::KMeansImgLvl1::retrieveProvider ( const ipsdk::core::BasePriority priority,
ipsdk::ipUInt32  curNbIter,
ipsdk::core::ActionProviderPtr pProvider 
)
protected

method allowing to retrieve provider associated to asynchronous processing in derived class

Returns
provider retrieval result.
Note
On success provider pointer must not be null nor uninitialized

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