Caret

This information is very old...most machines where this stuff were installed are gone...still, it is a lot of information, so I'd hate to just delete it when it might be useful to someone, somewhere.  Dianne Patterson 10/25/2006

After using SUREfit for segmentation and surface rendering of the 3D anatomical file, use Caret to flatten the surface (see the user manual) and then overlay the functional data. A series of steps in Afni prepare fMRI BRIKs for import to Caret as Metrics files. Finally, the Metrics files can be displayed on the different representations of the surface in Caret.

Getting and Installing Caret

Caret can be downloaded from the VanEssen Labs after a simple registration process. See the Caret home page. Caret is available as precompiled binaries that run on sgis, suns and linux machines. The Caret package should be dumped into a new directory, perhaps one called "caret" and untarred and unzipped in there (otherwise it'll spread subdirectories all over the directory where you untar and unzip it). Enter the caret directory and run the install program (make sure that its permissions allow you to execute it):

>./install_caret

Add the following line to the .cshrc, and source the .cshrc:

setenv PATH /usr/local/caret/bin/:$PATH;

Run the program with the command:

>caret

Learning Caret

Several tutorial datasets and the user manual are available from the caret download site (for which you'll need a password). Print a copy of the manual and run through the tutorials.


Preparing Your fMRI Data for Caret

You will need to preprocess and analyze your data in AFNI to the point of preparing the clustered fico BRIK as input to Caret. The fico BRIK is a mutibucket BRIK; that is, it stores two numerical values for each voxel. The first value is the intensity value*. The second value is created when you correlate the functional file to a waver file. So each voxel of the fico BRIK contains two values: an intensity value and a correlation value. The fico BRIK will need to be resliced, reoriented, and split into two single bucket briks (an intensity BRIK and a correlation BRIK) in Afni. Then each bucket can be converted into a Metrics file. Interestingly, it is the intensity BRIK that you will likely want to overlay on the anatomical image in Caret.

*Apparently, the intensity information stored in the multibucket BRIK contains intensity values only for those voxels over threshold.

Reslicing the Fico BRIK

Caution: Before you run 3ddup and 3daxialize on your functional BRIKs, you must make sure that an appropriate resliced anatomical BRIK, and only that BRIK is available as a parent in the same directory.

>3ddup -prefix study1_dup study1_block80_norm_p05_150ul+orig.

The above command runs 3ddup, naming the output study1_dup. It uses study1_block80_norm_p05_150ul+orig (from the Finished Afni Tutorial Data area) as the input. This creates a HEAD file only. Now start afni:

>afni

Click the "Define Datamode" button. Choose "Write Many" in the lower right panel and select the file you just created with 3ddup (study1_dup).

If you choose "???? resam mode: Cu", the resultant activations will be interpolated and have their square edges removed.

Choose "Anat resam mode: NN" (Nearest neighbour) if you want the activations to look just like the originals. This creates the BRIK to go with the HEAD. Close and restart afni and then display your original activations and the study1_dup file to make sure they look the same (or at least very similar).

Reorienting the Fico BRIK

>3daxialize -prefix study1_lpi -orient LPI study1_dup+orig

In the above command we call 3daxialize with the "orient" option (this option was added near the end of 2001, thanks to Bob Cox, so you should have an up-to-date copy of Afni). "-prefix" is optional, but allows you to assign a name to the output file "-orient LPI" tells 3daxialize to flip the volume into Caret's preferred orientation (set the origin at the Left Posterior Inferior corner of the volume). Finally, "study1_block80_norm_p05_150ul+orig" is the name of the file that needs to be reoriented (without specifying "BRIK" or "HEAD").

Splitting the Multibucket Volume

>3dbuc2fim -prefix study1_intensity 'study1_lpi_dup+orig[0]'

>3dbuc2fim -prefix study1_correlation 'study1_lpi_dup+orig[1]'

These two commands will create the single bucket intensity and correlation files respectively.

Check with 3dinfo

In addition to displaying your images to make sure they look right, check them with 3dinfo. 3dinfo should reveal that each file (study1_correlation* and study1_intensity*) has different values and one value per voxel. However, 3dinfo will call them both Datatype fim...don't worry about this. Check to make sure the orientation is LPI, the voxels are 1x1x1 and have the same number of voxels in each direction as in the anatomical (186x250x250 for our study1 tutorial data). You will probably find that it is the intensity BRIK that you will actually want to display as an overlay in Caret.

>3dinfo study1_intensity+orig.

Creating and Displaying Metrics Files

To create the metrics files, we need to feed in information about both the fMRI file that will become the metric file AND the surface to which it will be mapped. This means you will need to have generated a corrected fiducial surface *.vtk file and a *.params file in surefit before you try to run Map2Surface. Here is a hypothetical example:

>Map2Surface study1_intensity+orig.BRIK SURFACES/Brain3d.L.Temporal.segment_corr.fiducial.34456.vtk Brain3d.L.Temporal.sMRI_pad.params

  • After the command has run, do the same for study1_correlation (if you like).
  • To view the activations on a surface, open the spec file in Caret, and make sure your new Metrics file is checked under "Metrics Files".
  • Click "OK" and your surface should be displayed.
  • On the Caret menu select Attributes-->Surface Coloring-->Metrics file. You should now see your activation metrics file displayed on the surface.