Image formula syntax and usage.
More...
|
| enum | ipsdk::image::tools::eImageFormulaResultType { ipsdk::image::tools::eIFRT_Logic,
ipsdk::image::tools::eIFRT_Arithmetic
} |
| | Enumerate describing image formula result type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaImageType { ipsdk::image::tools::eIFIT_Image2d,
ipsdk::image::tools::eIFIT_Image3d
} |
| | Enumerate describing image formula image type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaOperatorType {
ipsdk::image::tools::eIFOT_UnaryPlus,
ipsdk::image::tools::eIFOT_UnaryMinus,
ipsdk::image::tools::eIFOT_Not,
ipsdk::image::tools::eIFOT_Plus,
ipsdk::image::tools::eIFOT_Minus,
ipsdk::image::tools::eIFOT_Multiply,
ipsdk::image::tools::eIFOT_Divide,
ipsdk::image::tools::eIFOT_Power,
ipsdk::image::tools::eIFOT_And,
ipsdk::image::tools::eIFOT_Or,
ipsdk::image::tools::eIFOT_Equal,
ipsdk::image::tools::eIFOT_NotEqual,
ipsdk::image::tools::eIFOT_Greater,
ipsdk::image::tools::eIFOT_GreaterOrEqual,
ipsdk::image::tools::eIFOT_Lower,
ipsdk::image::tools::eIFOT_LowerOrEqual
} |
| | Enumerate describing image formula operation type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaUnaryArithmeticFunctionType {
ipsdk::image::tools::eIFUAFT_Abs,
ipsdk::image::tools::eIFUAFT_Sqrt,
ipsdk::image::tools::eIFUAFT_Exp,
ipsdk::image::tools::eIFUAFT_Log,
ipsdk::image::tools::eIFUAFT_Cos,
ipsdk::image::tools::eIFUAFT_Sin,
ipsdk::image::tools::eIFUAFT_Tan,
ipsdk::image::tools::eIFUAFT_ACos,
ipsdk::image::tools::eIFUAFT_ASin,
ipsdk::image::tools::eIFUAFT_ATan
} |
| | Enumerate describing image formula unary arithmetical function type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaBinaryArithmeticFunctionType { ipsdk::image::tools::eIFBAFT_ATan2
} |
| | Enumerate describing image formula binary arithmetical function type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaGenericArithmeticFunctionType {
ipsdk::image::tools::eIFGAFT_Min,
ipsdk::image::tools::eIFGAFT_Max,
ipsdk::image::tools::eIFGAFT_Sum,
ipsdk::image::tools::eIFGAFT_Mean,
ipsdk::image::tools::eIFGAFT_Median,
ipsdk::image::tools::eIFGAFT_StdDev,
ipsdk::image::tools::eIFGAFT_Variance,
ipsdk::image::tools::eIFGAFT_NormL1,
ipsdk::image::tools::eIFGAFT_NormL2
} |
| | Enumerate describing image formula generic arithmetical function type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaCoupledArithmeticFunctionType { ipsdk::image::tools::eIFCAFT_Distance
} |
| | Enumerate describing image formula coupled arithmetical function type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaTernaryLogicFunctionType { ipsdk::image::tools::eIFTLFT_If
} |
| | Enumerate describing image formula ternary logical function type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaMapFunctionType { ipsdk::image::tools::eIFMFT_Lut
} |
| | Enumerate describing image formula map function type. More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaStaticBoolean { ipsdk::image::tools::eIFSB_True,
ipsdk::image::tools::eIFSB_False
} |
| | enumerate describing formula static boolean More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaStaticConstant { ipsdk::image::tools::eIFSC_Pi,
ipsdk::image::tools::eIFSC_E
} |
| | enumerate describing formula static constants More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaDynamicConstant {
ipsdk::image::tools::eIFDC_PointXCoord,
ipsdk::image::tools::eIFDC_PointYCoord,
ipsdk::image::tools::eIFDC_PointZCoord,
ipsdk::image::tools::eIFDC_ImageSizeX,
ipsdk::image::tools::eIFDC_ImageSizeY,
ipsdk::image::tools::eIFDC_ImageSizeZ,
ipsdk::image::tools::eIFDC_ImageCenterX,
ipsdk::image::tools::eIFDC_ImageCenterY,
ipsdk::image::tools::eIFDC_ImageCenterZ
} |
| | enumerate describing formula dynamic constants More...
|
| |
| enum | ipsdk::image::tools::eFormulaImageId {
ipsdk::image::tools::eFII_GreyLevelImage1,
ipsdk::image::tools::eFII_GreyLevelImage2,
ipsdk::image::tools::eFII_GreyLevelImage3,
ipsdk::image::tools::eFII_BinaryImage1,
ipsdk::image::tools::eFII_BinaryImage2,
ipsdk::image::tools::eFII_BinaryImage3,
ipsdk::image::tools::eFII_LabelImage1,
ipsdk::image::tools::eFII_LabelImage2,
ipsdk::image::tools::eFII_LabelImage3
} |
| | enumerate allowing to identify an image More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaImageConstant {
ipsdk::image::tools::eIFIC_GLMin,
ipsdk::image::tools::eIFIC_GLMax,
ipsdk::image::tools::eIFIC_GLMean,
ipsdk::image::tools::eIFIC_GLStdDev,
ipsdk::image::tools::eIFIC_GLVariance
} |
| | enumerate describing formula image constants More...
|
| |
| enum | ipsdk::image::tools::eImageFormulaStructuringElement {
ipsdk::image::tools::eIFSE_Square,
ipsdk::image::tools::eIFSE_Cube,
ipsdk::image::tools::eIFSE_Rectangle,
ipsdk::image::tools::eIFSE_Circle,
ipsdk::image::tools::eIFSE_Sphere,
ipsdk::image::tools::eIFSE_Linear,
ipsdk::image::tools::eIFSE_HalfLinear
} |
| | enumerate describing formula structuring elements More...
|
| |
Image formula syntax and usage.
Introduction
Image formula are string representation of classical equations composed of elementary items :
- operators
- functions
- operands (constant or variable values)
Usage of such a formula is classically associated to two stages :
- a preprocessing stage which ensure formula syntax validity and extraction of elementary items constituting formula.
- some evaluation stages were variable values are set with respect to concrete situations.
Result type
For convenience, formula result types are restricted to two values types :
- Note
- Order of operations respect standard operator precedence rules.
- See also
- https://en.wikipedia.org/wiki/Order_of_operations
- Note
- Parenthesis can be freely used
Image type
Image formula framework can be used with 2d or 3d images (see ipsdk::image::tools::eImageFormulaImageType). Some formula features will be customized depending on image type (image coordinates, structuring elements type, ...).
Formula operators
This section regroups information about used formula operators. Formula operators are described by ipsdk::image::tools::eImageFormulaOperatorType enumerate.
These operators allow all classical equation combinations such as :
or
- Note
- Associated result type will depends on operators combination.
Formula functions
This section describes formula functions available with IPSDK image formula framework.
Formula arithmetic functions
Formula unary arithmetical functions
Formula unary arithmetical functions are described by ipsdk::image::tools::eImageFormulaUnaryArithmeticFunctionType enumerate.
These functions allow introduction of unary arithmetic functions into equations such as :
or
- Note
- These functions are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Function operand must be associated to a ipsdk::ipReal64 type.
Formula binary arithmetical functions
Formula binary arithmetical functions are described by ipsdk::image::tools::eImageFormulaBinaryArithmeticFunctionType enumerate.
These functions allow introduction of binary arithmetic functions into equations such as :
or
- Note
- These functions are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Function operands must be associated to a ipsdk::ipReal64 type.
Formula generic arithmetical functions
Formula generic arithmetical functions are described by ipsdk::image::tools::eImageFormulaGenericArithmeticFunctionType enumerate.
These functions allow introduction of arithmetic functions using variable arguments list into equations such as :
or
These functions can be used with one or more operands.
- Note
- These functions are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Function operand must be associated to a ipsdk::ipReal64 type.
Formula couple arithmetical functions
Formula couple arithmetical functions are described by ipsdk::image::tools::eImageFormulaCoupledArithmeticFunctionType enumerate.
These functions allow introduction of arithmetic functions using coupled variable arguments list into equations such as :
or
- Note
- These functions are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Function operand must be associated to a ipsdk::ipReal64 type.
Formula ternary logical functions
Formula ternary logical functions are described by ipsdk::image::tools::eImageFormulaTernaryLogicFunctionType enumerate.
At this time a single function is available in this group
:
or
or
Function evaluation returns :
if
is evaluated to
boolean value
if
is evaluated to
boolean value
- Note
- Associated operands types must respect following rules :
Mapping functions
Mapping functions are described by ipsdk::image::tools::eImageFormulaMapFunctionType enumerate.
At this time a single function is available in this group
:
where
is a logical predicate associated to a target value.
Function evaluation returns :
- Target value associated to first valid predicate.
- If none of provided predicates are valid :
if this optional value has been set
- zero if
has not been set and global result type is arithmetic
- false if
has not been set and global result type is logic
- Note
- Associated operands types must respect following rules :
Formula operands
This section regroups information about used formula operands. Formula operands can be represented in following forms :
- Note
- Note that string used in equations are not case sensitive.
Formula constant operands
Formula static constant operands
Formula static constant operands are described by ipsdk::image::tools::eImageFormulaStaticConstant enumerate. These constants will be replaced in equation by their numeric value :
will be replaced by its numerical value.
Formula dynamic constant operands
Formula dynamic constant operands are described by ipsdk::image::tools::eImageFormulaDynamicConstant enumerate. These constants will be replaced in equation by value extracted from used image informations.
These constants can be introduced into equations as follows :
- Note
- These constants are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Formula image constant operands
Formula image constant operands are described by ipsdk::image::tools::eImageFormulaImageConstant enumerate. Each constant depends on an image id, see Formula variable operands. These constants will be replaced in equation by value extracted from used image informations.
These constants can be introduced into equations as follows :
- Note
- These constants are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Formula variable operands
Basic usage of formula variable operands
Formula variable operands are associated image identifier (see ipsdk::image::tools::eFormulaImageId). These variable names can refer to :
Example :
In this case, we apply a mask operation which leads to
where
pixels are set and to
otherwise.
- Note
- These variables are associated to a ipsdk::image::tools::eImageFormulaResultType::eMFRT_Arithmetic result type.
Applying offset on formula variable operands
Previous image variable operands can be used with combination of an offset value with format
in 2d case and
in 3d case, where
,
and
represent an offset along
,
and
directions beside current image position.
In 2d case we can use a formula such as :
to compute a local "cross like" mean smoothing operation.
In 3d case this operation becomes :
to compute a local "cross like" mean smoothing operation.
Applying structuring elements on formula variable operands
As an extension of image offset combination capabilities, image formula allow usable of structuring elements. These features are described by ipsdk::image::tools::eImageFormulaStructuringElement enumerate.
A square structuring element such as :
will simply be replaced by its decomposition (in 2d case) :
This allows for example simple image smoothing operations (median filter with a circular structuring element in this case):
or morphological operations (erosion with a square structuring element in this case) :
◆ eImageFormulaResultType
Enumerate describing image formula result type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFRT_Logic | Image formula is associated to a logical result.
|
| eIFRT_Arithmetic | Image formula is associated to an arithmetical result.
|
◆ eImageFormulaImageType
Enumerate describing image formula image type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFIT_Image2d | Image Formula is used with 2d image.
|
| eIFIT_Image3d | Image Formula is used with 3d image.
|
◆ eImageFormulaOperatorType
Enumerate describing image formula operation type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFOT_UnaryPlus | Addition unary operator [example : '+value'].
|
| eIFOT_UnaryMinus | Subtraction unary operator [example : '-value'].
|
| eIFOT_Not | Logical not unary operator [example : '!value'].
|
| eIFOT_Plus | Addition binary operator [example : 'value1 + value2'].
|
| eIFOT_Minus | Subtraction binary operator [example : 'value1 - value2'].
|
| eIFOT_Multiply | Multiplication binary operator [example : 'value1 * value2'].
|
| eIFOT_Divide | Division binary operator [example : 'value1 / value2'].
|
| eIFOT_Power | Power binary operator [example : 'value1 ^ value2'].
|
| eIFOT_And | Logical and binary operator [example : 'value1 && value2'].
|
| eIFOT_Or | Logical or binary operator [example : 'value1 || value2'].
|
| eIFOT_Equal | Equal comparison operator [example : 'value1 == value2'].
|
| eIFOT_NotEqual | Not equal comparison operator [example : 'value1 != value2'].
|
| eIFOT_Greater | Greater comparison operator [example : 'value1 > value2'].
|
| eIFOT_GreaterOrEqual | Greater or equal comparison operator [example : 'value1 >= value2'].
|
| eIFOT_Lower | Lower comparison operator [example : 'value1 < value2'].
|
| eIFOT_LowerOrEqual | Lower or equal comparison operator [example : 'value1 <= value2'].
|
◆ eImageFormulaUnaryArithmeticFunctionType
Enumerate describing image formula unary arithmetical function type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFUAFT_Abs | Absolute value [example : 'abs(value)'].
|
| eIFUAFT_Sqrt | Square root value [example : 'sqrt(value)'].
|
| eIFUAFT_Exp | Exponential value [example : 'exp(value)'].
|
| eIFUAFT_Log | Neperian logarithm value [example : 'log(value)'].
|
| eIFUAFT_Cos | Cosinus value of an angle (in radian) [example : 'cos(value)'].
|
| eIFUAFT_Sin | Sinus value of an angle (in radian) [example : 'sin(value)'].
|
| eIFUAFT_Tan | Tangent value of an angle (in radian) [example : 'tan(value)'].
|
| eIFUAFT_ACos | Arc Cosinus value [example : 'acos(value)'].
|
| eIFUAFT_ASin | Arc Sinus value [example : 'asin(value)'].
|
| eIFUAFT_ATan | Arc Tangent value [example : 'atan(value)'].
|
◆ eImageFormulaBinaryArithmeticFunctionType
Enumerate describing image formula binary arithmetical function type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFBAFT_ATan2 | Arc Tangent value [example : 'atan2(valueY, valueX)'].
|
◆ eImageFormulaGenericArithmeticFunctionType
Enumerate describing image formula generic arithmetical function type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFGAFT_Min | Minimum value computation [example : 'min(value1, value2, value3, ...)'].
|
| eIFGAFT_Max | Maximum value computation [example : 'max(value1, value2, value3, ...)'].
|
| eIFGAFT_Sum | Sum value computation [example : 'sum(value1, value2, value3, ...)'].
|
| eIFGAFT_Mean | Mean value computation [example : 'mean(value1, value2, value3, ...)'].
|
| eIFGAFT_Median | Median value computation [example : 'median(value1, value2, value3, ...)'].
|
| eIFGAFT_StdDev | Standard deviation value computation [example : 'stddev(value1, value2, value3, ...)'].
|
| eIFGAFT_Variance | Variance value computation [example : 'variance(value1, value2, value3, ...)'].
|
| eIFGAFT_NormL1 | L1 norm (ie. absolute value norm) computation [example : 'normL1(value1, value2, value3, ...)'].
|
| eIFGAFT_NormL2 | L2 norm (ie. euclidian norm) computation [example : 'normL2(value1, value2, value3, ...)'].
|
◆ eImageFormulaCoupledArithmeticFunctionType
Enumerate describing image formula coupled arithmetical function type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFCAFT_Distance | Distance value computation [example : 'distance(x0, x1, y0, y1, ...)', with a list of arguments formed by cuples].
|
◆ eImageFormulaTernaryLogicFunctionType
Enumerate describing image formula ternary logical function type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFTLFT_If | If logical ternary function [example : 'if(predicateValue, successValue, failureValue)'].
|
◆ eImageFormulaMapFunctionType
Enumerate describing image formula map function type.
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFMFT_Lut | Look up table mapping function [example : 'lut(I1>200:200, I1<100:100; I1)']
This must be a string such as 'lut(pred1:val1, ..., predN:valN2; optionalDefaultValue)'
List of predicates are tested, first valid is keeped and associated value is returned (value on the right of ':').
Optional default value is returned if no predicate is satisfied
|
◆ eImageFormulaStaticBoolean
enumerate describing formula static boolean
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFSB_True | Constant defined to true boolean value [example : 'true'].
|
| eIFSB_False | Constant defined to false boolean value [example : 'false'].
|
◆ eImageFormulaStaticConstant
enumerate describing formula static constants
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFSC_Pi | Constant defined to pi value [example : 'pi'].
|
| eIFSC_E | Constant defined to euler number value [example : 'e'].
|
◆ eImageFormulaDynamicConstant
enumerate describing formula dynamic constants
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFDC_PointXCoord | X coordinates for current point [example : 'x'].
|
| eIFDC_PointYCoord | Y coordinates for current point [example : 'y'].
|
| eIFDC_PointZCoord | Z coordinates for current point [example : 'z'] (only available in case of 3d image formula)
|
| eIFDC_ImageSizeX | Image size X [example : 'Sx'].
|
| eIFDC_ImageSizeY | Image size Y [example : 'Sy'].
|
| eIFDC_ImageSizeZ | Image size Z [example : 'Sz'] (only available in case of 3d image formula)
|
| eIFDC_ImageCenterX | Image center X [example : 'Cx'].
|
| eIFDC_ImageCenterY | Image center Y [example : 'Cy'].
|
| eIFDC_ImageCenterZ | Image center Z [example : 'Cz'] (only available in case of 3d image formula)
|
◆ eFormulaImageId
enumerate allowing to identify an image
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eFII_GreyLevelImage1 | Identifier associated to grey level image 1 [example : 'I1'].
|
| eFII_GreyLevelImage2 | Identifier associated to grey level image 2 [example : 'I2'].
|
| eFII_GreyLevelImage3 | Identifier associated to grey level image 3 [example : 'I3'].
|
| eFII_BinaryImage1 | Identifier associated to binary image 1 [example : 'B1'].
|
| eFII_BinaryImage2 | Identifier associated to binary image 2 [example : 'B2'].
|
| eFII_BinaryImage3 | Identifier associated to binary image 3 [example : 'B3'].
|
| eFII_LabelImage1 | Identifier associated to label image 1 [example : 'L1'].
|
| eFII_LabelImage2 | Identifier associated to label image 2 [example : 'L2'].
|
| eFII_LabelImage3 | Identifier associated to label image 3 [example : 'L3'].
|
◆ eImageFormulaImageConstant
enumerate describing formula image constants
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFIC_GLMin | Image minimum grey level [example : 'GLMin(I1)'].
|
| eIFIC_GLMax | Image maximum grey level [example : 'GLMax(I1)'].
|
| eIFIC_GLMean | Image mean grey level [example : 'GLMean(I1)'].
|
| eIFIC_GLStdDev | Image standard deviation for grey level [example : 'GLStdDev(I1)'].
|
| eIFIC_GLVariance | Image variance for grey level [example : 'GLVar(I1)'].
|
◆ eImageFormulaStructuringElement
enumerate describing formula structuring elements
- Note
- This object is associated to a strong enumerate definition
- See also
- IPSDK_Enum
| Enumerator |
|---|
| eIFSE_Square | Square 2d structuring element [example : 'square(I1, 2)' for a 5x5 structuring element on image I1].
|
| eIFSE_Cube | Cubic 3d structuring element [example : 'cube(I1, 2)' for a 5x5x5 structuring element on image I1].
|
| eIFSE_Rectangle | Rectangular 2d/3d structuring element [example : 'rect(I1, 2, 1)' for a 5x3 structuring element on image I1, or 'rect(I1, 2, 1, 3)' for a 5x3x7 structuring element on image I1].
|
| eIFSE_Circle | Circular 2d structuring element [example : 'circle(I1, 2)' where 2 defined circle radius on image I1].
|
| eIFSE_Sphere | Spherical 3d structuring element [example : 'sphere(I1, 2)' where 2 defined sphere radius on image I1].
|
| eIFSE_Linear | Linear centered 2d/3d structuring element [example : 'seg(I1, 3.5, pi/3)' for a segment with length=2*3.5 and orientation theta=pi/3 on image I1 or 'seg(I1, 3.5, pi/3, pi/4)' for a segment with length=2*3.5 and orientation theta=pi/3 and phi=pi/4 on image I1].
|
| eIFSE_HalfLinear | Half Linear 2d/3d structuring element starting on current element [example : 'halfSeg(I1, 3.5, pi/3)' for a half segment with length=3.5 and orientation theta=pi/3 on image I1 or 'halfSeg(I1, 3.5, pi/3, pi/4)' for a half segment with length=3.5 and orientation theta=pi/3 and phi=pi/4 on image I1].
|