**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 ==== |[[jvs:fscan:manual:chapter2:expression:subtract|-]]|[[jvs:fscan:manual:chapter2:expression:add|+]]|[[jvs:fscan:manual:chapter2:expression:multiply|x]]|[[jvs:fscan:manual:chapter2:expression:divide|/]]|[[jvs:fscan:manual:chapter2:expression:and|and]]|[[jvs:fscan:manual:chapter2:expression:or|or]]| |[[jvs:fscan:manual:chapter2:expression:eq|eq]]|[[jvs:fscan:manual:chapter2:expression:gt|gt]]|[[jvs:fscan:manual:chapter2:expression:ge|ge]]|[[jvs:fscan:manual:chapter2:expression:lt|lt]]|[[jvs:fscan:manual:chapter2:expression:le|le]]|[[jvs:fscan:manual:chapter2:expression:assign|=]]| |[[jvs:fscan:manual:chapter2:expression:min|min]]|[[jvs:fscan:manual:chapter2:expression:max|max]]|[[jvs:fscan:manual:chapter2:expression:sqrt|sqrt]]|[[jvs:fscan:manual:chapter2:expression:log|log]]|[[jvs:fscan:manual:chapter2:expression:dilate|dilate]]|[[jvs:fscan:manual:chapter2:expression:erode|erode]]| |[[jvs:fscan:manual:chapter2:expression:smooth|smooth]]|[[jvs:fscan:manual:chapter2:expression:flood|flood]]|[[jvs:fscan:manual:chapter2:expression:boundary|boundary]]|[[jvs:fscan:manual:chapter2:expression:grow|grow]]|[[jvs:fscan:manual:chapter2:expression:thin|thin]]|[[jvs:fscan:manual:chapter2:expression:normalize|normalize]]| |[[jvs:fscan:manual:chapter2:expression:adjust|adjust]]|[[jvs:fscan:manual:chapter2:expression:peak|peak]]|[[jvs:fscan:manual:chapter2:expression:gradient|gradient]]|[[jvs:fscan:manual:chapter2:expression:volmax|volmax]]|[[jvs:fscan:manual:chapter2:expression:volmin|volmin]]|[[jvs:fscan:manual:chapter2:expression:overlap|overlap]]| |[[jvs:fscan:manual:chapter2:expression:expand|expand]]|[[jvs:fscan:manual:chapter2:expression:shrink|shrink]]|[[jvs:fscan:manual:chapter2:expression:neighbors|neighbors]]|[[jvs:fscan:manual:chapter2:expression:adapt|adapt]]|[[jvs:fscan:manual:chapter2:expression:cluster|cluster]]|[[jvs:fscan:manual:chapter2:expression:gauss|gauss]]| |[[jvs:fscan:manual:chapter2:expression:roimove|roimove]]|[[jvs:fscan:manual:chapter2:expression:roimask|roimask]]|[[jvs:fscan:manual:chapter2:expression:rotate|rotate]]|[[jvs:fscan:manual:chapter2:expression:flip|flip]]|[[jvs:fscan:manual:chapter2:expression:scatterplot|scatterplot]]|[[jvs:fscan:manual:chapter2:expression:map|map]]| |[[jvs:fscan:manual:chapter2:expression:ramp|ramp]]|[[jvs:fscan:manual:chapter2:expression:sine|sine]]|[[jvs:fscan:manual:chapter2:expression:bits|bits]]|[[jvs:fscan:manual:chapter2:expression:absval|absval]]|[[jvs:fscan:manual:chapter2:expression:modulus|modulus]]|[[jvs:fscan:manual:chapter2:expression:convolve|convolve]]| |[[jvs:fscan:manual:chapter2:expression:static|static]]|[[jvs:fscan:manual:chapter2:expression:name|name]]|[[jvs:fscan:manual:chapter2:expression:wordsize|wordsize]]|[[jvs:fscan:manual:chapter2:freeze|freeze]]|[[jvs:fscan:manual:chapter2:tinterpolate|tinterpolate]]|[[jvs:fscan:manual:chapter2:tslope|tslope]]| |[[jvs:fscan:manual:chapter2:smooth|tsmooth]]| | | | | | ===== ===== 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. |[[jvs:fscan:manual:chapter2:expression:absval|absval]]|Replace negative numbers with absolute values| |[[jvs:fscan:manual:chapter2:expression:adapt|adapt]]| | |[[jvs:fscan:manual:chapter2:expression:add|+]]|Add values to a data set| |[[jvs:fscan:manual:chapter2:expression:adjust|adjust]]|Normalize local dimmest voxels | |[[jvs:fscan:manual:chapter2:expression:adhoc|adhoc]]|Commands implemented for special (temporary) purposes| |[[jvs:fscan:manual:chapter2:expression:and|and]]|Perform a bit-wise AND operation| |[[jvs:fscan:manual:chapter2:expression:bandpass|bandpass]]|Apply a bandpass frequency filter| |[[jvs:fscan:manual:chapter2:expression:bits|bits]]|Count non-zero bits in data values| |[[jvs:fscan:manual:chapter2:expression:boundary|boundary]]| | |[[jvs:fscan:manual:chapter2:expression:calbar|calbar]]|Embed an intensity calibration bar into an image | |[[jvs:fscan:manual:chapter2:expression:censor|censor]]|Replace or remove selected time points in image series| |[[jvs:fscan:manual:chapter2:expression:cluster|cluster]]|Identify clusters of contiguous voxels by intensity| |[[jvs:fscan:manual:chapter2:expression:convolve|convolve]]| | |[[jvs:fscan:manual:chapter2:expression:descend|descend]]| | |[[jvs:fscan:manual:chapter2:expression:despike|despike]]|Remove intensity spikes | |[[jvs:fscan:manual:chapter2:expression:detransient|detransient]]|Remove onset (offset) transient signals| |[[jvs:fscan:manual:chapter2:expression:detrend|detrend]]|Remove low frequency temporal signal drift| |[[jvs:fscan:manual:chapter2:expression:dilate|dilate]]|Dilate around the edges of intensity regions in a 3D volume| |[[jvs:fscan:manual:chapter2:expression:divide|/]]|Divide a data set by values| |[[jvs:fscan:manual:chapter2:expression:eq|eq]]|Perform a 'equal to' data comparison| |[[jvs:fscan:manual:chapter2:expression:erode|erode]]|Erode around the edges of intensity regions in a 3D volume| |[[jvs:fscan:manual:chapter2:expression:expand|expand]]| | |[[jvs:fscan:manual:chapter2:expression:fft|fft]]|Perform a fast Fourier transform on data set | |[[jvs:fscan:manual:chapter2:expression:flip|flip]]| | |[[jvs:fscan:manual:chapter2:expression:flood|flood]]|Flood fill an intensity region starting from a seed point| |[[jvs:fscan:manual:chapter2:expression:freeze|freeze]]| | |[[jvs:fscan:manual:chapter2:expression:gauss|gauss]]| | |[[jvs:fscan:manual:chapter2:expression:ge|ge]]|Perform a 'greater or equal' data comparison| |[[jvs:fscan:manual:chapter2:expression:gradient|gradient]]| | |[[jvs:fscan:manual:chapter2:expression:gray|gray]]| | |[[jvs:fscan:manual:chapter2:expression:grow|grow]]| | |[[jvs:fscan:manual:chapter2:expression:gt|gt]]|Perform a 'greater than' data comparison| |[[jvs:fscan:manual:chapter2:expression:le|le]]|Perform a 'less or equal' data comparison| |[[jvs:fscan:manual:chapter2:expression:log|log]]|Calculate the log(10) of data values| |[[jvs:fscan:manual:chapter2:expression:lt|lt]]|Perform a 'less than' data comparison| |[[jvs:fscan:manual:chapter2:expression:map|map]]| | |[[jvs:fscan:manual:chapter2:expression:max|max]]|Find maximum values in a data set| |[[jvs:fscan:manual:chapter2:expression:min|min]]|Find minimum values in a data set| |[[jvs:fscan:manual:chapter2:expression:modulus|modulus]]| | |[[jvs:fscan:manual:chapter2:expression:multiply|x]]|Multiply a data set by values| |[[jvs:fscan:manual:chapter2:expression:name|name]]| | |[[jvs:fscan:manual:chapter2:expression:neighbors|neighbors]]|Count neighbors surrounding each data point| |[[jvs:fscan:manual:chapter2:expression:neq|neq]]|Perform a 'not equal to' data comparison| |[[jvs:fscan:manual:chapter2:expression:normalize|normalize]]| | |[[jvs:fscan:manual:chapter2:expression:notnan|notnan]]|Convert invalid number ("nan") values to zeros | |[[jvs:fscan:manual:chapter2:expression:or|or]]|Perform a bit-wise AND operation| |[[jvs:fscan:manual:chapter2:expression:outside|outside]]|Identify values outside of an object | |[[jvs:fscan:manual:chapter2:expression:overlap|overlap]]| | |[[jvs:fscan:manual:chapter2:expression:peak|peak]]| | |[[jvs:fscan:manual:chapter2:expression:ramp|ramp]]|Generate image data with spatially ramped intensity values| |[[jvs:fscan:manual:chapter2:expression:rgb|rgb]]| | |[[jvs:fscan:manual:chapter2:expression:regress|regress]]|Regression filter a temporal variable from a time course| |[[jvs:fscan:manual:chapter2:expression:roifill|roifill]]| | |[[jvs:fscan:manual:chapter2:expression:roimask|roimask]]| | |[[jvs:fscan:manual:chapter2:expression:roimove|roimove]]| | |[[jvs:fscan:manual:chapter2:expression:rotate|rotate]]| | |[[jvs:fscan:manual:chapter2:expression:scatterplot|scatterplot]]| | |[[jvs:fscan:manual:chapter2:expression:segment|segment]]| | |[[jvs:fscan:manual:chapter2:expression:set|set]]|Set part or all of data set to specified value| |[[jvs:fscan:manual:chapter2:expression:sine|sine]]| Generate image data with sinusoidal time course| |[[jvs:fscan:manual:chapter2:expression:smooth|smooth]]|Reduce high frequency spatial signal noise| |[[jvs:fscan:manual:chapter2:expression:sqrt|sqrt]]|Calculate the square root of data values| |[[jvs:fscan:manual:chapter2:expression:static|static]]|Store results of operation in the input data set| |[[jvs:fscan:manual:chapter2:expression:stretch|stretch]]|Stretch or shrink an image | |[[jvs:fscan:manual:chapter2:expression:subtract|-]]|Subtract values from a data set| |[[jvs:fscan:manual:chapter2:expression:thin|thin]]| | |[[jvs:fscan:manual:chapter2:expression:tinterpolate|tinterpolate]]| | |[[jvs:fscan:manual:chapter2:expression:tslope|tslope]]| | |[[jvs:fscan:manual:chapter2:expression:tsmooth|tsmooth]]|Reduce high frequency temporal signal noise| |[[jvs:fscan:manual:chapter2:expression:viewmask|viewmask]]|Use a mask image to mask all slices in any 3D view| |[[jvs:fscan:manual:chapter2:expression:volmax|volmax]]| | |[[jvs:fscan:manual:chapter2:expression:volmin|volmin]]| | |[[jvs:fscan:manual:chapter2:expression:wordsize|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:**\\ [[jvs:fscan|fScan Home]], [[jvs:fscan:manual|fScan Manual]], [[jvs:fscan:manual:chapter2|CmdLineOptions]], [[jvs:fscan:manual:help|Manual Help]]