Dictionary: arithmetic functions

add-constant        [value] <volume list>

subtract-constant [value] < volume list>

multiply-constant  [value] < volume list>

divide-constant    [value] < volume list>

For every voxel in every volume, add/subtract/multiply/divide the specified constant value with the voxel.


add       [volume_ref] <volume list>

subtract [volume_ref] <volume list>

multiply [volume_ref] <volume list>

divide    [volume_ref] <volume list>

For every volume in the list, add/subtract/multiply/divide the single specified reference volume.


add-stacks       [stack_ref] <volume list>

subtract-stacks [stack_ref] <volume list>

multiply-stacks [stack_ref] <volume list>

divide-stacks    [stack_ref] <volume list>

For every stack in the list, add/subtract/multiply/divide the specified reference stack, such that the first volume of the reference stack is added (or whatever) to all other first volumes, and so on.


ln    [constant] <volume list>

exp [constant] <volume list>

Perform ln(voxel_value/constant) for every voxel in every volume, or do the same operation with exponential function. For instance, use ln() to convert signal to relaxation rate.


create-fCBV [new stack name] [pre-contrast volume] [post contrast volume] <volume list>

Convert a time series of signal intensities in the volume list to the percentage change in CBV * 100 (so that results can be written as short integers if desired). Provide a pre-constrast volume, which presumably is an average of volumes prior to injection of paramagnetic contrast agent, and provide a post-contrast volume, which presumably is an average of post-injection volumes, including potentially many volume in the volume list. This function assumes that all volume were collected using the same echo time.


create-fCBV1 [new stack name] [pre-contrast volume] [post-contrast volume] [baseline post-contrast volume] <volume list>

Perform the same basic operation as above, but allow the pre-contrast and post-contrast volumes to have one echo time, and the baseline post-contrast volume and the volume list to potentially have a different echo time. For instance, if one injected too much contrast agent and then decided to lower the echo time for a functional run, this function would be appropriate (although the example case has never happened, surely).


scale-volumes        [target intensity] <volume list>

normalize-volumes [target intensity] <volume list>

Rescale volumes so that either the spatial maximum (scale-volumes) or average (normalize-volumes) is set to the target intensity. If you want to preserve the relative scaling across a time series of volumes within a stack, use “multiply-constant” rather than these commands, which are most useful for single volumes.

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