Isis 3 Application Documentation
Generalized arithmetic operations using multiple cube files
Overview
Parameters
Example 1
Description
FX allows general arithmetic operations to be performed on an arbitrary
number of input cubes. It works by loading whatever input files are
specified, if any, then applying a user defined equation to those files
and then writing the results to an output cube. For instance, if the user
wanted to isolate all pixels in a cube that had a DN greater than 100,
then an equation like "f1 * (f1 > 100)" could be applied to the cube.
The equation parser is case insensitive and all braces get converted to
parenthesis. Whitespace is ignored. Currently, you must explicitly
state all multiplication operations (e.g. 5x will not work, but 5*x will).
The modulus (%), AND and OR operators are not implemented yet.
The following table shows all currently supported scalars/special tokens.
SCALARS
Scalar
Description
Example
F#
File operator
f3 denotes third file
# or #.# or .#
Any integer or double.
12, 3.14, .007 are all valid.
band
Current band number
f1 * band
line
Current line number
line + f1
sample
Current sample number
sample / line + f1
pi
Pi (3.14159...)
f1 > (e^pi)
e
Euler's number (2.71828...)
f1 == ln(e)
The following table shows all currently supported operators sorted
by precedence (0 = highest precedence). All examples are valid
equations that assume one or two files (F1, F2) are loaded. All angles
are in radians, not degrees.
OPERATORS
Precedence
Operator
Description
Example
0
{ [ ( ) ] }
Parenthesis, brackets, or braces
f2*(f1+[30-{line/pi}])
1
--
Negative sign
--f1 + f2
2
>
Greater than
f1 > f2
3
<
Less than
(f1 < f2) / f2
4
<=
Less than or equal
.505 <= f1
5
>=
Greater than or equal
f1 * (f1 >= 101)
6
==
Equal to
f1 == (f2/2)
7
!=
Not equal to
f1 != f2
8
abs
Absolute value
abs(f2 - f1)
9
min
Minimum of Two DNs
f1 + min(5, f2) + min(f2, f3)
10
linemin
Minimum of DNs on the current line
f1 + linemin(f2)
11
cubemin
Minimum of a Cube
f1 + mincube(f2)
12
max
Maximum of Two DNs
20 * max(f1,f2)
13
linemax
Minimum of DNs on the current line
f1 + linemax(f2)
14
cubemax
Minimum of a Cube
f1 + maxcube(f2)
15
sin
Sine
f1 * sin(123/321)
16
cos
Cosine
cos(.02*50)
17
tan
Tangent
tan(f1/f2)
18
csc
Cosecant
12.3 + csc(f1)
19
sec
Secant
sin(pi/60) + (sec(f2))^2
20
cot
Cotangent
line + cot(f1) - 42
21
asin
Arcsine
0.006 ^ asin(f1*5)
22
acos
Arccosine
acos(1/[2*pi])
23
atan
Arctangent
atan(f1/e)
24
atan2
Arctangent2
atan2(--10 5.5)
25
sinh
Hyperbolic sine
55 + sinh(f2)
26
cosh
Hyperbolic cosine
cosh(sample^pi)
27
tanh
Hyperbolic tangent
tanh(f1)
28
log or ln
Natural log
ln(abs(1/[f2-f1]))
29
log10
Log base 10
99 + log10(f1-160)
30
sqrt
Square root
sqrt(abs[1000 - f2])
31
<<
Left shift. Note: pixel shift, not bitwise
f1 << 250
32
>>
Right shift. Note: pixel shift, not bitwise
f2 + (f1 >> 500)
33
^
Exponent
f1 ^ 3
34
*
Multiplication
10 * f1
35
/
Division
f2 / f1
36
+
Addition
123 + 0.004 + f1
37
-
Subtraction
10 - (--f1)
Categories
Applications
History
Kris Becker 1997-04-24
Original version
Sean Crosby 2007-02-14
Converted to Isis 3
Steven Lambright 2007-06-18
Added single line and sample functionality
Steven Lambright 2008-04-16
Upgraded to work with new Calculator classes
Steven Lambright 2008-12-17
Renamed parameter FILELIST to FROMLIST
Steven Lambright 2009-04-17
Updated documentation to reflect the units of the trig functions.
Steven Lambright 2010-04-08
Min, max capabilities have been expanded to include line and cube
min/max.
Parameter Groups
Input cube files
Name
Description
F1 Input file
F2 Input file
F3 Input file
F4 Input file
F5 Input file
Output file and Equation
Name
Description
TO
Output cube
EQUATION Image processing equation
File I/O Mode
Name
Description
MODE File I/O options
File list
Name
Description
FROMLIST
Input list file
Output only
Output file and Equation :
TO
Description
The resultant cube containing the data after it has processed by the equation.
Type
cube
File Mode
output
Pixel Type
real
Filter
*.cub
Output file and Equation :
EQUATION
Description
This equation will be parsed and used to perform the specified calculations.
File I/O Mode :
MODE
Description
There is a choice to simply specify input cubes directly, use a list of input cubes in a text file, or to create output data only.
Type
string
Default
CUBES
Option List:
Option
Brief
Description
CUBES Select input cubes directly
Select up to five input cubes manually.
Exclusions
FROMLIST
LINES
SAMPLES
BANDS
LIST Specify a list of input files
This file contains a list of all the cube files to be processed
Exclusions
F1
F2
F3
F4
F5
LINES
SAMPLES
BANDS
OUTPUTONLY Write output only
Do not use any input cubes and generate output from an equation
Exclusions
File list :
FROMLIST
Description
This file contains a list of all the cube files to be processed
Type
filename
File Mode
input
Filter
*.txt
Output only :
LINES
Description
This is the number of the lines the output cube will have
Type
integer
Default
1
Minimum
1
(inclusive)
Output only :
SAMPLES
Description
This is the number of the samples the output cube will have
Type
integer
Default
1
Minimum
1
(inclusive)
Output only :
BANDS
Description
This is the number of the bands the output cube will have
Type
integer
Default
1
Minimum
1
(inclusive)
Example 1
Add two images
Description
In this example, two images will be added to each other
Command Line
fx
f1=../isisTruth.cub+1 f2=../isisTruth.cub+2 to=../result.cub equation=f1+f2
Add Band 1 and Band 2 using default settings
GUI Screenshot
FX Gui
Example Gui
Screenshot of GUI with parameters filled in to perform a calculation on the input image.
Input Images
Input image
Band 1
Parameter Name:
F1
This is an input image for the FX example.
Input image
Band 2
Parameter Name:
F2
This is an input image for the FX example.
Output Image
Output image showing results of the FX application.
Output image
Parameter Name:
TO
This is the 500 by 500 output image of the results.