IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
KMeansAssignImgLvl1.h
1 // KMeansAssignImgLvl1.h:
3 // ----------------------
4 //
14 
15 #ifndef __IPSDKIPLCLASSIFICATION_KMEANSASSIGNIMGLVL1_H__
16 #define __IPSDKIPLCLASSIFICATION_KMEANSASSIGNIMGLVL1_H__
17 
23 
24 // Attributes headers
25 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/InClustersCenters.h>
26 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/OutKMeansAssignmentInfo.h>
27 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/OutOptKMeansAssignmentInfo.h>
28 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Input/InHomogeneousImg.h>
29 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Output/OutClassImg.h>
30 #include <IPSDKIPL/IPSDKIPLAttributes/DataItem/Doubles.h>
31 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Input/Optional/InOptSingleGreyMaskImg.h>
32 
33 namespace ipsdk {
34 namespace imaproc {
35 namespace classif {
36 
39 
40 // declare processor class
41 IPSDK_DECLARE_LVL1_PROCESSOR(ASYNC1, IPSDKIPLClassification, KMeansAssignImg,
42  ipsdk::imaproc::matchSize(eMatchImageSizeType::eMIST_3d, _pInHomogeneousImg, _pOutClassImg) &&
43  ipsdk::imaproc::classif::clustersCentersCollMatchImgSize(_pInClustersCenters, _pInHomogeneousImg) &&
44  ipsdk::imaproc::customImageProperty(_pOutClassImg, allowedClassImgBuffersFromNbClusters(_pInClustersCenters)) &&
45  ipsdk::processor::If(ipsdk::processor::isSet(_pInOptSingleGreyMaskImg),
46  ipsdk::imaproc::matchSize(eMatchImageSizeType::eMIST_3d, _pInHomogeneousImg, _pInOptSingleGreyMaskImg),
48  (((ipsdk)(imaproc)(attr))(InHomogeneousImg))
49  (((ipsdk)(imaproc)(attr))(InClustersCenters))
50  (((ipsdk)(imaproc)(attr))(InOptSingleGreyMaskImg))
51  (((ipsdk)(imaproc)(attr))(OutOptKMeansAssignmentInfo))
52  (((ipsdk)(imaproc)(attr))(OutClassImg)(customOutput)(outputKMeans(_pInHomogeneousImg, _pInClustersCenters))))
53 
54 // methods
55 public:
56 
57 protected:
58  ipsdk::core::ExecResult postProcess();
59 
60  void updateKMeansAssignmentInfo();
61 
62 // attributes
63 protected:
64  attr::DoublesPtr _pFlattenedClustersCenters;
65 
66  // declaration of dispatch results collection
67  IPSDK_DECLARE_STATIC_RESULT_COLL(attr::OutKMeansAssignmentInfo, OutKMeansAssignmentInfoColl);
68 };
69 
72 
73 } // end of namespace classif
74 } // end of namespace imaproc
75 } // end of namespace ipsdk
76 
77 #endif // __IPSDKIPLCLASSIFICATION_KMEANSASSIGNIMGLVL1_H__
#define IPSDK_DECLARE_LVL1_PROCESSOR(ProcType, libraryName, algoName, RuleString, attributeSeq)
IPSDKBASEPROCESSING_API RulePtr none()
Utility functions for K-Means attribute rules management.
boost::shared_ptr< ipsdk::imaproc::attr::Doubles > DoublesPtr
shared pointer to ipsdk::imaproc::Doubles
Definition: Doubles.h:124
Definition of import/export macro for library.
processor::OutputInitializerPtr customOutput(const boost::weak_ptr< OutputAttributeType > &pOutputAttribute, const CustomImageInfoPtr &pCustomImageInfo)
Utility functions for k-means attribute output initialization management.
#define IPSDK_DECLARE_STATIC_RESULT_COLL(AttributeType, CollType)
IPSDKIPLCLASSIFICATION_API boost::shared_ptr< processor::BaseNodeCollRule > clustersCentersCollMatchImgSize(const boost::shared_ptr< const attr::InClustersCenters > &pClustersCentersAttribute, const ImageAttributeConstPtr &pImgAttribute)
boost::enable_if_c< AttributeType::g_bOptional, RulePtr >::type isSet(const boost::shared_ptr< AttributeType > &pAttribute)
IPSDKIPLCLASSIFICATION_API CustomImageInfoPtr outputKMeans(const ImageAttributeConstPtr &pInputAttribute, const boost::shared_ptr< const attr::InNbClusters > &pNbClustersAttribute)
IPSDKIPLCLASSIFICATION_API CustomCheckedImagePropertyPtr allowedClassImgBuffersFromNbClusters(const boost::shared_ptr< const attr::InNbClusters > &pInNbClustersAttribute)
IPSDKBASEPROCESSING_API RulePtr If(const RulePtr &pPredicate, const RulePtr &pRuleTrue)