Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
image_expression_type [2017/04/17 19:02] francisco [Image Neighborhood Functions] |
image_expression_type [2020/06/27 16:42] admin |
||
---|---|---|---|
Line 5: | Line 5: | ||
===== GUI Editor ===== | ===== GUI Editor ===== | ||
- | [{{ :editors:image_expression_editor.png?nolink& |Graphical representation of the image expression editor editor}}] | + | [{{ :editors:image_expression_editor.png?nolink& |Graphical representation of the image expression editor}}] |
===== Operators ===== | ===== Operators ===== | ||
Line 18: | Line 18: | ||
^ [[wp>Order_of_operations|Precedence]] ^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ^ [[wp>Order_of_operations|Precedence]] ^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ||
- | | 1 | Conditional | Execute the second or third term of the equation conditionally to the first | if@@@EXPR@@@then@@@EXPR@@@else@@@EXPR | if@@@@@@not@@@@@@isNull(i1)@@@@@@and@@@@@@isNull(i2)@@@@@@then \\ @@@@@@i3 \\ else@@@@@@if@@@@@@isNull(i1)@@@@@@then \\ @@@@@@i1@@@@@@–@@@@@@i1@@@@@@/@@@@@@i2 \\ else@@@@@@(i1@@@@@@/@@@@@@i2)@@@@@@?@@@@@@(i1@@@@@@–@@@@@@i2) | | + | | 1 | Conditional | Execute the second or third term of the equation conditionally to the first | if@@@EXPR@@@then@@@EXPR@@@else@@@EXPR | if@@@@@@not@@@@@@isNull(i1)@@@@@@and@@@@@@isNull(i2)@@@@@@then \\ @@@@@@i3 \\ else@@@@@@if@@@@@@isNull(i1)@@@@@@then \\ @@@@@@i1@@@@@@–@@@@@@i1@@@@@@/@@@@@@i2 \\ else@@@@@@(i1@@@@@@–@@@@@@i2) | |
| 2 | Boolean Or | The expression evaluation returns true if any of its arguments is true. See [[wp>Logical_disjunction#Truth_table|logical disjunction]] for additional information about the boolean logic. The evaluation is [[wp>Short-circuit_evaluation|short-circuited]]. | EXPR@@@or@@@EXPR\\ EXPR@@@<nowiki>||</nowiki>@@@EXPR | not@@@@@@isNull(i1)@@@@@@or@@@@@@isNull(i2) \\ not@@@@@@isNull(i1)@@@@@@<nowiki>||</nowiki>@@@@@@isNull(i2) | | | 2 | Boolean Or | The expression evaluation returns true if any of its arguments is true. See [[wp>Logical_disjunction#Truth_table|logical disjunction]] for additional information about the boolean logic. The evaluation is [[wp>Short-circuit_evaluation|short-circuited]]. | EXPR@@@or@@@EXPR\\ EXPR@@@<nowiki>||</nowiki>@@@EXPR | not@@@@@@isNull(i1)@@@@@@or@@@@@@isNull(i2) \\ not@@@@@@isNull(i1)@@@@@@<nowiki>||</nowiki>@@@@@@isNull(i2) | | ||
| ::: | Boolean And | The expression evaluation returns true if and only if all its arguments are true. See [[wp>Logical_conjunction#Truth_table|logical conjunction]] for additional information about the boolean logic. The evaluation is [[wp>Short-circuit_evaluation|short-circuited]]. | EXPR@@@and@@@EXPR \\ EXPR@@@&&@@@EXPR | not@@@@@@isNull(i1)@@@@@@and@@@@@@isNull(i2) \\ not@@@@@@isNull(i1)@@@@@@&&@@@@@@isNull(i2) | | | ::: | Boolean And | The expression evaluation returns true if and only if all its arguments are true. See [[wp>Logical_conjunction#Truth_table|logical conjunction]] for additional information about the boolean logic. The evaluation is [[wp>Short-circuit_evaluation|short-circuited]]. | EXPR@@@and@@@EXPR \\ EXPR@@@&&@@@EXPR | not@@@@@@isNull(i1)@@@@@@and@@@@@@isNull(i2) \\ not@@@@@@isNull(i1)@@@@@@&&@@@@@@isNull(i2) | | ||
Line 43: | Line 43: | ||
| Random | Generate a random value using the Uniform probability distribution | rand | if@@@rand@@@>@@@0.5@@@then@@@1@@@else@@@i2 | | | Random | Generate a random value using the Uniform probability distribution | rand | if@@@rand@@@>@@@0.5@@@then@@@1@@@else@@@i2 | | ||
| Uniform | Generate a random value using the Uniform probability distribution. The generated value lies between the given bounds. The first EXPR represents the lower bound and the second EXPR represents the upper bound | rUniform(EXPR,@@@EXPR) | if@@@rUniform(12,@@@15)@@@>@@@14@@@then@@@1@@@else@@@i2 | | | Uniform | Generate a random value using the Uniform probability distribution. The generated value lies between the given bounds. The first EXPR represents the lower bound and the second EXPR represents the upper bound | rUniform(EXPR,@@@EXPR) | if@@@rUniform(12,@@@15)@@@>@@@14@@@then@@@1@@@else@@@i2 | | ||
- | | Normal | Generate a random value using the Normal probability distribution. The value is generated according to the first and second given EXPR representing, respectively, the mean and the variance of the distribution | rNormal(EXPR,@@@EXPR) | if@@@rNormal(10,@@@2)@@@>@@@9@@@then@@@1@@@else@@@i2 | | + | | Normal | Generate a random value using the Normal probability distribution. The value is generated according to the first and second given EXPR representing, respectively, the mean and the deviation of the distribution | rNormal(EXPR,@@@EXPR) | if@@@rNormal(10,@@@2)@@@>@@@9@@@then@@@1@@@else@@@i2 | |
| Poisson | Generate a random value using the Poisson probability distribution. The value is generated according to the given EXPR representing the distribution lambda | rPoisson(EXPR) | if@@@rPoisson(100)@@@>@@@95@@@then@@@1@@@else@@@i2 | | | Poisson | Generate a random value using the Poisson probability distribution. The value is generated according to the given EXPR representing the distribution lambda | rPoisson(EXPR) | if@@@rPoisson(100)@@@>@@@95@@@then@@@1@@@else@@@i2 | | ||
| Squared Root | | sqrt(EXPR) | sqrt(i1@@@/@@@i4) | | | Squared Root | | sqrt(EXPR) | sqrt(i1@@@/@@@i4) | | ||
Line 86: | Line 86: | ||
Lookup table operators return the value corresponding to a given key according to a rule-operator. | Lookup table operators return the value corresponding to a given key according to a rule-operator. | ||
- | They have the following syntax: \\ @@@@@@@@@TABLE[N@@@] \\ where: \\ @@@@@@@@@TABLE is a table identifier corresponding to a **[[Lookup Table Type|lookup table]]**. //Beware that, if the identifier corresponds to a [[Table Type|table]], an error will be reported//; \\ @@@@@@@@@N is the rule-operator. | + | They have the following syntax: \\ @@@@@@@@@TABLE[N@@@] \\ where: \\ @@@@@@@@@TABLE is a table identifier corresponding to a **[[Lookup Table Type|lookup table]]**. //Beware that, if the identifier is bound to a [[Table Type|table]], an error will be reported//; \\ @@@@@@@@@N is the rule-operator. |
^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ||
- | | Get Table Value | Return the table value in the X key position of the table | TABLE[EXPR] | t2[i1@@@+@@@2] | | + | | Get Table Value | Return the table value associated with the EXPR key in the table | TABLE[EXPR] | t2[i1@@@+@@@2] | |
- | | Get Table Equal Lower Bound Value | Return the table value in the greater key less than or equal to the X key position of the table. | TABLE[<nowiki><=</nowiki>@@@EXPR] \\ <del>TABLE{EXPR}</del> | t2[<nowiki><=</nowiki>@@@14] \\ <del>t2{14}</del> | | + | | Get Table Equal Lower Bound Value | Return the table value associated with the greater key less than or equal to the EXPR key in the table. | TABLE[<nowiki><=</nowiki>@@@EXPR] \\ <del>TABLE{EXPR}</del> | t2[<nowiki><=</nowiki>@@@14] \\ <del>t2{14}</del> | |
- | | Get Table Lower Bound Value | Return the table value in the greater key less than the X key position of the table. | TABLE[<@@@EXPR] | t2[<@@@i1@@@+@@@2] | | + | | Get Table Lower Bound Value | Return the table value associated with the greater key less than the EXPR key in the table. | TABLE[<@@@EXPR] | t2[<@@@i1@@@+@@@2] | |
- | | Get Table Equal Upper Bound Value | Return the table value in the lesser key greater than or equal to the X key position of the table. | TABLE[>=@@@EXPR] | t2[>=@@@i1@@@+@@@i3] | | + | | Get Table Equal Upper Bound Value | Return the table value associated with the lesser key greater than or equal to the EXPR key in the table. | TABLE[>=@@@EXPR] | t2[>=@@@i1@@@+@@@i3] | |
- | | Get Table Upper Bound Value | Return the table value in the lesser key greater than the X key position of the table. | TABLE[>@@@EXPR] | t2[>@@@i7] | | + | | Get Table Upper Bound Value | Return the table value associated with lesser key greater than the EXPR key in the table. | TABLE[>@@@EXPR] | t2[>@@@i7] | |
- | | Get Table Closest Value | Return the table value in the key closest to the X key position of the table. | TABLE[><@@@EXPR] | t2[><@@@3@@@+@@@i7] | | + | | Get Table Closest Value | Return the table value associated with the key closest to the EXPR key in the table. | TABLE[><@@@EXPR] | t2[><@@@3@@@+@@@i7] | |
- | | Get Table Interpoled Value | Return a linear interpoled value drawn through the neighbor keys of the X key position of the table. | TABLE[/@@@EXPR] | t2[/@@@i2] | | + | | Get Table Interpolaled Value | Return a linear interpolated value drawn through the neighbor keys of the EXPR key in the table. | TABLE[/@@@EXPR] | t2[/@@@i2] | |
| Test Table Key | Return 1, if expression corresponds to a key stored in the table, and 0, otherwise. | TABLE[?@@@EXPR] \\ TABLE[=?@@@EXPR] \\ TABLE[==?@@@EXPR] | t2[?@@@i2] \\ t2[=?@@@i2] | | | Test Table Key | Return 1, if expression corresponds to a key stored in the table, and 0, otherwise. | TABLE[?@@@EXPR] \\ TABLE[=?@@@EXPR] \\ TABLE[==?@@@EXPR] | t2[?@@@i2] \\ t2[=?@@@i2] | | ||
| Get Table Value Using Predefined Name | Return the table value bound to a key corresponding to a predefined name. //This can only used to retrieve results produced by [[Extract Map Attributes]] e [[Extract Lookup Table Attributes]]. The documentation of these operators provides a list of all supported predefined names.// | TABLE["NAME"] | t2["cellArea"] | | | Get Table Value Using Predefined Name | Return the table value bound to a key corresponding to a predefined name. //This can only used to retrieve results produced by [[Extract Map Attributes]] e [[Extract Lookup Table Attributes]]. The documentation of these operators provides a list of all supported predefined names.// | TABLE["NAME"] | t2["cellArea"] | | ||
Line 103: | Line 103: | ||
Table operators return the value corresponding to a given set of keys. | Table operators return the value corresponding to a given set of keys. | ||
- | They have the following syntax: \\ @@@@@@@@@TABLE[@@@[@@@]@@@[@@@]@@@] \\ where: \\ @@@@@@@@@TABLE is a table identifier corresponding to a **[[Table Type|table]]**. //Beware that, if the identifier corresponds to a [[Lookup Table Type|lookup table]], an error will be reported//; | + | They have the following syntax: \\ @@@@@@@@@TABLE[@@@[@@@]@@@[@@@]@@@] \\ where: \\ @@@@@@@@@TABLE is a table identifier corresponding to a **[[Table Type|table]]**. //Beware that, if the identifier is bound to a [[Lookup Table Type|lookup table]], an error will be reported//; |
The expressions representing the set of keys must be separated by commas. | The expressions representing the set of keys must be separated by commas. | ||
^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ||
- | | Get Table Value At Default Column | Return the table value corresponding to the set of keys at the first data column. | TABLE[@@@[EXPR,@@@EXPR,@@@EXPR,@@@...@@@]@@@] | t2[@@@[i1@@@+@@@2,@@@i2/2,@@@t1[v2]]@@@] | | + | | Get Table Value At Default Column | Return the table value associated with the set of keys in the first data column. | TABLE[@@@[EXPR,@@@EXPR,@@@EXPR,@@@...@@@]@@@] | t2[@@@[i1@@@+@@@2,@@@i2/2,@@@t1[v2]]@@@] | |
- | | Get Table Value At Named Column | Return the table value corresponding to the set of keys at the column named by the given name. | TABLE[@@@[EXPR,@@@EXPR,@@@EXPR,@@@...@@@]@@@[@@@NAME@@@]@@@] | t2[@@@[i1@@@+@@@2,@@@i2/2,@@@t1[v2]]@@@[@@@"Area_In_Hectares"@@@]@@@] | | + | | Get Table Value At Named Column | Return the table value associated with the set of keys in the column named by the given name. | TABLE[@@@[EXPR,@@@EXPR,@@@EXPR,@@@...@@@]@@@[@@@NAME@@@]@@@] | t2[@@@[i1@@@+@@@2,@@@i2/2,@@@t1[v2]]@@@[@@@"Area_In_Hectares"@@@]@@@] | |
- | | Get Table Value At Column Index | Return the table value corresponding to the set of keys at the column indexed by the given expression. | TABLE[@@@[EXPR,@@@EXPR,@@@EXPR,@@@...@@@]@@@[@@@EXPR@@@]@@@] | t2[@@@[i1@@@+@@@2,@@@i2/2,@@@t1[v2]]@@@[@@@v1+2@@@]@@@] | | + | | Get Table Value At Column Index | Return the table value associated with the set of keys in the column indexed by the given expression. | TABLE[@@@[EXPR,@@@EXPR,@@@EXPR,@@@...@@@]@@@[@@@EXPR@@@]@@@] | t2[@@@[i1@@@+@@@2,@@@i2/2,@@@t1[v2]]@@@[@@@v1+2@@@]@@@] | |
==== Image Neighborhood Functions ==== | ==== Image Neighborhood Functions ==== | ||
Neighborhood operators return the value of an operation within a defined neighborhood window. | Neighborhood operators return the value of an operation within a defined neighborhood window. | ||
- | They have the following syntax: \\ @@@@@@@@@nbN(IMAGE,@@@h,@@@w,@@@y,@@@x) \\ @@@@@@@@@nbN(IMAGE, @@@h, @@@w, TABLE, @@@y, @@@x) @@@@@@@@@(Used just for nbMaxRef/nbMinRef) \\ @@@@@@@@@nbN(IMAGE, @@@h, @@@w, IMAGE2, @@@y, @@@x) @@@@@@@@@(Used just for nbMaxRef/nbMinRef) \\ where: \\ @@@@@@@@@N is the operator name; \\ @@@@@@@@@IMAGE is an image identifier; \\ @@@@@@@@@h is the number of window lines; \\ @@@@@@@@@w is the number of window columns; \\ @@@@@@@@@TABLE is the table mapping the values that should be returned to the index of each of the surrounding cells; \\ @@@@@@@@@IMAGE2 is the identifier of the image whose cell will be returned; \\ @@@@@@@@@y is the line where the window center is anchored at the image; \\ @@@@@@@@@x is the column where the window center is anchored at the image. | + | They have the following syntax: \\ |
+ | @@@@@@@@@nbN(IMAGE,@@@h,@@@w,@@@y,@@@x) \\ | ||
+ | |||
+ | where: \\ | ||
+ | @@@@@@@@@N is the operator name; \\ | ||
+ | @@@@@@@@@IMAGE is an image identifier; \\ | ||
+ | @@@@@@@@@h is the number of window lines; \\ | ||
+ | @@@@@@@@@w is the number of window columns; \\ | ||
+ | @@@@@@@@@y is the line where the window center is anchored at the image; \\ | ||
+ | @@@@@@@@@x is the column where the window center is anchored at the image. | ||
The calculation usually includes the center of the window. | The calculation usually includes the center of the window. | ||
Line 122: | Line 131: | ||
<WRAP center round box 80%> | <WRAP center round box 80%> | ||
- | The window anchor (y and x) can be omitted when the window center is anchored at the current line and column. The shortened syntax is: \\ @@@@@@@@@nbN(IMAGE,@@@h,@@@w) | + | The window anchor (y and x) can be omitted when the window center is anchored at the current line and column. The shortened syntax is: **@@@@@@@@@nbN(IMAGE,@@@h,@@@w)** |
</WRAP> | </WRAP> | ||
Line 128: | Line 137: | ||
| Min | Returns the minimum value of the neighbor non-null cells. | nbMin() | nbMin(i4,@@@2,@@@3,@@@line-1,@@@column) | | | Min | Returns the minimum value of the neighbor non-null cells. | nbMin() | nbMin(i4,@@@2,@@@3,@@@line-1,@@@column) | | ||
| Max | Returns the maximum value of the neighbor non-null cells. | nbMax() | nbMax(i1,@@@4,@@@4)@@@-@@@1 | | | Max | Returns the maximum value of the neighbor non-null cells. | nbMax() | nbMax(i1,@@@4,@@@4)@@@-@@@1 | | ||
- | | MinRef | Takes the minimum value of the neighbor non-null cells and returns the value inside the second identifier, being table or image, according that index of minimum value taken. | nbMinRef() | nbMinRef(i4,@@@2,@@@3,@@@t1,@@@line-1,@@@column) | | ||
- | | MaxRef | Takes the maximum value of the neighbor non-null cells and returns the value inside the second identifier, being table or image, according that index of maximum value taken. | nbMaxRef() | nbMaxRef(i4,@@@2,@@@3,@@@i1,@@@line-1,@@@column) | | ||
| Sum | Returns the sum of the neighbor non-null cells. | nbSum() | nbSum(i3,@@@5,@@@5)@@@+@@@7 | | | Sum | Returns the sum of the neighbor non-null cells. | nbSum() | nbSum(i3,@@@5,@@@5)@@@+@@@7 | | ||
| Product | Returns the product of the neighbor non-null cells. | nbProd() | if@@@not@@@isNull(i1)@@@then@@@nbProd(i1,@@@2,@@@2,@@@0,@@@column)@@@else@@@0 | | | Product | Returns the product of the neighbor non-null cells. | nbProd() | if@@@not@@@isNull(i1)@@@then@@@nbProd(i1,@@@2,@@@2,@@@0,@@@column)@@@else@@@0 | | ||
Line 139: | Line 146: | ||
| Standard Deviation | Returns the standard deviation of the neighbor non-null cells according to the expression: \\ @@@<m 8>sigma = sqrt{{1/{n-1}}sum{i=1}{n}{(x_i-X)^2}}</m> \\ where \\ @@@x<sub>1</sub>, x<sub>2</sub>, ..., x<sub>i</sub> are the neighbor cells; \\ @@@X is the mean of the neighbor cells. | nbStdDev() | nbStdDev(i2,@@@3,@@@3,@@@line+1,@@@column) | | | Standard Deviation | Returns the standard deviation of the neighbor non-null cells according to the expression: \\ @@@<m 8>sigma = sqrt{{1/{n-1}}sum{i=1}{n}{(x_i-X)^2}}</m> \\ where \\ @@@x<sub>1</sub>, x<sub>2</sub>, ..., x<sub>i</sub> are the neighbor cells; \\ @@@X is the mean of the neighbor cells. | nbStdDev() | nbStdDev(i2,@@@3,@@@3,@@@line+1,@@@column) | | ||
- | There is one additional image neighborhood operator that uses a slightly different syntax: \\ @@@@@@@@@nbConvol(IMAGE,@@@TABLE,@@@h,@@@w,@@@y,@@@x) \\ where: \\ @@@@@@@@@IMAGE is an image identifier; \\ @@@@@@@@@TABLE is a table identifier; \\ @@@@@@@@@h is the number of window lines; \\ @@@@@@@@@w is the number of window columns; \\ @@@@@@@@@y is the line where the window center is anchored at the image; \\ @@@@@@@@@x is the column where the window center is anchored at the image. | + | ==== Image Neighborhood Indexing Functions ==== |
+ | |||
+ | Neighborhood (Ref) operators finds the value of an operation within a defined neighborhood window, this value is then used as an index to retrieve data either from a table or from a secondary image. | ||
+ | |||
+ | They have the following syntax: \\ | ||
+ | @@@@@@@@@nbN(IMAGE, @@@h, @@@w, TABLE, @@@y, @@@x)\\ | ||
+ | @@@@@@@@@nbN(IMAGE, @@@h, @@@w, IMAGE2, @@@y, @@@x)\\ | ||
+ | |||
+ | where: \\ | ||
+ | @@@@@@@@@N is the operator name; \\ | ||
+ | @@@@@@@@@IMAGE is an Image identifier; \\ | ||
+ | @@@@@@@@@h is the number of window lines; \\ | ||
+ | @@@@@@@@@w is the number of window columns; \\ | ||
+ | @@@@@@@@@TABLE is a LookupTable containing the values associated with each one of the Indices (Key = Index); \\ | ||
+ | @@@@@@@@@IMAGE2 is an Image identifier whose cell values will be returned (Cell Coordinate = Index); \\ | ||
+ | @@@@@@@@@y is the line where the window center is anchored at the image; \\ | ||
+ | @@@@@@@@@x is the column where the window center is anchored at the image. | ||
+ | |||
+ | The calculation usually includes the center of the window. | ||
+ | Even-sided windows have the center displaced toward the top left corner. | ||
+ | |||
+ | <WRAP center round box 80%> | ||
+ | The window anchor (y and x) can be omitted when the window center is anchored at the current line and column. The shortened syntax is: **@@@@@@@@@nbN(IMAGE,@@@h,@@@w,@@@TABLE/IMAGE2)** | ||
+ | </WRAP> | ||
+ | |||
+ | ^ Operator ^ Description ^ Syntax ^ Usage Example ^ | ||
+ | | MinRef | Finds the minimum value of the neighbor non-null cells. This value is then used as an Index to retrieve the resulting value from specified table or image. | nbMinRef() | nbMinRef(i4,@@@2,@@@3,@@@t1,@@@line,@@@column) | | ||
+ | | MaxRef | Finds the maximum value of the neighbor non-null cells. This value is then used as an index to retrieve the resulting value from specified table or image. | nbMaxRef() | nbMaxRef(i4,@@@2,@@@3,@@@i1,@@@line,@@@column) | | ||
+ | |||
+ | There is one additional image neighborhood operator that uses a slightly different syntax: \\ | ||
+ | @@@@@@@@@nbConvol(IMAGE,@@@TABLE,@@@h,@@@w,@@@y,@@@x) \\ | ||
+ | where: \\ | ||
+ | @@@@@@@@@IMAGE is an image identifier; \\ | ||
+ | @@@@@@@@@TABLE is a table identifier; \\ | ||
+ | @@@@@@@@@h is the number of window lines; \\ | ||
+ | @@@@@@@@@w is the number of window columns; \\ | ||
+ | @@@@@@@@@y is the line where the window center is anchored at the image; \\ | ||
+ | @@@@@@@@@x is the column where the window center is anchored at the image. | ||
nbConvol applies a convolution over IMAGE using the values stored on TABLE as the convolution coeficients. The table entries, from 1 to X, are mapped into the corresponding image values from top-down, left-to-right. The following examples ilustrated: | nbConvol applies a convolution over IMAGE using the values stored on TABLE as the convolution coeficients. The table entries, from 1 to X, are mapped into the corresponding image values from top-down, left-to-right. The following examples ilustrated: |