ROI Toolbox Docs

Documentation: Reverse Norm (reverse_norm.m)
--------------------------------------------
Jeff Cooper
12/17/02

1. Summary

reverse_norm.m is a script which inverts a set of normalization
parameters and applies the inverted parameters to an image file.
The idea here is that if you have individual subjects with 
anatomical scans that have been normalized to a group template,
you can create a single region of interest .img file from that
group template, and then use the individual subjects 
normalization parameters to warp the ROI .img to fit their
individualized anatomies, effectively creating an ROI .img 
fitted to a subjects anatomy without having to create the .img
for each subject yourself.  Since the normalization parameters
for each subject contain the exact sequence of zooms, shears, and
warps necessary to transform that subjects anatomy into the
template image, all the script has to do is invert that
parameter matrix and apply the inverted sequence of transformations
to the group ROI .img to get an individualized ROI .img.
	The program supports multiple ROIs and multiple
parameter sets, in case you have several ROIS that you want
to individualize for several subjects at once.  Each selected 
parameter set will be applied to each selected ROI.

2. Usage

reverse_norm

reverse_norm.m can be run either from the command line without
any arguments or from the Reverse Norm button in the ROI
Toolbox.  In both cases, the user must first select which 
ROIs they want reverse normalized, and then which parameter
sets they want invert.  If the user selects multiple images
and/or multiple parameter sets, the script will apply every
selected parameter set to every selected ROI.
	The script will then ask for a string to be prepended
to the ROI filename; this is to distinguish the reverse
normalized ROI .img from the input ROI .img if the user wants 
to put them in the same directory.  The script then asks 
for an output directory; all the reverse-normalized ROIs will
be output in this directory.
	The script then proceeds with its reverse-normalization
image-by-image; if there are multiple parameter sets chosen,
the script will apply every parameter set to a single image
before proceeding to the next image.  The script outputs the
filename of the newly reverse-normalized files to the console,
for ease in keeping track of which parameter sets go with 
with .img files.   


3. Output

The script produces n new .img files for each input .img file,
where n is the number of parameter sets selected.  Every output
file will be placed in the chosen output directory.  These 
new .img files have filenames based on their input .img file, with
the following differences: 1) they will have the chosen string
prepended to the front of their names, 2) if there are multiple
parameter sets chosen, the differently normalized images will
be distinguished by a number appended to the end of the filename.
	In other words, if I choose one ROI .img to reverse 
normalize, ROI_Amygdala.img, and I choose to prepend reverse
to it, and I select six parameter sets to apply, Ill get 
six new images, of the filenames reverse_ROI_Amygdala_1.img,
reverse_ROI_Amygdala_2.img, reverse_ROI_Amygdala_3.img, etc.
The user should note on the console which parameter set goes
with which numbered image; the images of the same number will
all go with the same parameter set.


4. Last Bits

reverse_norm.m was written as part of the Gabrieli Lab ROI Toolbox 
as an adjunct to the SPM99 brain analysis package.  It requires
several other functions in both of those packages to run.

This code is in a very fluid state of development, and any suggested
modifications are welcomed and invited.  Please contact Jeff Cooper
in the Stanford Psychology Department at jcooper@stanford.edu with 
any questions about usage, bug reports, or suggestions for further
revision.  Good luck...

