This is an old revision of the document!
Table of Contents
fScan Reference Manual, Chapter 2 (CmdLineOptions): expression
Expression -- Perform arithmetic expressions on whole data sets
usage:
-expr opname varb [options]
-expr opname [options]
-expr NREPTS opname [options]
OPNAME quick reference list
Perform arithmetic or other operations on whole data sets. The primary input is the current active data set. The VARB specified in the EXPR command is the 2nd operator if the operation expects two values.
For binary operations, the second variable can be a single value, or a second data set. If it is a data set, its XY dimensions must match those of the first input data set. The Z dimension of the second input can be 1, in which case the same image will be combined with every input Z image, or it must match the Z dimension of the first input. Similarly, the T dimension of the second input can be 1, in which case the same image volume will be combined with every input time volume, or it must match the T dimension of the first input.
A summary list of all EXPRESSION operations is shown below. For more information, click on the operator name for usage details.
absval | |
adapt | |
+ | Add values to a data set |
adjust | |
and | Perform a bit-wise AND operation |
bandpass | Apply a bandpass frequency filter |
bits | Count non-zero bits in data values |
boundary | |
censor | |
cluster | Identify clusters of contiguous voxels by intensity |
convolve | |
descend | |
detrend | Remove low frequency temporal signal drift |
dilate | Dilate around the edges of intensity regions in a 3D volume |
/ | Divide a data set by values |
eq | Perform a 'equal to' data comparison |
erode | Erode around the edges of intensity regions in a 3D volume |
expand | |
fft | Perform a fast Fourier transform on data set |
flip | |
flood | Flood fill an intensity region starting from a seed point |
freeze | |
gauss | |
ge | Perform a 'greater or equal' data comparison |
gradient | |
gray | |
grow | |
gt | Perform a 'greater than' data comparison |
le | Perform a 'less or equal' data comparison |
log | Calculate the log(10) of data values |
lt | Perform a 'less than' data comparison |
map | |
max | Find maximum values in a data set |
min | Find minimum values in a data set |
modulus | |
x | Multiply a data set by values |
name | |
neighbors | Count neighbors surrounding each data point |
normalize | |
or | Perform a bit-wise AND operation |
overlap | |
peak | |
ramp | Generate image data with spatially ramped intensity values |
rgb | |
regress | Regression filter a temporal variable from a time course |
roifill | |
roimask | |
roimove | |
rotate | |
scatterplot | |
segment | |
set | Set part or all of data set to specified value |
shrink | |
smooth | Reduce high frequency spatial signal noise |
sqrt | Calculate the square root of data values |
static | Store results of operation in the input data set |
- | Subtract values from a data set |
thin | |
tinterpolate | |
tslope | |
tsmooth | Reduce high frequency temporal signal noise |
volmax | |
volmin | |
wordsize |
Op: - subtract operand from data + add operand to data x multiply data by operand / divide data by operand min replace data with minimum of data and operand max replace data with maximum of data and operand gt set data to zero if not greater than operand lt set data to zero if not less than operand and do bitwise AND of data and operand or do bitwise OR of data and operand sqrt replace data with its square root thin set value in voxels around the edgle of a 3-D volume erode remove (set to 0) each voxel that has at least one neighbor less than IN2. (IN2 must be a constant -- default=1) dilate set any voxel less than IN2 to IN2, if it has at least one neighbor >= than IN2. (IN2 must be a constant -- default=1). smooth grow thin volmin volmax normalize adjust intensities to make the local average equal IN2. IN2 must be a constant -- default=1000). gradient peak flood fill a 3-D volume of contiguous voxels boundary find the edge of a 3-D volume of contiguous voxels Note: ERODE, DILATE, BOUNDARY and FLOOD, are 3-D volume operators. They can only be used if the input dataset (INFILE) is a single volume that can be completely loaded into memory. The neighbors are the 6 adjacent voxels (or 26 -- see VAL below.) These volume operations will be performed on the enitre volume in the order they appear on the command line, before performing any of the slice by slice operations (e.g. -,+,x,/,min, etc.) Note: FLOOD and BOUNDARY assume that the volume has already been segmented; the low 3 bits indicate status according to: bit 0 (1) - ON/OFF bit 1 (2) - FILLED/not FILLED (or INTERIOR/not INTERIOR) bit 2 (4) - EDGE/not EDGE
In2: this operand can be a file, constant, or reference variable. If it is a file it must have appropriate structure to match data. If it is a reference variable (e.g. "task2" or "motion"), the value for each image is used as a constant operand for that image. Note: The IN2 data set must have the same image dimensions as INFILE. IN2 can be bytes, short integers, or floating point values. Except for constants, calculations are fastest if IN2 wordsize matches the input wordsize. Mode: this is a character string indicating how the operand should be treated. It can appear right after IN2 or as the last argument. Its value can be: all - combine each INFILE image with a IN2 image const - combine each INFILE image with a constant from IN2 meanslice - combine means of INFILE with slice indexed entry in IN2 meancode - combine means of INFILE with code indexed entry in IN2 meanconst - combine means of INFILE with a constant from IN2 For the last 3 MODE values the means are first generated based on -i, -b, or -K options that specify the code values for sorting the images. The mean images are then combined with an image in IN2. For MEANSLICE there should be one IN2 image for each slice, to be combined with all means for that slice. For MEANCODE there should be an IN2 image for each sort code for each slice. Note: mean images are generated as floating points. Value: this is a modifier value that can be used when combining data sets. (For +,-,x, or / operands VALUE is ignored if IN2 is a constant.) The meaning of VALUE depends on the operand, as follows: + or - -offset the result (add VALUE) x or / -scale the result (multiply by VALUE) erode -VALUE specifies how many neighbors need to be >= IN2 dilate -same as erode normalize - smooth -whether to include 0 values 0 - average all voxel values (default) !0 - smooth all voxels with values greater than or equal to N grow - thin - flood -VALUE specifies how to stop filling 0 - fill all contiguous ON voxels, set to OFF 1 - fill all contiguous OFF voxels, set to ON 2 - fill all contiguous OFF voxels, set to FILLED 3 - fill all contiguous ON voxels, set to ON_FILLED 4 - find nearest ON voxel, then same as 0 5 - find nearest OFF voxel, then same as 1 6 - find nearest OFF voxel, then same as 2 7 - find nearest ON voxel, then same as 3 boundary -same as FLOOD
Value2: another modifier; its use is operand dependent: erode -VALUE2 specifies whether to use 26 neighbors (default=0 unless VALUE is > 6). dilate -same as erode normalize -VALUE2 indicates whether to include 0 voxels (default=0) flood or boundary - VALUE2 indicates where to start filling: 0 - (default) explicit x,y,z value specified by "-r x y z" or center if no -r specified 1 - origin (0,0,0) 2 - center of volume 4 - no seed, fill entire 3D ROI (ROI specified by '-r' or interactively)
See Also: