ISIS 3 Application Documentation
fx | Printer Friendly View | TOC | Home |
Generalized arithmetic operations using multiple cube files
Overview | Parameters | Example 1 | Example 2 | Example 3 | Example 4 | Example 5 | Example 6 |
DescriptionFx allows general arithmetic operations to be performed on an arbitrary number of input cubes. Fx loads whatever input files are specified, applies a user defined equation to those files and writes the results to an output file. The input file can be a single band or multiple band cube file. If the band number is not specified for the multiple band cube file, then the equation is applied to all the bands within the file. Up to five files can be entered for parameters F1 to F5 under the "Input Cube Files" section to specify the input data. A second method to specify data is to include an arbitrary number of files in a file list and enter the list name in the fromlist parameter that is only visible upon selecting the MODE list located under "File I/O Mode." If the user selects "OUPUTONLY" under "File I/O Mode" then an output file is created based on an equation provided by the user. The user will also need to specify the number of lines, samples, and bands of the output file. The command line parsing has been improved to handle escape sequences and support arrays better. The equation parser is case insensitive, ignores whitespace, and converts all braces to parentheses. Parameter values, when quoted, no longer need the quotes escaped.
The equation parser is case insensitive and all braces, such as "[{[{ }]}]" are converted to parentheses "(((( ))))" first. Whitespace is ignored. Currently, you must explicitly state all multiplication operations (e.g. 2pi will not work, but 2*pi will). The modulus (%), AND, and OR operators are not implemented yet. Functions such as pha, ina, ema, lat, lon, radius, and resolution require a Level1 input file with SPICE information in the image labels. That is, the program spiceinit should be executed on the input files before using these functions. For Level2 images, the backplanes containing the photometric and spatial information must be present. This is normally performed with the program phocube before the image is projected to a map projection.
Requirements and result of operators
< , >, <=, >=, ==, != The following operators are used to shift pixels left or right, and move the entire image to different sample and line positions:
<<, >> The following operators use the input image statistics to apply the equations:
linemin, linemax, cubemin, cubemax, cubeavg, cubestd The min and max operators are used to compare two pixel values. The pixel values can be obtained from input files or manually entered by the user. The two values are compared against each other and the one that meets the equation criteria is used.
min, max In order to use the operators below, images must be processed through spiceinit so that the NAIF camera model information is stored in the image labels:
pha, phal, phac, ina, inal, inac, ema, emal, emac The following operators are used to convert between degrees and radians:
rads, degs All trigonometric functions expect angles in radians, not degrees. However, all camera functions return angles in degrees and therefore should be converted to radians. The following table shows all currently supported scalars and special tokens:
The following table shows all currently supported operators sorted by precedence (0 = highest precedence). All examples are valid equations that assume one or more files (F1, F2, etc.) are loaded:
CategoriesRelated Objects and DocumentsApplicationsHistory
|
Parameter GroupsFiles
File list
Equation
File I/O Mode
Output only
|
Input ISIS3 cube filename.
Type | cube |
---|---|
File Mode | input |
Filter | *.cub |
Input ISIS3 cube filename.
Type | cube |
---|---|
File Mode | input |
Internal Default | None |
Filter | *.cub |
Input ISIS3 cube filename.
Type | cube |
---|---|
File Mode | input |
Internal Default | None |
Filter | *.cub |
Input ISIS3 cube filename.
Type | cube |
---|---|
File Mode | input |
Internal Default | None |
Filter | *.cub |
Input ISIS3 cube filename.
Type | cube |
---|---|
File Mode | input |
Internal Default | None |
Filter | *.cub |
This is the output file created based on a user defined equation.
Type | cube |
---|---|
File Mode | output |
Pixel Type | real |
Filter | *.cub |
This file contains a list of all the cube files to be processed. Each file will be assigned F1 to F##(number of images in the input list).
Type | filename |
---|---|
File Mode | input |
Filter | *.txt *.lis |
This equation will be parsed and used to perform the specified calculations.
Type | string |
---|
Select one of the following options: CUBES to input cubes directly, LIST to enter a text file containing a list of filenames, or OUTPUTONLY to create output data only.
Type | string | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Default | CUBES | ||||||||||||
Option List: |
|
This is the number of lines the output cube will have.
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
This is the number of samples the output cube will have.
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
This is the number of bands the output cube will have.
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
Example 1Add two images Description
In this example, two images with the same filename but have two different bands
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
Input Images
Output Image
|
Example 2Create output only Description
In this example, an output file that is 360 samples by 360 lines is created
by converting the line number to radians, and then calculating the cosine of the
calculated value using the following equation:
cos(rads(line))The line number is input as degrees and converted to radians first in order to output the correct cosine values. Command Line
fx
to=cosine_of_line.cub equation="cos(rads(line))" mode=outputonly lines=360
samples=360
Convert the line number to radians, calculate the cosine of the new value, and
output the results to the output filename provided by the user.
GUI Screenshot
Output Image
|
Example 3Create output only Description
The example below demonstrates how easily one can get an incorrect product
if angles are not converted to radians before calculating the cosine of a
line number when the line number represents angles in degrees. In this example,
the output file has 360 samples by 360 lines.
Command Line
fx
to=cosine_of_line_deg.cub equation="cos(line)" mode=outputonly
lines=360 samples=360
Calculate the cosine of the line number, and output the results to
the output filename provided by the user.
GUI Screenshot
Output Image
|
Example 4Apply a gamma stretch Description
In this example, a gamma stretch is applied to a CTX image. The image
statistics are determined and used as part of the equation to calculate
new DN values.
Command Line
fx
f1=B10_013516_1520_XN_28S285W_eo_reduced.cub
to=B10_013516_1520_XN_28S285W_gammast2.cub
equation="{[cubemax(f1)-abs(cubemin(f1))]*{[f1-abs(cubemin(f1))]/[cubemax(f1)-abs(cubemin(f1))]}^(1.0/1.8)}"
Apply an equation to perform a gamma stretch to the image utilizing
the input image statistics.
GUI Screenshot
Input Image
Output Image
|
Example 5Create mask file Description
In this example, all input DN values greater than 0.11 is set to "1.0"
and all other pixels set to "0.0".
Command Line
fx
f1=B10_013516_1520_XN_28S285W_eo_reduced.cub
to=B10_013516_1520_XN_28S285W_mask.cub equation="f1>0.11"
Apply the equation to create a mask template file consisting of
0.0 and 1.0 DN values.
GUI Screenshot
Input Image
Output Image
|
Example 6Extract desired data Description
In this example, all DN values less than 0.11 will be set to "0.0" and
all other DN values will retain the original input value.
Command Line
fx
f1=B10_013516_1520_XN_28S285W_eo_reduced.cub
to=B10_013516_1520_XN_28S285W_extract.cub equation="f1*(f1>0.11)"
Apply the equation to retain all DN values greater than 0.11,
and set all other values to 0.0.
GUI Screenshot
Input Image
Output Image
|