Command Syntax

All commands which operate on images have the basic form

                <command> <required arguments> <optional image list or stack list>.

Other commands include those that take no argument (e.g., "help" or "quit") and the "set" and "show" commands, which use the syntax

                set  <variable name> <value(s)>
                show <variable name>

Special Characters

Special characters are the following: #>$

The "#" character allows comments; everthing after that character is ignored. This is a useful feature to document a text file of commands.

The ">" character signifies that a set of image volumes is to be selected from a stack of volumes.  For instance, suppose the stack "functional" contains 100 volumes.  The command "average baseline functional>0-20" averages the 1st 21 volumes and creates a new stack (named "baseline") with one volume.  The command "average activation functional>30-39,60-69,90-99" averages 30 volumes.

The $ character is used for command substitution.  Suppose that one created the following text file named "average.com":

          read $1.nii        functional
          average baseline   functional>0-$2
          average activation functional>$3
          write $1_baseline.nii baseline
          write $1_activate.nii activation
          bye

The following unix command line would read file "visual.nii" and create output files "visual_baseline.bfloat" and "visual_activate.bfloat", each containing a single image volume.
             
unix% jip average.com visual 20 30-39,60-69,90-99


Volume lists and stack lists

This documentation refers to "volume lists" and "stack lists".  There are some commands which can be performed on individual volumes within a stack without affecting other volumes in the stack.  For instance, the following syntax is legal:
          average baseline stack>0-20
          write test.bfloat stack>10,20
Note that the volume counter begins at 0, not 1.  Also note that one can specify the last volume as "n" to handle cases where a single script is used for variable-length runs:
          average saturated all>5-n   # ignore 1st 5 time points due to TR/T1 effect

Some commands, however, cannot be performed on individual volumes without affecting all volumes in a stack.  For instance, the "pad" command alters the dimensions of a volume, which cannot be done without altering the entire stack.  If a syntax like "pad stack1>3-7 stack2>3-7" is used, the volume list is converted to a stack list, and all volumes in "stack1" and "stack2" are padded.

One more necessary concept: when no volumes are specified, all volumes are selected.  Suppose that two stacks, "stack1" and "stack2", exist in memory and each have 10 volumes.  The command "transform" with no arguments performs a Fourier transformation on all volumes in memory, or 20 volumes.  The command "transform stack1" transforms all volumes in "stack1", or 10 volumes. 

Joseph B. Mandeville, Athinoula A. Martinos Center for Biomedical Imaging at MGH/MIT/Harvard