Generate anatomical ROI mask based on available atlas in AFNI

Here, I want to share a c-shell script I wrote last Friday (20110/11/14) . The script creates a mask which mask out all the brain regions except amygdala (amyg.), auditory cortex and Brodmann area 10. The three brain areas are the regions of interest (ROIs) of my study. The ROIs are based on the probabilistic cytoarchitectonic map called CA_N27_MPM (See Eickhoff et. al., 2006 [PDF]). This map comes with a widely used software package for Analysis of Functional NeuroImage, AFNI. And the commands used in the script are also from AFNI. The script was written to call tcsh. So, AFNI and tcshell are required. It can also work under other Linux and Unix shells if you do not have tcsh installed. Just change the first line of the script to call the shell you like. You can download the script here or copy the code below to any text editor and save as a ".sh" file. Use chmod to make it executable before you run it.



# I learned how to do this from http://afni.nimh.nih.gov/afni/community/board/re
# Also see: http://afni.nimh.nih.gov/pub/dist/doc/program_help/whereami.html
# Qingyang Li
# 2011 01 14
# This script create 3 ROIs, Amygdala, Auditory cortex and Brodmann Area 10 (fro
ntal cortex). The there ROIs were labled as 1, 2, 3 in the resulted mask
# For BPD study, amyg. is the area of interest, Auditory is the control, BA10 mi
ght be related.
# The selection of atlas was following the sugestion by Poldrack, 2007(DOI:10.10
echo ""
echo "22003_bpd2_stats_warped+tlrc must be availabe in the current directory with
the script, or it won't finish"

echo "#### Step 1: create anatomical based ROI###"
whereami -mask_atlas_region CA_N27_MPM:120 -prefix 1 #amyg. CM
whereami -mask_atlas_region CA_N27_MPM:150 -prefix 2 #amyg. SF
whereami -mask_atlas_region CA_N27_MPM:215 -prefix 3 #amyg. LB
whereami -mask_atlas_region CA_N27_MPM:130 -prefix 4 #TE 1.0 Auditory
whereami -mask_atlas_region CA_N27_MPM:195 -prefix 5 #TE 1.1 Auditory
whereami -mask_atlas_region CA_N27_MPM:230 -prefix 6 #TE 1.2 Auditory
whereami -mask_atlas_region TT_Daemon:90 -prefix 7 #BA 10

echo "### Step 2: combine ROIs into on file"
3dcalc -a 1+tlrc -b 2+tlrc -c 3+tlrc -d 4+tlrc -e 5+tlrc -f 6+tlrc -g 7+tlrc -expr 'step(a+b+c)+2*step(d+e+f)+3*step(g)' -prefix roi_mask_HR

echo "### Step 3: resample the high resolution ROI mask"
3dfractionize -template 22003_bpd2_stats_warped+tlrc -input roi_mask_HR+tlrc -clip 0.5 -preserve -prefix roi_mask_LR # here we need a functional dataset as template (22003_bpd2_stats_warped+tlrc)

Some endnotes:

1 The BA10 is from TT_Daemon, that’s because I can not find BA 10 or prefrontal cortex in the CA_N27_MPM atlas.

2 Region of interest (ROI) analysis of functional MRI data is very common these days. The key step to carry out an ROI analysis is to generate an ROI mask. The mask is then applied to the fMRI data, raw or processed, to out put only the information from the voxels within the ROIs. Data in the voxels outside the ROIs will be masked out of the analysis. This is a great way to reduce the dimensionality of the fMRI data.

Generally speaking, there are two ways to generate ROIs. 1) The ROI is based on the functional activation map. It’s a bottom-up, data-driven approach. 2) The ROI is based on the anatomical structures. This approach need some a prior knowledge of the study. For example, if you are doing an auditory perception experiment and you are interest in brain activity in the auditory cortex, you can then create a mask to mask out unrelated brain regions and leave only auditory cortex’s data (yes, if you’re doing a real scientific experiment, you will also need another region as the control ).

To create an anatomical ROI, you can a) draw ROIs on your subject's high resolution brain image; b) output ROIs based on existing atlas. Method a) needs training: it’s not easy to eyeball brain structure if you are not trained. I myself is lack of this kind of training. The script I created is method b).

3 if you want to know how many voxels there are in each ROI, you can use 3dmaskavd command.

3dmaskave -mask roi_mask_LR+tlrc -mrange 3 3 roi_mask_LR+tlrc

The command above will tells you how many voxels are in the ROI with a value 3 in it. (change -marange 3 3 to -marange 2 2 if you want the info of the ROI with a value 2 in it)

updated on 20110117: changed the last command, add options for 3dfractionize
updated on 20110118: added end note 3

No comments:

Post a Comment