Skip to content

Commit cd72b7a

Browse files
committed
solve merge conflicts
2 parents f46b3cd + 816f73d commit cd72b7a

24 files changed

+570
-239
lines changed

.github/workflows/run_system_tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ name: system tests
1717
on:
1818
push:
1919
branches:
20-
- master
2120
- main
2221
pull_request:
2322
branches:
24-
- 'master'
2523
- 'main'
2624
schedule:
27-
- cron: "* * 1 * *"
25+
- cron: "0 0 1 * *"
2826

2927
env:
3028
OCTFLAGS: --no-gui --no-window-system --silent

.github/workflows/run_tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ name: tests and coverage
1717
on:
1818
push:
1919
branches:
20-
- master
20+
- main
21+
- dev
2122
pull_request:
2223
branches: '*'
2324

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
% (C) Copyright 2021 Remi Gau
2+
3+
%% Create ROI and extract data from it
4+
%
5+
% FYI: this is "double dipping" as we use the same data to create the ROI
6+
% we are going to extract the value from.
7+
%
8+
9+
run moae_run.m;
10+
11+
subLabel = '01';
12+
13+
saveROI = true;
14+
15+
sphere.radius = 3;
16+
sphere.maxNbVoxels = 200;
17+
18+
opt = setDerivativesDir(opt);
19+
ffxDir = getFFXdir(subLabel, FWHM, opt);
20+
21+
maskImage = spm_select('FPList', ffxDir, '^.*_mask.nii$');
22+
23+
% we get the con image to extract data
24+
% we can do this by using the "label-XXXX" from the mask
25+
p = bids.internal.parse_filename(spm_file(maskImage, 'filename'));
26+
conImage = spm_select('FPList', ffxDir, ['^con_' p.entities.label '.nii$']);
27+
28+
%% Create ROI right auditory cortex
29+
sphere.location = [57 -22 11];
30+
31+
specification = struct( ...
32+
'mask1', maskImage, ...
33+
'mask2', sphere);
34+
35+
[~, roiFile] = createRoi('expand', specification, conImage, pwd, saveROI);
36+
37+
% rename mask image
38+
newname.entities.desc = 'right auditory cortex';
39+
newname.entities.task = '';
40+
newname.entities.label = '';
41+
newname.entities.p = '';
42+
newname.entities.k = '';
43+
newname.entities.MC = '';
44+
rightRoiFile = renameFile(roiFile, newname);
45+
46+
%% same but with left hemisphere
47+
sphere.location = [-57 -22 11];
48+
49+
specification = struct( ...
50+
'mask1', maskImage, ...
51+
'mask2', sphere);
52+
53+
[~, roiFile] = createRoi('expand', specification, conImage, pwd, saveROI);
54+
newname.desc = 'left auditory cortex';
55+
leftRoiFile = renameFile(roiFile, newname);
56+
57+
%%
58+
right_data = spm_summarise(conImage, rightRoiFile);
59+
left_data = spm_summarise(conImage, leftRoiFile);

demos/MoAE/moae_run.m

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
% (C) Copyright 2019 Remi Gau
2+
3+
% This script will download the dataset from the FIL for the block design SPM tutorial
4+
% and will run the basic preprocessing, FFX and contrasts on it.
5+
%
6+
% Results might be a bit different from those in the manual as some
7+
% default options are slightly different in this pipeline
8+
% (e.g use of FAST instead of AR(1), motion regressors added)
9+
10+
clear;
11+
clc;
12+
13+
% Smoothing to apply
14+
FWHM = 6;
15+
16+
downloadData = true;
17+
18+
run ../../initCppSpm.m;
19+
20+
%% Set options
21+
opt = moae_get_option();
22+
23+
download_moae_ds(downloadData);
24+
25+
%% Run batches
26+
% reportBIDS(opt);
27+
bidsCopyRawFolder(opt, 1);
28+
29+
% In case you just want to run segmentation and skull stripping
30+
% NOTE: skull stripping is also included in 'bidsSpatialPrepro'
31+
bidsSegmentSkullStrip(opt);
32+
33+
bidsSTC(opt);
34+
35+
bidsSpatialPrepro(opt);
36+
37+
% The following do not run on octave for now (because of spmup)
38+
% anatomicalQA(opt);
39+
% bidsResliceTpmToFunc(opt);
40+
% functionalQA(opt);
41+
42+
% create a whole brain functional mean image mask
43+
% so the mask will be in the same resolution/space as the functional images
44+
% one may not need it if they are running bidsFFX
45+
% since it creates a mask.nii by default
46+
opt.skullstrip.mean = 1;
47+
mask = bidsWholeBrainFuncMask(opt);
48+
49+
% smoooth the funcitional images
50+
bidsSmoothing(FWHM, opt);
51+
52+
% The following crash on Travis CI
53+
bidsFFX('specifyAndEstimate', opt, FWHM);
54+
bidsFFX('contrasts', opt, FWHM);
55+
bidsResults(opt, FWHM);

src/batches/setBatchSubjectLevelContrasts.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@
2323

2424
spmMatFile = cellstr(fullfile(ffxDir, 'SPM.mat'));
2525

26+
load(spmMatFile{1}, 'SPM');
27+
28+
model = spm_jsonread(opt.model.file);
29+
2630
% Create Contrasts
27-
contrasts = specifyContrasts(ffxDir, opt.taskName, opt);
31+
contrasts = specifyContrasts(SPM, opt.taskName, model);
2832
for icon = 1:size(contrasts, 2)
2933
consess{icon}.tcon.name = contrasts(icon).name; %#ok<*AGROW>
3034
consess{icon}.tcon.convec = contrasts(icon).C;

src/batches/setBatchSubjectLevelGLMSpec.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'suffix', 'bold', ...
4545
'extension', '.nii');
4646
hdr = spm_vol(fileName{1});
47+
4748
% we are assuming axial acquisition here
4849
sliceOrder = 1:hdr(1).dim(3);
4950
end

src/batches/setBatchSubjectLevelResults.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
result.outputNameStructure = struct( ...
4040
'suffix', 'spmT', ...
4141
'ext', '.nii', ...
42+
'use_schema', 'false', ...
4243
'entities', struct('sub', '', ...
4344
'task', opt.taskName, ...
4445
'space', opt.space, ...

src/getBoldFilename.m

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
function [boldFileName, subFuncDataDir] = getBoldFilename(varargin)
2+
%
3+
% Get the filename and the directory of a bold file for a given session /
4+
% run.
5+
%
6+
% Unzips the file if necessary.
7+
%
8+
% USAGE::
9+
%
10+
% [boldFileName, subFuncDataDir] = getBoldFilename(BIDS, subID, sessionID, runID, opt)
11+
%
12+
% :param BIDS: returned by bids.layout when exploring a BIDS data set.
13+
% :type BIDS: structure
14+
% :param subID: label of the subject ; in BIDS lingo that means that for a file name
15+
% ``sub-02_task-foo_bold.nii`` the subID will be the string ``02``
16+
% :type subID: string
17+
% :param sessionID: session label (for `ses-001`, the label will be `001`)
18+
% :type sessionID: string
19+
% :param runID: run index label (for `run-001`, the label will be `001`)
20+
% :type runID: string
21+
% :param opt: Mostly used to find the task name.
22+
% :type opt: structure
23+
%
24+
%
25+
% :returns: - :boldFileName: (string)
26+
% - :subFuncDataDir: (string)
27+
%
28+
%
29+
% (C) Copyright 2020 CPP_SPM developers
30+
31+
[BIDS, subID, sessionID, runID, opt] = deal(varargin{:});
32+
33+
if isempty(opt.query)
34+
opt.query = struct('extension', '.nii');
35+
else
36+
opt.query.extension = '.nii';
37+
end
38+
39+
% get the filename for this bold run for this task
40+
boldFileName = getInfo(BIDS, subID, opt, 'Filename', sessionID, runID, 'bold');
41+
42+
% get fullpath of the file
43+
% ASSUMPTION: the first file is the right one.
44+
boldFileName = unzipImgAndReturnsFullpathName(boldFileName);
45+
46+
[subFuncDataDir, boldFileName, ext] = spm_fileparts(boldFileName);
47+
boldFileName = [boldFileName ext];
48+
49+
end

src/reports/copyFigures.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function copyFigures(BIDS, opt, subLabel)
2424
runs = bids.query(BIDS, 'runs', ...
2525
'sub', subLabel, ...
2626
'task', opt.taskName, ...
27-
'type', 'bold');
27+
'suffix', 'bold');
2828

2929
nbRuns = size(runs, 2);
3030
if nbRuns == 0

src/reports/reportBIDS.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ function reportBIDS(opt)
1717
%
1818
% (C) Copyright 2020 CPP_SPM developers
1919

20+
warning('bidsReport is broken and waiting for a fix on the bids-matlab side.');
21+
22+
return
23+
2024
bids.report(opt.dir.raw);
2125

2226
end

0 commit comments

Comments
 (0)