IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
FormulaRuleOperators.h
Go to the documentation of this file.
1 // FormulaRuleOperators.h:
3 // -----------------------
4 //
14 
15 #ifndef __IPSDKIMAGEPROCESSING_FORMULARULEOPERATORS_H__
16 #define __IPSDKIMAGEPROCESSING_FORMULARULEOPERATORS_H__
17 
24 
25 namespace ipsdk {
26 namespace imaproc {
27 
30 
39 
43 
47 matchFormulaWithImages(const ImageFormulaAttributeConstPtr& pImageFormulaAttribute,
48  const ImageAttributePtr& pInOptImg1,
49  const ImageAttributePtr& pInOptImg2,
50  const ImageAttributePtr& pInOptImg3,
51  const ImageAttributePtr& pInOptBinImg1,
52  const ImageAttributePtr& pInOptBinImg2,
53  const ImageAttributePtr& pInOptBinImg3,
54  const ImageAttributePtr& pInOptLabImg1,
55  const ImageAttributePtr& pInOptLabImg2,
56  const ImageAttributePtr& pInOptLabImg3,
57  const ImageAttributePtr& pOutImg);
58 
59 template <typename InOptImg1Type,
60  typename InOptImg2Type,
61  typename InOptImg3Type,
62  typename InOptBinImg1Type,
63  typename InOptBinImg2Type,
64  typename InOptBinImg3Type,
65  typename InOptLabImg1Type,
66  typename InOptLabImg2Type,
67  typename InOptLabImg3Type>
69 validateFormulaAndImages(const ImageFormulaAttributeConstPtr& pImageFormulaAttribute,
70  const boost::shared_ptr<InOptImg1Type>& pInOptImg1,
71  const boost::shared_ptr<InOptImg2Type>& pInOptImg2,
72  const boost::shared_ptr<InOptImg3Type>& pInOptImg3,
73  const boost::shared_ptr<InOptBinImg1Type>& pInOptBinImg1,
74  const boost::shared_ptr<InOptBinImg2Type>& pInOptBinImg2,
75  const boost::shared_ptr<InOptBinImg3Type>& pInOptBinImg3,
76  const boost::shared_ptr<InOptLabImg1Type>& pInOptLabImg1,
77  const boost::shared_ptr<InOptLabImg2Type>& pInOptLabImg2,
78  const boost::shared_ptr<InOptLabImg3Type>& pInOptLabImg3,
79  const ImageAttributePtr& pOutImg)
80 {
81  return matchFormulaWithImages(pImageFormulaAttribute,
82  pInOptImg1, pInOptImg2, pInOptImg3,
83  pInOptBinImg1, pInOptBinImg2, pInOptBinImg3,
84  pInOptLabImg1, pInOptLabImg2, pInOptLabImg3,
85  pOutImg) &&
86  processor::If(isSet(pInOptImg1),
87  processor::If(isSet(pInOptImg2), matchSizeAndType(pInOptImg1, pInOptImg2), matchSize(pInOptImg1, pOutImg)),
88  processor::none()) &&
89  processor::If(isSet(pInOptImg2),
90  processor::If(isSet(pInOptImg3),
91  matchSizeAndType(pInOptImg2, pInOptImg3),
92  matchSize(pInOptImg2, pOutImg)),
93  processor::none()) &&
94  processor::If(isSet(pInOptImg3),
95  processor::If(isSet(pInOptImg1),
96  matchSizeAndType(pInOptImg3, pInOptImg1),
97  matchSize(pInOptImg3, pOutImg)),
98  processor::none()) &&
99  processor::If(isSet(pInOptBinImg1),
100  processor::If(isSet(pInOptBinImg2),
101  matchSizeAndType(pInOptBinImg1, pInOptBinImg2),
102  matchSize(pInOptBinImg1, pOutImg)),
103  processor::none()) &&
104  processor::If(isSet(pInOptBinImg2),
105  processor::If(isSet(pInOptBinImg3),
106  matchSizeAndType(pInOptBinImg2, pInOptBinImg3),
107  matchSize(pInOptBinImg2, pOutImg)),
108  processor::none()) &&
109  processor::If(isSet(pInOptBinImg3),
110  processor::If(isSet(pInOptBinImg1),
111  matchSizeAndType(pInOptBinImg3, pInOptBinImg1),
112  matchSize(pInOptBinImg3, pOutImg)),
113  processor::none()) &&
114  processor::If(isSet(pInOptLabImg1),
115  processor::If(isSet(pInOptLabImg2),
116  matchSizeAndType(pInOptLabImg1, pInOptLabImg2),
117  matchSize(pInOptLabImg1, pOutImg)),
118  processor::none()) &&
119  processor::If(isSet(pInOptLabImg2),
120  processor::If(isSet(pInOptLabImg3),
121  matchSizeAndType(pInOptLabImg2, pInOptLabImg3),
122  matchSize(pInOptLabImg2, pOutImg)),
123  processor::none()) &&
124  processor::If(isSet(pInOptLabImg3),
125  processor::If(isSet(pInOptLabImg1),
126  matchSizeAndType(pInOptLabImg3, pInOptLabImg1),
127  matchSize(pInOptLabImg3, pOutImg)),
128  processor::none());
129 }
130 
133 
134 } // end of namespace imaproc
135 } // end of namespace ipsdk
136 
137 #endif // __IPSDKIMAGEPROCESSING_FORMULARULEOPERATORS_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Base operators used to combined rules.
IPSDKBASEPROCESSING_API RulePtr none()
function allowing to define an empty rule (always true)
boost::shared_ptr< BaseRule > RulePtr
shared pointer to rule
Definition: RuleTypes.h:104
Definition of import/export macro for library.
Operators used to enable rules on images.
Predefined operators for rules on optional attributes.
Predefined types for formula rules management.
boost::shared_ptr< const BaseImageFormulaAttribute > ImageFormulaAttributeConstPtr
Definition: FormulaAttributeTypes.h:48
#define IPSDKIMAGEPROCESSING_API
Import/Export macro for library IPSDKImageProcessing.
Definition: IPSDKImageProcessingExports.h:25
boost::weak_ptr< const BaseImageFormulaAttribute > ImageFormulaAttributeConstWeakPtr
Definition: FormulaAttributeTypes.h:54
boost::shared_ptr< BaseImageAttribute > ImageAttributePtr
Definition: ImageAttributeTypes.h:24
Predefined types for image attributes management.
boost::weak_ptr< const BaseMeasureFormulaAttribute > MeasureFormulaAttributeConstWeakPtr
Definition: FormulaAttributeTypes.h:66
IPSDKIMAGEPROCESSING_API processor::RulePtr isLogicMeasure(const MeasureFormulaAttributeConstWeakPtr &pAttribute)
function allowing to check that a formula is a measure formula associated to a given returned type ...
IPSDKIMAGEPROCESSING_API processor::RulePtr matchSizeAndType(const ImageAttributeConstWeakPtr &pAttribute1, const ImageAttributeConstWeakPtr &pAttribute2)
function allowing to check that two images have same buffer type and size
IPSDKIMAGEPROCESSING_API processor::RulePtr isValidImageFormula(const ImageFormulaAttributeConstWeakPtr &pAttribute)
function allowing to check that an image formula is valid
boost::enable_if_c< AttributeType::g_bOptional, RulePtr >::type isSet(const boost::shared_ptr< AttributeType > &pAttribute)
Definition: OptionalRuleOperators.h:33
processor::RulePtr matchSize(const eMatchImageSizeType &matchImageSizeType, const eMatchImageSizeScale &matchImageSizeScale, const ImageAttributeConstWeakPtr &pImageAttribute, const boost::shared_ptr< LeafAttributeType > &pLeafAttribute)
function allowing to check that a DataItem leaf value is lower than or equals to image size on consid...
Definition: ImageBinaryMixedRuleOperators.h:41
IPSDKIMAGEPROCESSING_API processor::RulePtr matchFormulaWithImages(const ImageFormulaAttributeConstPtr &pImageFormulaAttribute, const ImageAttributePtr &pInOptImg1, const ImageAttributePtr &pInOptImg2, const ImageAttributePtr &pInOptImg3, const ImageAttributePtr &pInOptBinImg1, const ImageAttributePtr &pInOptBinImg2, const ImageAttributePtr &pInOptBinImg3, const ImageAttributePtr &pInOptLabImg1, const ImageAttributePtr &pInOptLabImg2, const ImageAttributePtr &pInOptLabImg3, const ImageAttributePtr &pOutImg)
function allowing to check that an image formula match with proceeded images
IPSDKBASEPROCESSING_API RulePtr If(const RulePtr &pPredicate, const RulePtr &pRuleTrue)
function allowing to define a conditional condition check rule
IPSDKIMAGEPROCESSING_API processor::RulePtr isArithmeticMeasure(const MeasureFormulaAttributeConstWeakPtr &pAttribute)
function allowing to check that a formula is a measure formula associated to a given returned type ...