ROI Toolbox Docs

Documentation: txt2img (mm2img.m)
--------------------------------------------
Jeff Cooper
12/13/02

1. Summary

mm2img.m is a script which converts .tal files (text files listing 
XYZ coordinates for ROIs) into ANALYZE-format .img files.  It’s 
used as a utility in the ROI Toolbox, since several of the 
functions in the Toolbox and SPM produce .tal files for output and/or
require .img files for input.
	This is a slightly trickier proposition than the reverse
direction, since each .tal file only lists coordinates in mm, not
voxels.  Therefore, any given .tal file could produce many different 
.img files of different voxel sizes or dimensions.  So, the user
must input not only a list of .tal files, but also a template
image which has the dimensions and voxel size that the user wishes
their newly-created .img files to have. 
	This utility features a reverse utility as well, img2txt, which
transforms .img files into .tal files.  Interested users are referred
to the docs for that script, img2txt_readme.txt.
	PLEASE NOTE that the .tal/.img distinction is completely separate
from the MNI-space/Tal-space distinction, and thus NOTE that a .tal
file, like an .img file may contain coordinates in MNI space or in 
Talairach space.  We maintain the .tal extension (as opposed to 
something less confusing, like .coord) for compatibility with SPM, 
which uses the .tal extension for its small volume correction masks. 

 
2. Usage

mm2img
mm2img(tals, ROI)

mm2img may be run either from the command line or with the ‘txt2img’ 
button in the ROI Toolbox.  If it is run from the command line, it may
be used with or without arguments; it optionally takes two arguments, 
namely a cell array of .tal filenames to be converted and the filename
of a template .img file that defines the dimensions, voxel size, etc., 
that the new ROI .img files will have.  If it is run without arguments,
or from the Toolbox button, the user is simply asked to select the
template image and the .tal files he or she wants to convert with the 
standard SPM file selection window.  The user is also asked for an 
output directory for the new .img files.
	Once the template .img file and the list of .tal files has been 
selected, the program runs, automatically producing .img files of the 
same name as the selected .tal files (so given an ROI of the name 
‘r_pfc_1.tal,’ the script would produce an .img file of the name 
‘r_pfc_1.img’).  Each .img file is placed in the chosen output 
directory.


3. Output

mm2img produces one .img file for each input .tal file, with a corresponding 
filename to the .img file, in the chosen output directory.  These .img 
files are standard ANALYZE-format .img files, with the value ‘1’ at
every coordinate listed in the .tal file and the value ‘0’ at every
other voxel.  They are thus suitable for use as a mask image in SPM
masking, or for display with any of the ROI display commands.


4. Last Bits

mm2img.m was written as part of the Gabrieli Lab ROI Toolbox,
a package of utilities to examine ROI data in SPM.  It requires 
several functions in both of those packages to be 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...

