5. Face Name 1st Level Analysis - mind-lab-bos/MBI_Project_MRI_Analysis GitHub Wiki
Preparing for the 1st level analysis
First time only: Create a folder called face_name_data
in /home/<yourusername>/
.
- Open two discovery tabs in Chrome and navigate to your
/home/<yourusername>/face_name_data
directory and the/work/mindlab
directory. Copy the template folder (/work/mindlab/Projects/GammaMBI/face_name/sub-NNN-XXXXS/
) to your home directory on discovery. You can do this by clicking on the 'sub-NNN-XXXXS' folder in the/work/mindlab
directory once and clicking the copy button. Then, go to your//home/<yourusername>/face_name_data
Chrome tab to paste the folder. See pictures below.
If this does not work, please copy the following code into your terminal (replacing with your actual username).
cp -R /work/mindlab/Projects/GammaMBI/face_name/sub-NNN-XXXXS/ /home/<yourusername>/face_name_data/
- Rename the template folder with the three digit numeric identifier ("NNN" in the above example) and the last part of their participant ID (first letter of their first name, first three letters of their last name, session number).
To find out the three digit numeric identifier for the data you are working on, go into the following file (/work/mindlab/NUBIC/MCI_Study/raw_bids/README.txt
). You can do this by clicking on the "Go To" button (top middle of your home directory screen). Delete the path that is there and paste the following path instead: /work/mindlab/NUBIC/MCI_Study/raw_bids/
. Click on the README.txt
file once and click on the "View" button on the left side under the path name.
Scroll to the participant you are analyzing and make note of their participant ID and numeric identifier. The red circle shows the numeric identifier, and the green circle shows the participant ID.
- The next step is to copy the preprocessed data into the participant's folder. You can do this by using the copy/paste buttons (like in step 1) or using the command below. You do not need to do both.
cp /work/mindlab/Projects/GammaMBI/CONN_Project/Current_Subs/<subjectfolder>/func/swausub-XXX_task-facename_run-01_bold.nii /home/<yourusername>/face_name_data/<subjectfolder>
Converting from 4D to 3D using SPM
- Open up a MatLab GUI on discovery by clicking the "Interactive Apps" dropdown menu. A new screen will come up asking you to specify how long you will be using Matlab for and how much memory you want to use. Please choose the numbers specified below. Next, click "Launch". A new screen will come up once again - click "Launch MATLAB". This button take a few minutes to appear.
- Once MATLAB opens, type
spm fmri
into the the MatLab command line. The SPM GUI will open in MATLAB. In the SPM GUI, select the button that saysBatch
, which will open up the batch editor. You will find the 'Batch' button at the bottom of the Menu popup.
- In the batch, navigate to
SPM > Util > 4D to 3D File Conversion
. This will add "4D to 3D File Conversion" to your Module List (left panel).
- Double click each of the fields listed below and select the following information to fill them.
-
4D Volume --> Select the swausub-XXX_task-musbid_bold.nii volume you copied into your home directory (
/home/<yourusername>/face_name_data/<subjectfolder>/swausub-XXX_task-facename_run-01_bold.nii
from the popup window. (Ensure this file is listed in the bottom part of the popup window then clickDone
.) See below for some tips on how to select files in SPM. -
Output Directory --> select the folder you want the files outputted to. In this case, it will be the
home/<yourusername>/face_name_data/<subjectfolder>/face_name_slices
folder. To ensure the output folder is selected, make sure to click the single dot in the right panel of the popup. See below for some tips on how to select folders in SPM.
- Click the green triangle button on the left corner of the batch window to run the batch. This could take a few minutes, so make sure you do not type anything in the MatLab command window while this is processing. Once the batch has run, go back to your home directory on discovery (
home/<yourusername>/face_name_data/<subjectfolder>/face_name_slices
) to make sure there are 672 slices. If there are, you can close out the batch window without saving it.
1st Level Analysis
- Now you are ready for the 1st level analysis! First, you need to copy the template batch to your home directory (only the first time you do the analysis). You can do this using the copy/paste instructions in section 1 at the top of these instructions (file can be found here: /work/mindlab/Projects/GammaMBI/firstlevel_facename_batch.mat) or using the command below.
cp /work/mindlab/Projects/GammaMBI/firstlevel_facename_batch.mat /home/<yourusername>/face_name_data
- The firstlevel_facename_batch.mat batch contains all the modules you will need for the 1st level analysis. To open this pipeline, follow the steps below:
a. Click Specify 1st-level
b. In Batch Editor, Click File> Load Batch
c. Load firstlevel_facename_batch.mat
(from your scratch)
- Input Directory and Scans. **Note that you should only have to be making changes to the
fMRI model specification
modules. **
fMRI Model Specification
- (Output) `Directory` ← `/home/<yourusername>/face_name_data/<subjectfolder>/face_name_spm/`.
- Scans ← all of the files in `/home/<yourusername>/<subjectfolder>/face_name_data/face_name_slices/`. (There should be 672)
To select all of the scans, make sure the first one is selected, hold down the shift key on your keyboard, and scroll down on the left side of the window so you can see the 672nd file. With the shift button pressed, select the 672nd file.
-
Once you have double checked that the Directories and Scans are correct, click the Run (green triangle) on the top left of the batch window.
-
After the analysis has finished, check that the participant's
face_name_spm
folder in your home directory to ensure it contains the files below.
-
Save the batch to the participant's
face_name_spm
folder (/home/<yourusername>/face_name_data/<subjectfolder>
). To do this, go to the "File" tab in the batch you just ran and select "Save As". You can name the batch using the participant's ID. (You are done with Matlab, so you can now close out of the Matlab session!) -
After completing the analysis, use rsync to sync the subject's folder from your scratch to
/work/mindlab/
(this step as well as the next step will be done from the discovery terminal)
rsync -rltDvu /home/<yourusername>/face_name_data/<subjectfolder> /work/mindlab/Projects/GammaMBI/face_name/pre/
OR
rsync -rltDvu /home/<yourusername>/face_name_data/<subjectfolder> /work/mindlab/Projects/GammaMBI/face_name/post/
- Change the permissions on the folder you just rsync'd into
/work/mindlab/
so anyone in the lab can access your data.
chmod -R 770 /work/mindlab/Projects/GammaMBI/face_name/pre/<subjectfolder>