Use Threshold to remove all data in an image whose intensity does not match a condition that you set. In the output, the pixels which do not match the condition are replaced with the background intensity. If you have selected the masked data option from the Result menu, the pixels which do satisfy the condition retain their intensities. If you have selected the mask option from the Result menu, the pixels which satisfy the condition are set to one.
For the condition, you have the three choices in the Condition menu: the pixel's intensity equals or or exceeds the threshold value, the pixel's intensity is less than or equal to the threshold value, or an arbitrary expression entered in the Expression field.
The controls for selecting the input file, output file, and region to process are shared with many other Priism applications and are described elsewhere.
Region processing | Condition | Threshold | Expression | Background | Result | Point list | Command line
Use the Condition menu in conjunction with either the Threshold or Expression fields to set the criteria the application uses to select pixels. The three choices available from the Condition menu are:
p > 2000 or p < 1000" where p stands for the
pixel value) to enter an arbitrary selection expression.
Use the Threshold field to enter the threshold value used when the condition for selecting pixels is either "above or equal to threshold" or "below or equal to threshold".
If you select "generic expression" as the pixel selection condition, then enter the selection criteria in the Expression field. You may use the following in the criteria:
pi
(i.e. 3.14159...), e (i.e. 2.71828...), and i
(represents a purely imaginary value with a magnitude of one).
== (is equal to),
!= (is not equal to), < (is less than),
> (is greater than), <= (is less than or
equal to), and >= (is greater than or equal to). Except
for == and !=, the comparison operators expect
the quantities compared to be real; for complex values, use one of the
conversion functions to convert the value to a real quantity.
not (not
x is true if x is false and is false if x
is true; as a shortcut, you may use ! instead of
not), and (x and
y is true if both x and y are true;
otherwise it is false), or (x or
y is false if x and y are false; otherwise
it is true), and xor (x xor
y is true if only one of x and y is
true; otherwise it is false).
real(x),
imag(x),
mag(x), and
phase(x). The first returns the
real part of x, the second returns the imaginary part of
x, the third returns the magnitude of x, and the
fourth returns the phase, in radians, of x.
complex(x,y)
is also available to create a complex number with a real component equal
to x and an imaginary component equal to y.
+ (addition),
- (subtraction), * (multiplication),
/ (division), and ^ (exponentiation).
cos(x) (the cosine of x,
assuming x is in radians), sin(x)
(the sine of x, assuming x is in radians),
tan(x) (the tangent of x,
assuming x is in radians),
log(x) (the natural logarithm of
x), and log10(x) (the
logarithm base 10 of x).
abs(x)
expects a real value and returns its absolute value.
max(x,y),
expects two real values and returns the larger of the two.
min(x,y),
expects two real values and returns the smaller of the two.
in_range(b1,b2,x) is a shortcut for the expression "x >= b1 and x <= b2".
As an example, if the input data is real and the desired threshold is 1500, then the expression
p >= 1500
is equivalent to the "above or equal to threshold" selection from the Condition menu. The slightly more complicated expression
abs(p - 800) < 10
selects all pixels with values between 791 and 809. The same condition can be expressed in other ways:
p > 790 and p < 810
or
in_range(791, 809, p)
In the output, pixels whose original value does not satisfy the specified condition are set to the background value.
Use the Result menu to control what is done with pixels that satisfy the condition you have set (pixels which do not satisfy the condition are set to the background value). The two available options are:
If the Point list toggle is on, a file will be written with the pixel coordinates of the points that satisfy the specified condition. Enter the name of the file in the field next to the toggle button. The format of the file is plain text with three columns separated by spaces. The first column is the x coordinate, the second is the y coordinate, and the third is the z coordinate. The coordinates are relative to the dimensions of the output.
Threshold accepts the command-line arguments described in Region.html. In addition, Threshold has the following options:
-not_below=v
-not_below,
-not_above or -expression do not appear on
the command line, Threshold proceeds as if -not_below=0
had been specified.
-not_above=v
-expression=expr
-background=b
-background is not
set on the command line, Threshold assumes a background value of zero.
-result=mask or -result=masked_data
-result does not appear on the
command-line, Threshold proceeds as if -result=mask had
appeared on the command line.
-ptlist=filename
As an example, if in.dat has non-complex data, then the following generates out.dat which has ones where the intensity falls in the range of 800 to 1000 and zeros elsewhere:
Threshold in.dat out.dat -expression='p >= 800 and p <= 1000' -result=mask