IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Classes | Functions

Logical formula measure used during shape filtering. More...

Classes

class  ipsdk::imaproc::shape::analysis::LogicFormulaMsr
 Measurement object for measure LogicFormula. More...
 
class  ipsdk::imaproc::shape::analysis::LogicFormulaMsrInfo
 Information object for measure LogicFormula. More...
 
class  ipsdk::imaproc::shape::analysis::LogicFormulaMsrParams
 Parameter object for measure LogicFormula. More...
 

Functions

IPSDKIPLSHAPEANALYSIS_API LogicFormulaMsrParamsPtr ipsdk::imaproc::shape::analysis::createLogicFormulaMsrParams (const std::string &formulaStr)
 function allowing to create a new parameter object for LogicFormula measure
 

Detailed Description

Logical formula measure used during shape filtering.

Formula measure is associated to a formula string (an equation) which will be used to compute measure results.

During measure creation, formula string will be preprocessed to validate formula syntax and extract associated operands, operators and functions.

Then during measure evaluation, formula will be evaluated in specialized case associated to each shape.

Note
Global equation type must be logic. Formula measure is indeed associated to ipsdk::ipBool results and then global equation type must be associated to a ipsdk::shape::analysis::eMsrFormulaResultType::eMFRT_Logic type.

See Measure Formula for more informations about measure formula syntax and usage.

Here is an example of logical formula measurement with used formula :

\[ \begin{matrix} (Area2dMsr > 1000) \\ and \\ (MeanMsr\left \{red\right \} < 140) \end{matrix} \]

logicFormulaMsr.png
Author
E. Noirfalise
Date
2015/07/30

Logical formula measure used during shape filtering

Measure synthesis :

Measure Type Measure Unit Type Parameter Type Result Type Shape Requirements
Generic.png
Generic
none.png
None
parameter.png
LogicFormulaMsrParams
Value.png
Value (ipsdk::ipBool)
none.png
None
See Shape measurement for additional information on these pictograms

Measure Type :

This is a generic measure

Measure Unit Type:

Measure LogicFormula is not associated to any unit [ipsdk::shape::analysis::eMsrUnitFormat::eMUF_NoUnit]

Measure Parameter Type :

Measure LogicFormula is associated to LogicFormulaMsrParams parameters

Measure Result Type :

Measure LogicFormula is associated to ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipBool> results

Measure Shape Requirements :

Measure LogicFormula does not requires anything from shape data

Measure Dependencies :

Measure LogicFormula has no dependency

Example of C++ code :

Example informations

Associated library

IPSDKIPLShapeAnalysis

Code Example

// opening grey level input image
ImagePtr pInGreyImg2d = loadTiffImageFile(inputGreyImgPath);
// read entity shape 2d collection used for processing
Shape2dCollPtr pShape2dColl = boost::make_shared<Shape2dColl>();
readFromXmlFile(inputShape2dCollPath, *pShape2dColl);
// define a measure info set
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create2dInstance();
// create a formula which depends on Area2d
// this measure will be used with respect to its default parameters
createMeasureInfo(pMeasureInfoSet, "MyFormula1", "LogicFormulaMsr", createLogicFormulaMsrParams("PolygonArea2dMsr > 10000"));
// create same formula by using a 'pre-parameterized' PolygonArea2d measure
createMeasureInfo(pMeasureInfoSet, "AreaMinusHoles", "PolygonArea2dMsr", createHolesBasicPolicyMsrParams(true));
createMeasureInfo(pMeasureInfoSet, "MyFormula2", "LogicFormulaMsr", createLogicFormulaMsrParams("AreaMinusHoles / (Perimeter2dMsr^2) > 0.05"));
// create a formula which use geometric image constants
createMeasureInfo(pMeasureInfoSet, "MyFormula3", "LogicFormulaMsr", createLogicFormulaMsrParams("BoundingBoxCenterXMsr > ImageCenterX"));
// create a formula which use photometric image constants
createMeasureInfo(pMeasureInfoSet, "MyFormula4", "LogicFormulaMsr", createLogicFormulaMsrParams("MeanMsr > (PlanMaxGL + PlanMinGL) / 2"));
// compute measure on shape 2d collection
MeasureSetPtr pOutMeasureSet = shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
// retrieve associated results
const MeasureConstPtr& pFormula1OutMsr = pOutMeasureSet->getMeasure("MyFormula1");
const std::vector<ipBool>& pOutResults1 = extractValueResults<ipBool>(pFormula1OutMsr);
const MeasureConstPtr& pFormula2OutMsr = pOutMeasureSet->getMeasure("MyFormula2");
const std::vector<ipBool>& pOutResults2 = extractValueResults<ipBool>(pFormula2OutMsr);
const MeasureConstPtr& pFormula3OutMsr = pOutMeasureSet->getMeasure("MyFormula3");
const std::vector<ipBool>& pOutResults3 = extractValueResults<ipBool>(pFormula3OutMsr);
const MeasureConstPtr& pFormula4OutMsr = pOutMeasureSet->getMeasure("MyFormula4");
const std::vector<ipBool>& pOutResults4 = extractValueResults<ipBool>(pFormula4OutMsr);