SPM
Data Organization
The fMRI data for each participant is stored in a single folder named after the participant's Participant ID. In this folder is stored the participant's Functional (BOLD) and Anatomical (MPRAGE) data.
Anatomical data
The MPRAGE file from the CTRC scanner is supplied as a gzipped file with a sequential filename (e.g., 501-MPRAGE.nii.gz). This file should be unzipped, renamed to MPRAGE.nii, and moved to a subfolder named MPRAGE
Functional data
The BOLD data from the CTRC scanner are supplied as a series of gzipped (.gz) files with sequential filenames (e.g., 700-BOLD_data.nii'.gz', 800-BOLD_data.nii.gz). These files need to be unzipped and moved to separate intutively-named subfolders (e.g., Run_01, Run_02, ...). All functional data files should have the same name. Conventionally, we have gone with 4D.nii, but f.nii (to be consistent with the file names used by Freesurfer) is fine too.
When finished, your subject folder should be organized something like this (e.g., for subject 101):
- 0101/
- MPRAGE/
- MPRAGE.nii
- Run_01/
- 4D.nii
- Run_02/
- 4D.nii
- Run_03/
- 4D.nii
- MPRAGE/
etc.
Extracting Event Onsets from MATLAB Data Files
Analyses of fMRI (as opposed to rs-MRI) are built on regressions of observed time-series data on predicted time-series data. The predicted time-series are derived from the onsets of different types of events of interests (e.g., at what points in time was the participant experiencing Condition A and/or Condition B?).
If the event onsets can be assumed to be constant across participants, an onsets file (either in plaintext or .mat format) can be created from the known experimental paradigm. If the event onsets are variable across participants, or if one wants to be extremely precise about stimulus timing, these event onsets can be derived from each participant's MATLAB data file generated during the experiment.
A MATLAB function, TSExtractor has been written, and can be found in the UBFS Scripts/Matlab/ folder. If a copy of this file is in your MATLAB path, you can use the TSExtractor function to generate SPM onsets files from these experiment data files.
- If TSExtractor.m is not already in your MATLAB path, open a terminal window and copy it there:
cp ~/ubfs/cpmcnorg/Scripts/Matlab/TSExtractor.m ~/Documents/MATLAB/
- Start MATLAB, and read the TSExtractor help for an explanation and sample usage:
>>help TSExtractor
- In MATLAB, navigate to the directory containing the .mat files containing the experiment data from which you wish to extract the event onsets
- It is not strictly necessary to navigate to this directory, however if your files are located in a different directory, you will be required to provide an additional parameter to TSExtractor indicating where the files are to be found. Otherwise, the function simply assumes that these files are found in your current directory.
- Execute TSExtractor on each of the .mat files. E.g.,
>> d=datenum('19-Nov-2015');
>> TSExtractor('prefix', 'LDT_', 'subject', 1000, 'run', 1, 'date', d);