ROI Toolbox Docs

Documentation: Truncate (roi_truncate.m)
--------------------------------------------
Jeff Cooper
12/17/02

1. Summary

roi_truncate is a script intended to be applied to spatially
smoothed ROI .img files in order to constrain their extent
after smoothing.  Since smoothing is an unconstrained convolution,
smoothed ROIs can end up have voxels in the ROI (i.e., 
nonzero voxels in the .img) that extend significantly beyond
the original anatomical or functional boundaries of the ROI.
       One solution to this is to choose a truncation threshold, 
and manually set the value of any voxel whose intensity is 
below that threshold to zero.  roi_truncate performs that 
operation.  The user chooses a truncation threshold (the default
is 0.2, but users are encouraged to examine their own images
to find out exactly where the ROIs boundaries lie in the 
spatially smoothed images and choose their threshold
accordingly), and roi_truncate sets every voxel in the chosen
image files whose intensity is below that threshold to zero;
it also sets all voxels whose intensity is above that 
threshold to one, to make the ROI file an uniform, binary-valued
mask image.

2. Usage

roi_truncate
roi_truncate(filenames)

roi_truncate can be operated either from the command line or from
the Truncate button in the ROI Toolbox.  If it is run from 
the command line, it can be given a string array of filenames as
an argument; if it is not, or if it is run from the toolbox, it
will ask the user to select files to truncate.
	With the files selected, the user must then select a
truncation threshold.  The default value of 0.2 is usually a good
value to choose without any other information; the user is
encouraged, though, to look at their own smoothed images with
SPMs display facility and find an intensity value that corresponds
to their ideas about their ROIs boundaries.
	Once that truncation threshold is set, the script performs
the truncation, setting all the sub-threshold voxels to zero and
all the super-threshold voxels to one, and then saves the new files
out.


3. Output

roi_truncate produces one new .img file for each input .img file;
the new files are always produced in the same directory as the 
input files.  The new files have the same filenames as the old 
ones, but with t appended to the front; so if the input file
was named ROI_Amygdala.img, the new file would be named 
tROI_Amygdala.img, and it would be in the same directory.


4. Last Bits

roi_truncate.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...

