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

Arithmetic formula measure associated to a formula string. More...

Classes

class  ipsdk::imaproc::shape::analysis::ArithmeticFormulaMsr
 Measurement object for measure ArithmeticFormula. More...
 
class  ipsdk::imaproc::shape::analysis::ArithmeticFormulaMsrInfo
 Information object for measure ArithmeticFormula. More...
 
class  ipsdk::imaproc::shape::analysis::ArithmeticFormulaMsrParams
 Parameter object for measure ArithmeticFormula. More...
 

Functions

IPSDKIPLSHAPEANALYSIS_API ArithmeticFormulaMsrParamsPtr ipsdk::imaproc::shape::analysis::createArithmeticFormulaMsrParams (const std::string &formulaStr)
 function allowing to create a new parameter object for ArithmeticFormula measure
 

Detailed Description

Arithmetic formula measure associated to a formula string.

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 arithmetic. Formula measure is indeed associated to ipsdk::ipReal64 results and then global equation type must be associated to a ipsdk::shape::analysis::eMsrFormulaResultType::eMFRT_Arithmetic type.

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

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

\[ \frac{Area2dMsr}{ConvexHullArea2dMsr} \]

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

Arithmetic formula measure associated to a formula string

Measure synthesis :

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

Measure Type :

This is a generic measure

Measure Unit Type:

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

Measure Parameter Type :

Measure ArithmeticFormula is associated to ArithmeticFormulaMsrParams parameters

Measure Result Type :

Measure ArithmeticFormula is associated to ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipReal64> results

Measure Shape Requirements :

Measure ArithmeticFormula does not requires anything from shape data

Measure Dependencies :

Measure ArithmeticFormula 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 and Perimeter 2d measures
// these measures will be used with respect to their default parameters
createMeasureInfo(pMeasureInfoSet, "MyFormula1", "ArithmeticFormulaMsr", createArithmeticFormulaMsrParams("PolygonArea2dMsr / Perimeter2dMsr"));
// create same formula by using a 'pre-parameterized' Area2d measure
createMeasureInfo(pMeasureInfoSet, "AreaMinusHoles", "PolygonArea2dMsr", createHolesBasicPolicyMsrParams(true));
createMeasureInfo(pMeasureInfoSet, "MyFormula2", "ArithmeticFormulaMsr", createArithmeticFormulaMsrParams("AreaMinusHoles / Perimeter2dMsr"));
// create a formula which is a combination of other formula
createMeasureInfo(pMeasureInfoSet, "MyFormula3", "ArithmeticFormulaMsr", createArithmeticFormulaMsrParams("(MyFormula1 + MyFormula2) / 2"));
// create a formula which use geometric image constants
createMeasureInfo(pMeasureInfoSet, "MyFormula4", "ArithmeticFormulaMsr", createArithmeticFormulaMsrParams("(BoundingBoxCenterXMsr - ImageCenterX) / ImageSizeX"));
// create a formula which use photometric image constants
createMeasureInfo(pMeasureInfoSet, "MyFormula5", "ArithmeticFormulaMsr", createArithmeticFormulaMsrParams("(MeanMsr - PlanMinGL) / (PlanMaxGL - PlanMinGL)"));
// compute measure on shape 2d collection
MeasureSetPtr pOutMeasureSet = shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
// retrieve associated results
const MeasureConstPtr& pFormula1OutMsr = pOutMeasureSet->getMeasure("MyFormula1");
const std::vector<ipReal64>& pOutResults1 = extractValueResults<ipReal64>(pFormula1OutMsr);
const MeasureConstPtr& pFormula2OutMsr = pOutMeasureSet->getMeasure("MyFormula2");
const std::vector<ipReal64>& pOutResults2 = extractValueResults<ipReal64>(pFormula2OutMsr);
const MeasureConstPtr& pFormula3OutMsr = pOutMeasureSet->getMeasure("MyFormula3");
const std::vector<ipReal64>& pOutResults3 = extractValueResults<ipReal64>(pFormula3OutMsr);
const MeasureConstPtr& pFormula4OutMsr = pOutMeasureSet->getMeasure("MyFormula4");
const std::vector<ipReal64>& pOutResults4 = extractValueResults<ipReal64>(pFormula4OutMsr);
const MeasureConstPtr& pFormula5OutMsr = pOutMeasureSet->getMeasure("MyFormula5");
const std::vector<ipReal64>& pOutResults5 = extractValueResults<ipReal64>(pFormula5OutMsr);