Skip to content
Snippets Groups Projects
Commit a2f66421 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: Mantis-1489: fix documentation of BandMath and BandMathX

parent fcd44b7f
No related branches found
No related tags found
No related merge requests found
......@@ -66,22 +66,34 @@ private:
SetDocLongDescription(
"This application performs a mathematical operation on several multi-band "
"images and outputs the result into a monoband image. Evaluation of the "
"images and outputs the result into a monoband image. The given expression"
" is computed at each pixel position. Evaluation of the "
"mathematical formula is done by the muParser libraries.\n\n"
"muParser version superior to 2.0, provides the '&&' and '||' logical "
"operators, and a ternary operator 'boolean_expression ? if_true : "
"if_false'.\n\n"
"Older versions of muParser (prior to v-2.0) provides only the 'and' and "
"'or' logical operators, and a ternary operator 'if(; ; )'.\n\n"
"The list of features and operators is available on the muParser website [1]."
"The formula can be written using:\n\n"
" * numerical values ( 2.3, -5, 3.1e4, ...)\n"
" * variables containing pixel values (e.g. : 'im2b3' is the pixel value"
" in 2nd image, 3rd band)\n"
" * binary operators:\n\n"
" * '+' addition, '-' subtraction, '*' multiplication, '/' division\n"
" * '^' raise x to the power of y\n"
" * '<' less than, '>' greater than, '<=' less or equal, '>=' greater or equal\n"
" * '==' equal, '!=' not equal\n"
#ifdef OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS
" * '||' logical or, '&&' logical and\n"
" * if-then-else operator: '(condition ? value_true : value_false)'\n"
#else
" * 'or' logical or, 'and' logical and\n"
" * if-then-else operator: 'if(condition;value_true;value_false)'\n"
#endif
" * functions : exp(), log(), sin(), cos(), min(), max(), ...\n\n"
"The full list of features and operators is available on the muParser website [1]."
);
SetDocLimitations( "None" );
SetDocAuthors( "OTB-Team" );
SetDocSeeAlso("[1] http://muparser.sourceforge.net/");
SetDocSeeAlso("[1] http://beltoforion.de/article.php?a=muparser");
AddDocTag( "Miscellaneous" );
AddParameter( ParameterType_InputImageList, "il", "Input image-list" );
......@@ -101,12 +113,7 @@ private:
AddParameter( ParameterType_String, "exp", "Expression");
SetParameterDescription(
"exp",
"The muParser mathematical expression to apply on input images.\n"
"Use im1b1 as first band of first image, im1b2 for the second band of "
"first image.\n"
"Use im2b1 as first band of second image, im2b2 for the second band of "
"second image.\n"
"etc."
"The muParser mathematical expression to apply on input images."
);
// Doc example parameter settings
......
......@@ -82,44 +82,30 @@ private:
"Fundamentals\n"
"------------\n\n"
"The i-th input image is identified by the 'im<i+1>' (e.g. 'im1') prefix "
"(please, note the indexing from 1 to N, for N inputs).\n\n"
"The following list summarizes the available variables of input #0:\n\n"
"im1\n"
" a pixel from 1st input, made of n components (n bands).\n\n"
"im1b2\n"
" the 2nd component of a pixel from 1st input (band index is 1-based).\n\n"
"im1b2N3x4\n"
" a 3x4 pixels 'N'eighbourhood of a pixel the 2nd component of a pixel "
"from the 1st input.\n\n"
"im1PhyX\n"
" horizontal (X-axis) spacing of the 1st input.\n\n"
"im1PhyY\n"
" vertical spacing of the 1st input input.\n\n"
"im1b2Mean\n"
" mean of the 2nd component of the 1st input (global statistics)\n\n"
"im1b2Mini\n"
" minimum of the 2nd component of the 1st input (global statistics)\n\n"
"im1b2Maxi\n"
" minimum of the 2nd component of the 1st input (global statistics)\n\n"
"im1b2Sum\n"
" minimum of the 2nd component of the 1st input (global statistics)\n\n"
"im1b2Var\n"
" minimum of the 2nd component of the 1st input (global statistics)\n\n"
"idxX, idxY\n"
" indices of the current pixel (generic variables)\n\n"
"The formula can be written using:\n\n"
" * numerical values ( 2.3, -5, 3.1e4, ...)\n"
" * variables containing pixel values (please, note the indexing of "
"inputs from 1 to N). Examples for the first input image:\n\n"
" * 'im1' a pixel from 1st input, made of n components (n bands)\n"
" * 'im1b2' the 2nd component of a pixel from 1st input (band index is 1-based)\n"
" * 'im1b2N3x4' a 3x4 pixels 'N'eighbourhood of a pixel the 2nd "
"component of a pixel from the 1st input\n"
" * 'im1PhyX' horizontal (X-axis) spacing of the 1st input.\n"
" * 'im1PhyY' vertical spacing of the 1st input input.\n"
" * 'im1b2Mean' mean of the 2nd component of the 1st input (global statistics)\n"
" * 'im1b2Mini' minimum of the 2nd component of the 1st input (global statistics)\n"
" * 'im1b2Maxi' maximum of the 2nd component of the 1st input (global statistics)\n"
" * 'im1b2Sum' sum of the 2nd component of the 1st input (global statistics)\n"
" * 'im1b2Var' variance of the 2nd component of the 1st input (global statistics)\n"
" * 'idxX' and 'idxY' are the indices of the current pixel (generic variables)\n"
" * binary operators:\n\n"
" * '+' addition, '-' subtraction, '*' multiplication, '/' division\n"
" * '^' raise x to the power of y\n"
" * '<' less than, '>' greater than, '<=' less or equal, '>=' greater or equal\n"
" * '==' equal, '!=' not equal\n"
" * logical operators: 'or', 'and', 'xor'\n"
" * if-then-else operator: '(condition ? value_true : value_false)'\n"
" * functions : abs(), exp(), log(), sin(), cos(), min(), max(), ...\n\n"
"Always keep in mind that this application only addresses mathematically "
"well-defined formulas. For instance, it is not possible to add vectors of"
......@@ -130,16 +116,16 @@ private:
"represented as a row vector.\n\n"
"Example:\n"
" im1 + im2 (1)\n"
" im1 + im2\n"
" represents the addition of pixels from the 1st and 2nd inputs. This "
"expression is consistent only if both inputs have the same number of "
"bands.\n\n"
"Please, note that it is also possible to use the following expressions"
" to obtain the same result:\n"
" im1b1 + im2b1\n"
" im1b2 + im2b2 (2)\n"
" ...\n\n"
" to obtain the same result:\n\n"
" * im1b1 + im2b1\n"
" * im1b2 + im2b2\n"
" * ...\n\n"
"Nevertheless, the first expression is by far much pleaseant. We call "
"this new functionality the 'batch mode' (performing the same operation "
......@@ -150,41 +136,41 @@ private:
"Another new feature is the possibility to perform operations that "
"involve neighborhoods of pixels. Variables related to such neighborhoods "
"are always defined following the imIbJNKxP pattern, where:\n"
"- I is an number identifying the image input (remember, input #0 = im1, "
"are always defined following the imIbJNKxP pattern, where:\n\n"
" - I is an number identifying the image input (remember, input #0 = im1, "
"and so on)\n"
"- J is an number identifying the band (remember, first band is indexed by"
" - J is an number identifying the band (remember, first band is indexed by"
"1)\n"
"- KxP are two numbers that represent the size of the neighborhood (first "
" - KxP are two numbers that represent the size of the neighborhood (first "
"one is related to the horizontal direction)\n\n"
"NB: All neighborhood are centered, thus K and P must be odd numbers.\n\n"
"Many operators come with this new functionality:\n"
"- dotpr\n"
"- mean\n"
"- var\n"
"- median\n"
"- min\n"
"- max\n"
"- etc.\n\n"
"For instance, if im1 represents the pixel of 3 bands image:\n"
" im1 - mean( im1b1N5x5, im1b2N5x5, im1b3N5x5 ) (3)\n\n"
"Many operators come with this new functionality:\n\n"
" - dotpr\n"
" - mean\n"
" - var\n"
" - median\n"
" - min\n"
" - max\n"
" - etc.\n\n"
"For instance, if im1 represents the pixel of 3 bands image::\n\n"
" im1 - mean( im1b1N5x5, im1b2N5x5, im1b3N5x5 )\n\n"
"could represent a high pass filter (note that by implying three "
"neighborhoods, the operator mean returns a row vector of three components"
". It is a typical behaviour for many operators of this application).\n\n"
"In addition to the previous operators, other operators are available:\n"
"- existing operators/functions from muParserX, that were not originally "
"In addition to the previous operators, other operators are available:\n\n"
" - existing operators/functions from muParserX, that were not originally "
"defined for vectors and matrices (e.g. cos, sin). These new "
"operators/functions keep the original names to which we added the prefix "
"'v' for vector (vcos, vsin, etc.)\n"
"- mult, div and pow operators, that perform element-wise multiplication, "
" - mult, div and pow operators, that perform element-wise multiplication, "
"division or exponentiation of vector/matrices (e.g. im1 div im2).\n"
"- mlt, dv and pw operators, that perform multiplication, division or "
" - mlt, dv and pw operators, that perform multiplication, division or "
"exponentiation of vector/matrices by a scalar (e.g. im1 dv 2.0).\n"
"- bands, which is a very useful operator. It allows selecting specific "
" - bands, which is a very useful operator. It allows selecting specific "
"bands from an image, and/or to rearrange them in a new vector (e.g."
"bands( im1, { 1, 2, 1, 1 } ) produces a vector of 4 components made of "
"band 1, band 2, band 1 and band 1 values from the first input.\n\n"
......@@ -194,30 +180,19 @@ private:
"The application itself\n"
"----------------------\n\n"
"The application takes the following parameters:\n"
"-il Sets the list of inputs\n"
"-ext Sets the mathematical expression (see also limitations "
"section below).\n"
"-incontext Sets the text filename containing constants values (syntax: "
"'#type name value')\n\n"
"An example of such a file is given below:\n"
"The application can use an expression supplied with the 'exp' parameter."
" It can also use an input context file, that defines variables and "
"expressions. An example of context file is given below::\n\n"
" #F expo 1.1\n"
" #M kernel1 { 0.1 , 0.2 , 0.3; 0.4 , 0.5 , 0.6; 0.7 , 0.8 , 0.9; 1 , 1.1"
", 1.2; 1.3 , 1.4 , 1.5 }\n\n"
", 1.2; 1.3 , 1.4 , 1.5 }\n"
" #E $dotpr( kernel1, im1b1N3x5 ); im2b1^expo$\n\n"
"As we can see, #I/#F allows the definition of an integer/float constant, "
"whereas #M allows the definition of a vector/matrix. In the latter case, "
"elements of a row must be separated by commas, and rows must be separated"
" by semicolons.\n\n"
"It is also possible to define expressions within the same txt file, with "
"#E <expr> (see limitations, below). For instance:\n"
" #E $dotpr( kernel1, im1b1N3x5 ); im2b1^expo$\n\n"
"-outcontext Output usesr's constants and expressions (context).\n"
"-out Sets output image (multi-outputs is not implemented yet).\n"
"\n"
" by semicolons. It is also possible to define expressions within the same"
" txt file, with #E <expr> (see limitations, below).\n"
"Finally, we strongly recommend to read the OTB Cookbook which can be "
"found at: http://www.orfeo-toolbox.org/packages/OTBCookBook.pdf"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment