Skip to content

Commit f7e398b

Browse files
authored
Merge pull request #60 from Remi-Gau/remi-dev
fix RFX issues and add credits
2 parents 46591eb + e08c269 commit f7e398b

File tree

6 files changed

+135
-45
lines changed

6 files changed

+135
-45
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[![Build Status](https://travis-ci.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline.svg?branch=master)](https://travis-ci.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline)
22
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
3+
[![DOI](https://zenodo.org/badge/208231636.svg)](https://zenodo.org/badge/latestdoi/208231636)
4+
35

46
# Instructions for SPM12 Preprocessing Pipeline
57

batch.m

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
% __ ____ ____ _ _ _
2+
% / _)( _ \( _ \ | | / \ | )
3+
% ( (_ )___/ )___/ | |_ / _ \ | \
4+
% \__)(__) (__) |___||_/ \_||__)
5+
%
6+
% Thank you for using the CPP lap pipeline - version 0.0.3.
7+
%
8+
% Current list of contributors includes
9+
% Mohamed Rezk
10+
% Rémi Gau
11+
% Olivier Collignon
12+
% Ane Gurtubay
13+
% Marco Barilari
14+
%
15+
% Please cite using the following DOI:
16+
% https://doi.org/10.5281/zenodo.3554332
17+
%
18+
% For bug report, suggestions for improvements or contributions see our github repo:
19+
% https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline
20+
121
clear
222
clc
323

@@ -18,16 +38,16 @@
1838
checkDependencies();
1939

2040
% copy raw folder into derivatives folder
21-
BIDS_copyRawFolder(opt, 1)
41+
% BIDS_copyRawFolder(opt, 1)
2242

2343
% preprocessing
24-
BIDS_STC(opt);
25-
BIDS_SpatialPrepro(opt);
26-
BIDS_Smoothing(6, opt);
44+
% BIDS_STC(opt);
45+
% BIDS_SpatialPrepro(opt);
46+
% BIDS_Smoothing(6, opt);
2747

2848
% subject level Univariate
29-
BIDS_FFX(1, 6, opt);
30-
BIDS_FFX(2, 6, opt);
49+
% BIDS_FFX(1, 6, opt);
50+
% BIDS_FFX(2, 6, opt);
3151

3252
% group level univariate
3353
BIDS_RFX(1, 6, 6)
@@ -36,9 +56,9 @@
3656
BIDS_Results(6, 6, opt, 0)
3757

3858
% subject level multivariate
39-
isMVPA=1;
40-
BIDS_FFX(1, 6, opt, isMVPA);
41-
BIDS_FFX(2, 6, opt, isMVPA);
42-
make4Dmaps(6,opt)
59+
% isMVPA=1;
60+
% BIDS_FFX(1, 6, opt, isMVPA);
61+
% BIDS_FFX(2, 6, opt, isMVPA);
62+
% make4Dmaps(6,opt)
4363

4464

getOption.m

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
function opt = getOption()
2+
% __ ____ ____ _ _ _
3+
% / _)( _ \( _ \ | | / \ | )
4+
% ( (_ )___/ )___/ | |_ / _ \ | \
5+
% \__)(__) (__) |___||_/ \_||__)
6+
%
7+
% Thank you for using the CPP lap pipeline - version 0.0.3.
8+
%
9+
% Current list of contributors includes
10+
% Mohamed Rezk
11+
% Rémi Gau
12+
% Olivier Collignon
13+
% Ane Gurtubay
14+
% Marco Barilari
15+
%
16+
% Please cite using the following DOI:
17+
% https://doi.org/10.5281/zenodo.3554332
18+
%
19+
% For bug report, suggestions for improvements or contributions see our github repo:
20+
% https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline
21+
22+
223
% returns a structure that contains the options chosen by the user to run
324
% slice timing correction, pre-processing, FFX, RFX.
425

@@ -9,18 +30,34 @@
930
% group of subjects to analyze
1031
opt.groups = {''};
1132
% suject to run in each group
12-
opt.subjects = {[1:2]};
33+
opt.subjects = {[]};
1334

1435

1536
% task to analyze
16-
opt.taskName = 'MotionDecoding';
37+
opt.taskName = 'visMotion';
1738

1839

1940
% The directory where the data are located
20-
opt.dataDir = '/Users/mohamed/Desktop/MotionWorkshop/raw';
21-
opt.dataDir = '/Users/mohamed/Desktop/Data/raw';
41+
opt.dataDir = '/home/remi/BIDS/visMotion/derivatives/';
2242

2343

44+
% specify the model file that contains the contrasts to compute
45+
opt.model.univariate.file = '/home/remi/github/CPP_BIDS_SPM_pipeline/model-visMotionLoc_smdl.json';
46+
opt.model.multivariate.file = '';
47+
48+
49+
% specify the result to compute
50+
opt.result.Steps(1) = struct(...
51+
'Level', 'dataset', ...
52+
'Contrasts', struct(...
53+
'Name', 'VisMot_gt_VisStat', ... % has to match one of the contrast defined in the model json file
54+
'Mask', false, ... % this might need improving if a mask is required
55+
'MC', 'FWE', ... FWE, none, FDR
56+
'p', 0.05, ...
57+
'k', 0, ...
58+
'NIDM', true) );
59+
60+
2461
% Options for slice time correction
2562
% If left unspecified the slice timing will be done using the mid-volume acquisition
2663
% time point as reference.
@@ -40,26 +77,8 @@
4077
opt.JOBS_dir = fullfile(opt.dataDir, '..', 'derivatives', 'SPM12_CPPL', 'JOBS', opt.taskName);
4178

4279

43-
% specify the model file that contains the contrasts to compute
44-
opt.model.univariate.file = '/Users/mohamed/Documents/GitHub/BIDS_fMRI_scripts/model-motionDecodingUnivariate_smdl.json';
45-
opt.model.multivariate.file = '/Users/mohamed/Documents/GitHub/BIDS_fMRI_scripts/model-motionDecodingMultivariate_smdl.json';
46-
47-
48-
% specify the result to compute
49-
opt.result.Steps(1) = struct(...
50-
'Level', 'dataset', ...
51-
'Contrasts', struct(...
52-
'Name', 'Vis_U', ... % has to match one of the contrast defined in the model json file
53-
'Mask', false, ... % this might need improving if a mask is required
54-
'MC', 'none', ... FWE, none, FDR
55-
'p', 0.05, ...
56-
'k', 0, ...
57-
'NIDM', true) );
58-
59-
6080
% Save the opt variable as a mat file to load directly in the preprocessing
6181
% scripts
6282
save('opt.mat','opt')
6383

64-
6584
end

subfun/BIDS_RFX.m

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
8080
end
8181

8282
% save the matlabbatch
83+
[~, ~, ~] = mkdir(JOBS_dir);
8384
save(fullfile(JOBS_dir, ...
8485
['jobs_matlabbatch_SPM12_SmoothCon_',...
8586
num2str(mmConSmoothing),'_',...
@@ -193,6 +194,7 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
193194
fprintf(1,'Create Mean Struct and Mask IMAGES...')
194195

195196
% save the matlabbatch
197+
[~, ~, ~] = mkdir(JOBS_dir);
196198
save(fullfile(JOBS_dir, ...
197199
'jobs_matlabbatch_SPM12_CreateMeanStrucMask.mat'), ...
198200
'matlabbatch')
@@ -229,7 +231,7 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
229231
% the strrep(Session{j}, 'trial_type.', '') is there to remove
230232
% 'trial_type.' because contrasts against baseline are renamed
231233
% at the subject level
232-
conName = strrep(grpLvlCon{j}, 'trial_type.', '');
234+
conName = rmTrialTypeStr(grpLvlCon{j});
233235

234236
con = con+1;
235237

@@ -284,11 +286,10 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
284286
fprintf(1,'A DIRECTORY WITH THIS NAME ALREADY EXISTED AND WAS OVERWRITTEN, SORRY \n');
285287
rmdir(fullfile(RFX_FolderName, conName),'s')
286288
end
289+
287290
mkdir(fullfile(RFX_FolderName, conName))
288-
289-
matlabbatch{j}.spm.stats.factorial_design.dir = {...
290-
fullfile(RFX_FolderName,...
291-
grpLvlCon{j}) };
291+
matlabbatch{j}.spm.stats.factorial_design.dir = { fullfile(RFX_FolderName, conName) };
292+
292293
end
293294

294295
% Go to Jobs directory and save the matlabbatch
@@ -307,10 +308,8 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
307308
matlabbatch = {};
308309

309310
for j = 1:size(grpLvlCon,1)
310-
matlabbatch{j}.spm.stats.fmri_est.spmmat = {...
311-
fullfile(RFX_FolderName,...
312-
grpLvlCon{j},...
313-
'SPM.mat')};
311+
conName = rmTrialTypeStr(grpLvlCon{j});
312+
matlabbatch{j}.spm.stats.fmri_est.spmmat = { fullfile(RFX_FolderName, conName, 'SPM.mat') };
314313
matlabbatch{j}.spm.stats.fmri_est.method.Classical = 1;
315314
end
316315

@@ -332,10 +331,8 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
332331

333332
% ADD/REMOVE CONTRASTS DEPENDING ON YOUR EXPERIMENT AND YOUR GROUPS
334333
for j = 1:size(grpLvlCon,1)
335-
matlabbatch{j}.spm.stats.con.spmmat = {...
336-
fullfile(RFX_FolderName,...
337-
grpLvlCon{j},...
338-
'SPM.mat')};
334+
conName = rmTrialTypeStr(grpLvlCon{j});
335+
matlabbatch{j}.spm.stats.con.spmmat = {fullfile(RFX_FolderName, conName, 'SPM.mat')};
339336
matlabbatch{j}.spm.stats.con.consess{1}.tcon.name = 'GROUP';
340337
matlabbatch{j}.spm.stats.con.consess{1}.tcon.convec = 1;
341338
matlabbatch{j}.spm.stats.con.consess{1}.tcon.sessrep = 'none';
@@ -354,3 +351,9 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
354351
end
355352

356353
end
354+
355+
356+
357+
function conName = rmTrialTypeStr(conName)
358+
conName = strrep(conName, 'trial_type.', '');
359+
end

subfun/checkDependencies.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function checkDependencies()
22
% Checks that that the right dependencies are installed. ALso loads the spm defaults.
33

4+
printCredits()
45

56
SPM_main = 'SPM12';
67
SPM_sub = '7487';

subfun/printCredits.m

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
function printCredits()
2+
3+
version = '0.0.3';
4+
5+
contributors = {...
6+
'Mohamed Rezk',...
7+
'Rémi Gau', ...
8+
'Olivier Collignon',...
9+
'Ane Gurtubay', ...
10+
'Marco Barilari'};
11+
12+
DOI_URL = 'https://doi.org/10.5281/zenodo.3554332';
13+
14+
repoURL = 'https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline';
15+
16+
disp( '____________________________________________________________________________________________');
17+
disp( '____________________________________________________________________________________________');
18+
disp( ' ');
19+
disp( ' __ ____ ____ _ _ _ ');
20+
disp( ' / _)( _ \( _ \ | | / \ | ) ');
21+
disp( '( (_ )___/ )___/ | |_ / _ \ | \ ');
22+
disp( ' \__)(__) (__) |___||_/ \_||__)');
23+
disp( ' ');
24+
25+
splash = 'Thank you for using the CPP lap pipeline - version %s. ';
26+
fprintf(splash, version)
27+
fprintf('\n\n');
28+
29+
fprintf('Current list of contributors includes\n')
30+
for iCont = 1:numel(contributors)
31+
fprintf(' %s\n', contributors{iCont})
32+
end
33+
fprintf('\b\n\n')
34+
35+
fprintf('Please cite using the following DOI: \n %s\n\n', DOI_URL)
36+
37+
fprintf('For bug report, suggestions for improvements or contributions see our github repo: \n %s\n\n', repoURL)
38+
39+
40+
disp( '____________________________________________________________________________________________');
41+
disp( '____________________________________________________________________________________________');
42+
43+
fprintf('\n\n')
44+
45+
end

0 commit comments

Comments
 (0)