How can I do Region-of-Interest (ROI) analyses?
Up to table of contentsQ30. How can I do Region-of-Interest (ROI) analyses?
A few tools for selecting voxel subsets and extracting their data for external analysis are included with AFNI 2.20. These tools are quite new and crude, and (God willing) will be improved as time goes on. Nonetheless, it is possible to do some useful work with them now.
The ROI stuff is mostly implemented as a set of plugins. These all have extensive help, so I won't give all the details here. You may need to write some C programs to calculate useful results after extracting the data you want.
Selecting a ROI: plugin "Draw Dataset"
This plugin lets you draw values into a dataset brick. The idea is
to start with a dataset that is all zeros and then draw nonzero
values over the desired regions. An all zero dataset of a size
equivalent to an existing dataset can be created using the
"Dataset Copy" plugin. Another way to create a starting
point for a mask dataset would be to use the "Edit
Dataset" plugin or the 3dmerge program (e.g., to pick
out all voxels with a correlation coefficient above a
threshold).
Normally, you would create the mask dataset as type "fim". This would allow it to be displayed as a functional overlay on the anatomical background.
Mask datasets tend to be mostly zeros. You can use the ability of AFNI to read/write compressed datasets to save disk space. See the file README.compression and the plugin "BRIK compressor" for details.
To be useful, a mask dataset must be created at exactly the resolution of the datasets it will be used with. This means that if you create a mask at the anatomical resolution, the functional datasets to which you apply it must be at that resolution also. This isn't a problem in the +acpc or +tlrc coordinate systems, but is an annoyance in the +orig data. Sorry about that. (But see the program 3dfractionize, described below.)
The drawing plugin is rather tedious to use. An adaptation of it, written by Rick Reynolds (formerly of MCW), is also now distributed with AFNI. This appears as Gyrus Finder on the Plugins menu. It allows you to set some bounding planes, and then select voxels inside these planes based on the gray level of the anatomical dataset. You can then clean up the results using drawing tools. The only documentation for this plugin is in its online help.
Averaging Data Defined by a ROI Mask: program
3dmaskave
This program lets you compute the average over a ROI of all voxel
values from an input dataset. (It is also possible to extract all
the voxel values and save them for other analysis.) The ROI is
defined by a mask dataset. The average value is computed for each
sub-brick in the input, so you can use this to create an average
time series. The output is written to stdout - it can be redirected
(using '>') into a file. For more information, try
"3dmaskave -help". An alternative to this command-line
program is the similar plugin "ROI Average", which you can
use interactively from within AFNI.
Averaging Several Distinct ROIs at Once: program
3dROIstats
This program, by Tom Ross of MCW, can do something similar to
3dmaskave, but does a separate average for each separate
value found in the mask file. In this way, you can have multiple
masks defined in one mask file, the first defined by putting 1 into
some voxels, the second by putting 2 into some voxels, etc.
(3dmerge can do this using the -1clust_order
option, for example. Or you could use the Draw Dataset
plugin to draw multiple anatomical ROIs using distinct voxel
values.) Then 3dROIstats can extract the average over each
ROI for you, all in one operation (vs. running 3dmaskave
many times).
Extracting Data from ROIs into an ASCII File: program
3dmaskdump
This program will write one line for each voxel that meets the mask
criteria. Multiple values (from multiple sub-bricks of multiple
datasets) can be written to each line. This format is suitable for
import into a spreadsheet program (say) for further analysis and
graphing.
[03 Oct 2000] The new program 3dUndump can be used as an inverse to 3dmaskdump, in that it will let you create a dataset from a list of voxel coordinates and values.
Resampling a ROI Mask to a Lower Resolution: program
3dfractionize
This new program (07 Feb 1999) lets you take a mask dataset
produced at higher resolution (e.g., by drawing over an anatomical
dataset) and resample it down to a lower resolution (e.g., a
typical EPI dataset). The new mask can then be used in the normal
ways described above. Fractionize refers to the fact that
the program computes the fraction of each output voxel that is
occupied by nonzero input voxels, handling the cases of possible
overlap correctly (we hope). Normally, you would clip off voxels
that had too small a fraction touched by the input mask. This
clipping can be done with 3dfractionize itself, or later
using one of 3dmerge, 3dcalc, or 3dmaskave. At
present, the only documentation for 3dfractionize is the
output of the command 3dfractionize -help.
The following documentation is by Michael S. Beauchamp of the
NIMH:
One of the most useful ways to visualize FMRI data is an average MR
time series from a group of voxels. AFNI makes this easy,
with the "ROI Average" plug-in or the "maskave" stand-alone
program. The user inputs a mask BRIK specifying which voxels to
average, and a 3D+time BRIK containing the time series data.
AFNI then outputs a text file with the average value at each
time point (and standard deviation, if desired) which can be
graphed in Excel or any other plotting program.
Some difficulties arise when the mask BRIK and the 3D+time BRIK have different coordinate spaces or voxel dimensions. In these cases, 3dfractionize may be used to translate between the different datasets.
Also see this useful page from Brown University.
[Answer last changed 26 May 2000]
This FAQ applies to: Any version.




