Step 3: Create training set
The next step in this tutorial is to create a training set, which will then be used to train the algorithm as to what the brain activity looks like when the participant is viewing a face, house, etc.
To create a training set for each stimulus category, you will need to randomly select 6 of the 8 runs for each category.
For the stimulus category "cars", we will randomly select runs 3, 8, 4, 6, 5, and 7 to use for training (runs 1 and 2 will be used for testing).
Once the runs are randomly selected, we will then run the following command to generate a training set for the stimulus category "cars":
3dTcat -prefix cars.train.nii cars.3.nii cars.8.nii cars.4.nii cars.6.nii cars.5.nii cars.7.nii
We will then do the same thing for the next stimulus category "faces" – randomly selecting runs 2, 8, 1, 7, 4, 5 for the testing set (leaving 3 and 6 for the training set):
3dTcat -prefix faces.train.nii faces.2.nii faces.8.nii faces.1.nii faces.7.nii faces.4.nii faces.5.nii
We will continue the same way with houses, randomly selecting runs 5, 3, 4, 8, 6, 7:
3dTcat -prefix houses.train.nii houses.5.nii houses.3.nii houses.4.nii houses.8.nii houses.6.nii houses.7.nii
And again with shoes, randomly selecting runs 8, 7, 4, 3, 6, 2:
3dTcat -prefix shoes.train.nii shoes.8.nii shoes.7.nii shoes.4.nii shoes.3.nii shoes.6.nii shoes.2.nii
Note: in a typical study, you would want to generate multiple training sets per category (~10 sets) and then concatenate those multiple sets into a single training set for each category. For simplification purposes with this tutorial, we are only showing how to generate one training set per category.
After creating a training set for each category, we then need to concatenate these four training sets into a single traning set. To do this, enter the following command in terminal:
3dTcat -prefix trainBlock.nii cars.train.nii faces.train.nii houses.train.nii shoes.train.nii
Finally, we need to create a file that tells the algorithm what order the stimuli appear in the final concatenated training set (trainBlock.nii). We have provided you with this file in the example dataset folder (trainLabels.1D), or you can create your own according to the process below:
The trainLabels.1D file should consist of a single column of category labels (we use the numbers 1-4) that correspond to the order of stimuli category in the dataset. You can create this 1D file in a simple text editor.
Because our final training block (trainBlock.nii) consists of a concatenated dataset of 6 car betas, followed by 6 face betas, followed by 6 house betas, followed by 6 shoe betas, the trainLabels.1D file should consist of a column of 6 1's (car label), followed by 6 2's (face label), followed by 6 3's (house label), followed by 6 4's (shoe label).
Thus, the contents of the 1D file should look like this:
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4
4
4
4