Home
About Isis
Support
Download

Isis 3

Documentation
Tutorials
Technical Documents

Isis 2

Documentation
Tutorials
Technical Documents

Search

USGS

Isis 3 Application Documentation


fx

Printer Friendly View | TOC | Home

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.

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 f1 + min(f2)
10 max Maximum 20 * max(f1)
11 sin Sine f1 * sin(123/321)
12 cos Cosine cos(.02*50)
13 tan Tangent tan(f1/f2)
14 csc Cosecant 12.3 + csc(f1)
15 sec Secant sin(pi/60) + (sec(f2))^2
16 cot Cotangent line + cot(f1) - 42
17 asin Arcsine 0.006 ^ asin(f1*5)
18 acos Arccosine acos(1/[2*pi])
19 atan Arctangent atan(f1/e)
20 atan2 Arctangent2 atan2(--10 5.5)
21 sinh Hyperbolic sine 55 + sinh(f2)
22 cosh Hyperbolic cosine cosh(sample^pi)
23 tanh Hyperbolic tangent tanh(f1)
24 log or ln Natural log ln(abs(1/[f2-f1]))
25 log10 Log base 10 99 + log10(f1-160)
26 sqrt Square root sqrt(abs[1000 - f2])
27 << Left shift. Note: pixel shift, not bitwise f1 << 250
28 >> Right shift. Note: pixel shift, not bitwise f2 + (f1 >> 500)
29 ^ Exponent f1 ^ 3
30 * Multiplication 10 * f1
31 / Division f2 / f1
32 + Addition 123 + 0.004 + f1
33 - Subtraction 10 - (--f1)

Categories


Related Objects and Documents

Applications


History

Kris Becker1997-04-24 Original version
Sean Crosby2007-02-14 Converted to Isis 3
Steven Lambright2007-06-18 Added single line and sample functionality
Steven Lambright2008-04-16 Upgraded to work with new Calculator classes
Steven Lambright2008-12-17 Renamed parameter FILELIST to FROMLIST

Parameter Groups

Input cube files

Name Description
F1Input file
F2Input file
F3Input file
F4Input file
F5Input file

Output file and Equation

Name Description
TO Output cube
EQUATIONImage processing equation

File I/O Mode

Name Description
MODEFile I/O options

File list

Name Description
FROMLIST Input list file

Output only

Name Description
LINESNumber of lines
SAMPLESNumber of samples
BANDSNumber of bands
X

Input cube files: F1


Description

Input cube file

Type cube
File Mode input
Filter *.cub
Close Window
X

Input cube files: F2


Description

Input cube file

Type cube
File Mode input
Internal Default None
Filter *.cub
Close Window
X

Input cube files: F3


Description

Input cube file

Type cube
File Mode input
Internal Default None
Filter *.cub
Close Window
X

Input cube files: F4


Description

Input cube file

Type cube
File Mode input
Internal Default None
Filter *.cub
Close Window
X

Input cube files: F5


Description

Input cube file

Type cube
File Mode input
Internal Default None
Filter *.cub
Close Window
X

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
Close Window
X

Output file and Equation: EQUATION


Description

This equation will be parsed and used to perform the specified calculations.

Type string
Close Window
X

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
CUBESSelect input cubes directly Select up to five input cubes manually.

Exclusions

  • FROMLIST
  • LINES
  • SAMPLES
  • BANDS
LISTSpecify 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
OUTPUTONLYWrite output only Do not use any input cubes and generate output from an equation

Exclusions

  • F1
  • F2
  • F3
  • F4
  • F5
  • FROMLIST
Close Window
X

File list: FROMLIST


Description

This file contains a list of all the cube files to be processed

Type filename
File Mode input
Filter *.txt
Close Window
X

Output only: LINES


Description

This is the number of the lines the output cube will have

Type integer
Default 1
Minimum 1 (inclusive)
Close Window
X

Output only: SAMPLES


Description

This is the number of the samples the output cube will have

Type integer
Default 1
Minimum 1 (inclusive)
Close Window
X

Output only: BANDS


Description

This is the number of the bands the output cube will have

Type integer
Default 1
Minimum 1 (inclusive)
Close Window

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.