Dictionary: variables

In addition to commands, one can set variables. Variables are set using the “set” command:

             set [variable name] [value or values]

Variables can be seen by

            show [variable name]

or         show

Registration variables

Registration variables generally will be set by reading the output of the “jip-align” program (e.g., “align.com”). 

source-matrix [x dimension] [y dimension] [z dimension]

target-matrix [x dimension] [y dimension] [z dimension]

Define source (original space) and target (or template) dimensions. The target matrix size is independent of the dimensions of the volume used as the source. The reason to specify the source matrix, which will be known for any forward transformation, is to enable inverse transformations from the target to the source (when the dimensions of the source matrix would be unknown otherwise).

source-origin     [x] [y] [z]

target-origin       [x] [y] [z]

source-direction [x] [y] [z]

target-direction  [x] [y] [z]

These variables define the voxel-to-coordinates transformation, as described here.

registration-orientation [x axis rotation] [y axis rotation] [z axis rotation] [Swap z]

Prior to applying an affine matrix as defined by variables below, apply a simple affine matrix that changes orientation in orthogonal directions, or alters the parity (handedness) of the transformation. Values for “rotations” in this command take integer form as (0,±1,2) for (0,±90,180). The last argument is a binary value (0 or 1) that defines whether or not the z orientation (usually slices) will be swapped. Doing so changes the handedness of the coordinate system, which may be desirable according to the convention of interest.

registration-wrapping [x binary] [y binary] [z binary]

Define whether or not to wrap images in x, y, and z during registration. The reason for allowing this is that some acquisitions might accidentally have been obtained with poorly set fields of view, so that the original images wrap across a boundary.  Default values are 0.

registration-translations [x] [y] [z]

registration-rotations [angle x] [angle y] [angle z]

registration-inflations [x] [y] [z]

registration-skews [x] [y] [z]

These variables set the 12-parameter affine matrix for registration.

interpolation-kernel [Lanczos or Gaussian]

During registration, use either a Lanczos kernel (similar to a Hamming-weighted sinc function) or a Gaussian kernel. Interpolation always involves a tradeoff between ringing and smoothing. The Lanczos kernel provides a good tradeoff with minimal smoothing, whereas the Gaussian kernel smooths but eliminates ringing.

Other variables

time-step [value]

This variable can be used to overwrite the time resolution in a file. Often a file will not have the correct time resolution, which could be equal to the TR value for MRI or some multiple of that value. The value set for the variable generally would use units of seconds but could use minutes for some applications. If the value of this variable is non-zero when data is read, the new stack will inherit this value for the time step:

          set time-step 3

          read data-with-bad-time-step.nii

          write data-with-correct-time-step.nii

complex-output [on or off]

If set to “on”, data will be output as complex pairs (real, imaginary).

overlay-logic [“and”, “or”, “not”, “replace”]

Note that only one overlay exists in memory at any time. However, one can control how to modify the overlay in memory while reading a new overlay from a file. The default is “replace”, or over-write the overlay in memory. The option “or” will add to the overlay, “and” will require that a voxel exists in memory and in the new overlay in order to keep it in the final overlay, and “not” will include only those voxels that did not already exist in memory.

filter-range [low value] [high value]

This variable enables image-based clipping of intensities, and it also plays well with overlays. The command “magnitude-window” and “magnitude-window-together” use this variable, along with the overlay in memory, to create a new modified overlay that is the logical AND of the overlay in memory and all voxels with values that fall between the low value and high value set by this variable. For instance, one might define a brain mask purely from T2-weighted image intensities:

          read all.ovl

          set filter-range 200 1.e10


          write brain.ovl

io-increment [integer value]

This variable simplifies 4D averaging in cases where memory could cause a problem. When the “read” command explicitly defines a set of volumes to read, as in “read stack.nii>0-50”, the “ii-increment” will be added to all indices. Thus, one can do this:

    set io-increment 0

    read average-4d.com

    set io-increment 100

    read average-4d.com


where "average-4d.com" is an ASCII file of jip commands that reads average averages segments of multiple files.

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