class to define a custom measure. More...
#include <ImageViz/Nodes/Measures/SoDataMeasureCustom.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoDataMeasureCustom () | |
virtual const SbString & | getMeasureName () const |
virtual UnitDimension | getUnitDimension () const |
virtual ResultFormat | getFormat () const |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoSFString | measureName |
SoSFString | formula |
A custom measure is defined by a string formula that can use other custom or predefined measure. It must have a unique name.
// Example of code to define a custom measure using two predefined measure and // defined as the ratio of the Volume/Area. SoDataMeasureCustom* myMeasure1 = new SoDataMeasureCustom(); myMeasure1->measureName = "myMeasure1"; myMeasure1->formula = SoDataMeasurePredefined::getName(SoDataMeasurePredefined::VOLUME) + "/" + SoDataMeasurePredefined::getName(SoDataMeasurePredefined::AREA); // myMeasure1 can in turn be used to define an other custom measure, define as 2*myMeasure1 SoDataMeasureCustom* myMeasure2 = new SoDataMeasureCustom(); myMeasure2->measureName = "myMeasure2"; myMeasure2->formula = myMeasure1.getMeasureName() + "*2";
Remarks :
The following syntax can be used to define a formula :
() : brackets allowing to group elements and to modify operators precedence
example : (2 + 3)*4
+ : unary arithmetic operator [plus]
example : + a
- : unary arithmetic operator [minus]
example : - b
+ : binary arithmetic operator [plus]
example : a + b
- : binary arithmetic operator [minus]
example : a - b
* : binary arithmetic operator [multiply]
example : a * b
/ : binary arithmetic operator [divide]
example : a / b
remark : a division by 0 returns the value 0 in order to avoid exceptions.
** : binary arithmetic operator [pow]
example : a ** b
! : unary logical operator [not]
example : !(a>b)
&& : or And : binary logical operator [and]
example : (a>b) && (a<c)
example : (a>c) And (a<c)
remark : And : operator must not be directely attached to alpha numerical symbols.
|| : or Or : binary logical operator [or]
example : (a>b) || (a<c)
example : (a>b) Or (a<c)
remark : Or : operator must not be directely attached to alpha numerical symbols.
== : comparison operator (logical and arithmetic) [equal]
example : a==b
example : true==true
!= : comparison operator (logical and arithmetic) [different]
example : a != b
example : true != false
< : arithmetic comparison operator [strictly inferior]
example : a < b
<= : arithmetic comparison operator [less]
example : a<= b
> : arithmetic comparison operator [strictly superior]
example : a > b
>= : arithmetic comparison operator [superior]
example : a >= b
Pi : , the pi constant
example : 3 * Pi
E : , the Euler's constant
example : 2 * E
True : the true boolean value
example : (3<Pi)==True
False : the false boolean value
example : (3>Pi)==False
NbFeret : distribution size for feret measures
example : 3*NbFeret
gx : , gy : and gz : image X, Y and Z size associated to measure
example : 3*gx
remark : not available for custom filters
cx : , cy : and cz : stand for pixel real size according to calibration
example : 3*cx
remark : not available for custom filters
Abs : absolute value of a numerical value
example : abs(a)
Sqrt : square root value of a numerical value
example : sqrt(a)
remark : a must be positive or null
Exp : exponential value of a numerical value
example : exp(a)
Log : natural logarithm value of a numerical value
example : log(a)
remark : a must be strictly positive
Cos : cosine value of a numerical value
example : cos(a)
Sin : sine value of a numerical value
example : sin(a)
Tan : tangent value of a numerical value
example : tan(a)
ACos : arccosine value of a numerical value
example : acos(a)
remark : a must within range [-1, 1]
ASin : sine arcvalue of a numerical value
example : asin(a)
remark : a must within range [-1, 1]
ATan : arctangent value of a numerical value
example : atan(a)
ATan2 : arctangent value of a 2d point
example : atan(y, x)
CosH : hyperbolic cosine value of a numerical value
example : cosh(a)
SinH : hyperbolic sine value of a numerical value
example : sinh(a)
TanH : hyperbolic tangent value of a numerical value
example : tanh(a)
Min : retrieve minimum value of a variable sized set of numerical values
example : min(a, b, c, d)
Max : retrieve maximum value of a variable sized set of numerical values
example : max(a, b, c, d, e)
Avg : retrieve mean value of a variable sized set of numerical values
example : avg(a, b, c)
Median : retrieve median value of a variable sized set of numerical values
example : median(a, b, c, d)
Sum : compute the sum of a variable sized set of numerical values
example : sum(a, b, c)
Sum : compute the product of a variable sized set of numerical values
example : product(a, b, c, d, e)
If : : conditional evaluation of an expression
example : if(predicat, value_true, value_false)
remark : Each member of a conditional expression is systematically evaluated even if it is not supposed to be reached by the condition. Thus an instruction can raise an error even if the condition is supposed to prevent invalid evaluations.
example: if(I1<=0, 0, log(I1)) will raise an error if a voxel value is lower or equal to 0 since the log expression will be evaluated before the if statement.
SoDataMeasurePredefined, SoLabelAnalysisQuantification, SoFilterAnalysisQuantification, SoGlobalAnalysisQuantification, SoFilterByMeasureProcessing, SoSieveLabelingProcessing, SoAdaptiveThresholdingProcessing
SoDataMeasureCustom::SoDataMeasureCustom | ( | ) |
Default constructor.
static SoType SoDataMeasureCustom::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoDataMeasure.
virtual ResultFormat SoDataMeasureCustom::getFormat | ( | ) | const [virtual] |
Returns the "result format" of the result data. . Default is FLOAT
Implements SoDataMeasure.
virtual const SbString& SoDataMeasureCustom::getMeasureName | ( | ) | const [inline, virtual] |
Returns the name of this measure. This name can be then used in custom measure formula
Implements SoDataMeasure.
virtual SoType SoDataMeasureCustom::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoDataMeasure.
virtual UnitDimension SoDataMeasureCustom::getUnitDimension | ( | ) | const [virtual] |
Returns the "unit dimension" of the result data. . Default is NOUNIT
Implements SoDataMeasure.
Formula describing the custom measure.
Measure name that can be used in custom measure combination formula.