Face repetition#
This is based on the event related design dataset of SPM.
preprocessing#
- face_rep_01_bids_app#
This script will download the face repetition dataset from SPM and will run the basic preprocessing.
Download
downloads and BIDSify the dataset from the FIL website
Preprocessing
copies the necessary data from the raw to the derivative folder,
runs slice time correction
runs spatial preprocessing
those are otherwise handled by the workflows:
type bidspm help or bidspm(‘action’, ‘help’) or see this page: https://bidspm.readthedocs.io/en/stable/bids_app_api.html for more information on what parameters are obligatory or optional
script
clear;
clc;
download_data = true;
addpath(fullfile(pwd, '..', '..'));
%% Gets data and converts it to BIDS
bidspm();
if download_data
download_face_rep_ds(download_data);
end
%% Preprocessing
bids_dir = fullfile(fileparts(mfilename('fullpath')), 'outputs', 'raw');
output_dir = fullfile(bids_dir, '..', 'derivatives');
subject_label = '01';
bidspm(bids_dir, output_dir, 'subject', ...
'participant_label', {subject_label}, ...
'action', 'preprocess', ...
'task', 'facerepetition', ...
'space', {'individual', 'IXI549Space'});
preprocessing anat only#
- face_rep_01_anat_only#
This show how an anat only pipeline would look like.
Download
downloads and BIDSify the dataset from the FIL website
Preprocessing
copies the necessary data from the raw to the derivative folder,
runs spatial preprocessing
those are otherwise handled by the workflows:
type bidspm help or bidspm(‘action’, ‘help’) or see this page: https://bidspm.readthedocs.io/en/stable/bids_app_api.html for more information on what parameters are obligatory or optional
script
clear;
clc;
download_data = true;
addpath(fullfile(pwd, '..', '..'));
%% Gets data and converts it to BIDS
if download_data
bidspm();
download_face_rep_ds(download_data);
end
bids_dir = fullfile(fileparts(mfilename('fullpath')), 'outputs', 'raw');
output_dir = fullfile(bids_dir, '..', 'derivatives');
bidspm(bids_dir, output_dir, 'subject', ...
'action', 'preprocess', ...
'space', {'individual', 'IXI549Space'}, ...
'anat_only', true, ...
'skip_validation', true);
stats#
- face_rep_02_stats#
Warning
This script assumes you have already preprocessed the data with face_rep_01_bids_app.m
stats
This script will run the FFX and contrasts on the the face repetition dataset from SPM.
GLM specification + estimation
compute contrasts
show results
that are otherwise handled by the workflows
Note
Results might be a bit different from those in the SPM manual as some default options are slightly different in this pipeline (e.g use of FAST instead of AR(1), motion regressors added)
type bidspm help or bidspm(‘action’, ‘help’) or see this page: https://bidspm.readthedocs.io/en/stable/bids_app_api.html for more information on what parameters are obligatory or optional
script
clear;
clc;
addpath(fullfile(pwd, '..', '..'));
bidspm();
this_dir = fileparts(mfilename('fullpath'));
bids_dir = fullfile(this_dir, 'outputs', 'raw');
output_dir = fullfile(this_dir, 'outputs', 'derivatives');
preproc_dir = fullfile(output_dir, 'bidspm-preproc');
model_file = fullfile(this_dir, 'models', 'model-faceRepetition_smdl.json');
subject_label = '01';
% this bids app call will run:
%
% - GLM specification + estimation,
% - compute contrasts and
% - show results
%
% that are otherwise handled by the bidsFFX.m and bidsResults.m workflows
%
% type bidspm('action', 'help')
% or see this page: https://bidspm.readthedocs.io/en/stable/bids_app_api.html
% for more information on what parameters are obligatory or optional
%
% The results to show are specified in the model
%
bidspm(bids_dir, output_dir, 'subject', ...
'action', 'stats', ...
'participant_label', {subject_label}, ...
'preproc_dir', preproc_dir, ...
'model_file', model_file);
BIDS stats model
{
"Name": "resampling",
"BIDSModelVersion": "1.0.0",
"Description": "model for face repetition",
"Input": {
"task": [
"facerepetition"
],
"space": [
"IXI549Space"
]
},
"Nodes": [
{
"Level": "Run",
"Name": "run_level",
"GroupBy": [
"run",
"subject"
],
"Transformations": {
"Description": "merge the familiarity and repetition column to create the trial type column",
"Transformer": "bidspm",
"Instructions": [
{
"Name": "Concatenate",
"Input": [
"face_type",
"repetition_type"
],
"Output": "trial_type"
}
]
},
"Model": {
"X": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat",
"trans_?",
"rot_?"
],
"HRF": {
"Variables": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Model": "spm + derivative + dispersion"
},
"Type": "glm",
"Options": {
"HighPassFilterCutoffHz": 0.0078,
"Mask": {
"suffix": [
"mask"
],
"desc": [
"brain"
]
}
},
"Software": {
"SPM": {
"SerialCorrelation": "AR(1)"
},
"bidspm": {
"Results": [
{
"name": [
"faces_gt_baseline_1"
],
"p": 0.05,
"MC": "FWE",
"png": true,
"binary": true,
"threshSpm": true,
"nidm": true,
"montage": {
"do": true,
"orientation": "axial",
"slices": [
-26,
-22,
-18,
-14,
-10,
-6,
-2,
2,
6
],
"background": {
"suffix": "T1w",
"desc": "preproc",
"modality": "anat"
}
}
},
{
"name": [
"motion"
]
}
]
}
}
},
"DummyContrasts": {
"Test": "t",
"Contrasts": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
]
},
"Contrasts": [
{
"Name": "faces_gt_baseline",
"ConditionList": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Weights": [
1,
1,
1,
1
],
"Test": "t"
},
{
"Name": "faces_lt_baseline",
"ConditionList": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Weights": [
-1,
-1,
-1,
-1
],
"Test": "t"
},
{
"Name": "motion",
"ConditionList": [
"trans_x",
"trans_y",
"trans_z",
"rot_x",
"rot_y",
"rot_z"
],
"Weights": [
[
1,
0,
0,
0,
0,
0
],
[
0,
1,
0,
0,
0,
0
],
[
0,
0,
1,
0,
0,
0
],
[
0,
0,
0,
1,
0,
0
],
[
0,
0,
0,
0,
1,
0
],
[
0,
0,
0,
0,
0,
1
]
],
"Test": "F"
}
]
}
]
}
stats: parametric analysis#
- face_rep_02_stats_parametric#
This script will run the parametric model and contrasts on the the face repetition dataset from SPM.
script
clear;
clc;
addpath(fullfile(pwd, '..', '..'));
bidspm();
this_dir = fileparts(mfilename('fullpath'));
bids_dir = fullfile(this_dir, 'outputs', 'raw');
output_dir = fullfile(this_dir, 'outputs', 'derivatives');
preproc_dir = fullfile(output_dir, 'bidspm-preproc');
model_file = fullfile(this_dir, 'models', 'model-faceRepetitionParametric_smdl.json');
subject_label = '01';
bidspm(bids_dir, output_dir, 'subject', ...
'action', 'stats', ...
'participant_label', {subject_label}, ...
'preproc_dir', preproc_dir, ...
'model_file', model_file);
BIDS stats model
{
"Name": "parametric modulation",
"BIDSModelVersion": "1.0.0",
"Description": "model for face repetition",
"Input": {
"task": [
"facerepetition"
],
"space": [
"IXI549Space"
]
},
"Nodes": [
{
"Level": "Run",
"Name": "parametric",
"GroupBy": [
"run",
"subject"
],
"Transformations": {
"Description": "merge the familiarity and repetition column to create the trial type column",
"Transformer": "bidspm",
"Instructions": [
{
"Name": "Concatenate",
"Input": [
"face_type",
"repetition_type"
],
"Output": "trial_type"
}
]
},
"Model": {
"X": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat",
"trans_?",
"rot_?"
],
"HRF": {
"Variables": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Model": "spm"
},
"Type": "glm",
"Options": {
"HighPassFilterCutoffHz": 0.0078,
"Mask": {
"suffix": [
"mask"
],
"desc": [
"brain"
]
}
},
"Software": {
"SPM": {
"SerialCorrelation": "AR(1)",
"ParametricModulations": [
{
"Name": "lag mod",
"Conditions": [
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_delayed_repeat"
],
"Values": [
"lag"
],
"PolynomialExpansion": 2
}
]
}
}
},
"DummyContrasts": {
"Test": "t",
"Contrasts": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
]
},
"Contrasts": [
{
"Name": "faces_gt_baseline",
"ConditionList": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Weights": [
1,
1,
1,
1
],
"Test": "t"
},
{
"Name": "faces_lt_baseline",
"ConditionList": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Weights": [
-1,
-1,
-1,
-1
],
"Test": "t"
}
]
}
]
}
region of interest#
- face_rep_03_roi_analysis#
Creates a ROI in MNI space from the retinotopic probabilistic atlas.
Creates its equivalent in subject space (inverse normalization).
Then uses marsbar to run a ROI based GLM
script
% (C) Copyright 2019 Remi Gau
clear;
close all;
clc;
addpath(fullfile(pwd, '..', '..'));
bidspm();
this_dir = fileparts(mfilename('fullpath'));
%% Create roi
output_dir = fullfile(this_dir, 'outputs', 'derivatives');
preproc_dir = fullfile(output_dir, 'bidspm-preproc');
bidspm(pwd, output_dir, 'subject', ...
'action', 'create_roi', ...
'participant_label', {'01'}, ...
'preproc_dir', preproc_dir, ...
'roi_atlas', 'wang', ...
'roi_name', {'V1v', 'V1d'}, ...
'space', {'IXI549Space', 'individual'});
%% run GLM
bids_dir = fullfile(this_dir, 'outputs', 'raw');
roi_dir = fullfile(output_dir, 'bidspm-roi');
model_file = fullfile(this_dir, 'models', 'model-faceRepetition_smdl.json');
bidspm(bids_dir, output_dir, 'subject', ...
'action', 'stats', ...
'participant_label', {'01'}, ...
'preproc_dir', preproc_dir, ...
'model_file', model_file, ...
'roi_based', true, ...
'roi_name', {'V1v', 'V1d'}, ...
'roi_dir', roi_dir, ...
'space', {'individual'}, ...
'fwhm', 0);
BIDS stats model
{
"Name": "resampling",
"BIDSModelVersion": "1.0.0",
"Description": "model for face repetition",
"Input": {
"task": [
"facerepetition"
],
"space": [
"IXI549Space"
]
},
"Nodes": [
{
"Level": "Run",
"Name": "run_level",
"GroupBy": [
"run",
"subject"
],
"Transformations": {
"Description": "merge the familiarity and repetition column to create the trial type column",
"Transformer": "bidspm",
"Instructions": [
{
"Name": "Concatenate",
"Input": [
"face_type",
"repetition_type"
],
"Output": "trial_type"
}
]
},
"Model": {
"X": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat",
"trans_?",
"rot_?"
],
"HRF": {
"Variables": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Model": "spm + derivative + dispersion"
},
"Type": "glm",
"Options": {
"HighPassFilterCutoffHz": 0.0078,
"Mask": {
"suffix": [
"mask"
],
"desc": [
"brain"
]
}
},
"Software": {
"SPM": {
"SerialCorrelation": "AR(1)"
},
"bidspm": {
"Results": [
{
"name": [
"faces_gt_baseline_1"
],
"p": 0.05,
"MC": "FWE",
"png": true,
"binary": true,
"threshSpm": true,
"nidm": true,
"montage": {
"do": true,
"orientation": "axial",
"slices": [
-26,
-22,
-18,
-14,
-10,
-6,
-2,
2,
6
],
"background": {
"suffix": "T1w",
"desc": "preproc",
"modality": "anat"
}
}
},
{
"name": [
"motion"
]
}
]
}
}
},
"DummyContrasts": {
"Test": "t",
"Contrasts": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
]
},
"Contrasts": [
{
"Name": "faces_gt_baseline",
"ConditionList": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Weights": [
1,
1,
1,
1
],
"Test": "t"
},
{
"Name": "faces_lt_baseline",
"ConditionList": [
"trial_type.famous_first_show",
"trial_type.famous_delayed_repeat",
"trial_type.unfamiliar_first_show",
"trial_type.unfamiliar_delayed_repeat"
],
"Weights": [
-1,
-1,
-1,
-1
],
"Test": "t"
},
{
"Name": "motion",
"ConditionList": [
"trans_x",
"trans_y",
"trans_z",
"rot_x",
"rot_y",
"rot_z"
],
"Weights": [
[
1,
0,
0,
0,
0,
0
],
[
0,
1,
0,
0,
0,
0
],
[
0,
0,
1,
0,
0,
0
],
[
0,
0,
0,
1,
0,
0
],
[
0,
0,
0,
0,
1,
0
],
[
0,
0,
0,
0,
0,
1
]
],
"Test": "F"
}
]
}
]
}