Skip to content

Commit f0aa0c0

Browse files
authored
Merge pull request #394 from Remi-Gau/parallel
remove parfor from spatial processing and add QA options
2 parents 946726a + c2fb978 commit f0aa0c0

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

src/QA/functionalQA.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ function functionalQA(opt)
9797

9898
outputFiles = spmup_first_level_qa( ...
9999
funcImage, ...
100-
'Voltera', 'on', ...
100+
'MotionParameters', opt.QA.func.Motion, ...
101+
'FramewiseDisplacement', opt.QA.func.FD, ...
102+
'Globals', opt.QA.func.Globals, ...
103+
'Movie', opt.QA.func.Movie, ...
104+
'Basics', opt.QA.func.Basics, ...
105+
'Voltera', opt.QA.func.Voltera, ...
101106
'Radius', anatQA.avgDistToSurf);
102107

103108
movefile( ...
@@ -122,7 +127,7 @@ function functionalQA(opt)
122127

123128
% horrible hack to prevent the "abrupt" way spmup_volumecorr crashes
124129
% if nansum is not there
125-
if exist('nansum', 'file') == 2
130+
if opt.QA.func.carpetPlot && exist('nansum', 'file') == 2
126131
spmup_timeseriesplot(funcImage, TPMs(1, :), TPMs(2, :), TPMs(3, :), ...
127132
'motion', 'on', ...
128133
'nuisances', 'on', ...

src/defaults/checkOptions.m

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@
5757
% if you know the order in which slices were acquired, you should be able to recompute
5858
% slice timing and add it to the json files in your BIDS data set.
5959
% - ``opt.glm.roibased.do``
60-
% - ``opt.glm.QA.do = true`` - If set to ``true`` the residual images of a
60+
% - ``opt.QA.func.carpetPlot = true`` to plot carpet plot when running ``functionaQA``
61+
% - ``opt.QA.func`` contains a lot of options used by ``spmup_first_level_qa``
62+
% in ``functionaQA``
63+
% - ``opt.QA.func.MotionParameters = 'on'``
64+
% - ``opt.QA.func.FramewiseDisplacement = 'on'``
65+
% - ``opt.QA.func.Voltera = 'on'``
66+
% - ``opt.QA.func.Globals = 'on'``
67+
% - ``opt.QA.func.Movie = 'on'`` ; set it to ``off`` to skip generating movies
68+
% of the time series
69+
% - ``opt.QA.func.Basics = 'on'``
70+
% - ``opt.QA.glm.do = true`` - If set to ``true`` the residual images of a
6171
% GLM at the subject levels will be used to estimate if there is any remaining structure
6272
% in the GLM residuals (the power spectra are not flat) that could indicate
6373
% the subject level results are likely confounded (see
@@ -134,7 +144,15 @@
134144
fieldsToSet.model.hrfDerivatives = [0 0];
135145
fieldsToSet.contrastList = {};
136146

137-
fieldsToSet.glm.QA.do = true;
147+
fieldsToSet.QA.glm.do = true;
148+
fieldsToSet.QA.func.carpetPlot = true;
149+
fieldsToSet.QA.func.Motion = 'on';
150+
fieldsToSet.QA.func.FD = 'on';
151+
fieldsToSet.QA.func.Voltera = 'on';
152+
fieldsToSet.QA.func.Globals = 'on';
153+
fieldsToSet.QA.func.Movie = 'on';
154+
fieldsToSet.QA.func.Basics = 'on';
155+
138156
fieldsToSet.glm.roibased.do = false;
139157

140158
% specify the results to compute

src/workflows/bidsFFX.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function bidsFFX(action, opt, funcFWHM)
8585

8686
saveAndRunWorkflow(matlabbatch, batchName, opt, subLabel);
8787

88-
if opt.glm.QA.do
88+
if opt.QA.glm.do
8989
plot_power_spectra_of_GLM_residuals( ...
9090
getFFXdir(subLabel, funcFWHM, opt), ...
9191
opt.metadata.RepetitionTime);

src/workflows/bidsSpatialPrepro.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function bidsSpatialPrepro(opt)
4747
opt.orderBatches.skullStripping = 6;
4848
opt.orderBatches.skullStrippingMask = 7;
4949

50-
parfor iSub = 1:numel(opt.subjects)
50+
for iSub = 1:numel(opt.subjects)
5151

5252
matlabbatch = {};
5353

tests/utils/defaultOptions.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@
3535

3636
expectedOptions.contrastList = {};
3737

38-
expectedOptions.glm.QA.do = true;
38+
expectedOptions.QA.glm.do = true;
39+
expectedOptions.QA.func.carpetPlot = true;
40+
expectedOptions.QA.func.Motion = 'on';
41+
expectedOptions.QA.func.FD = 'on';
42+
expectedOptions.QA.func.Voltera = 'on';
43+
expectedOptions.QA.func.Globals = 'on';
44+
expectedOptions.QA.func.Movie = 'on';
45+
expectedOptions.QA.func.Basics = 'on';
46+
3947
expectedOptions.glm.roibased.do = false;
4048

4149
expectedOptions.model.file = '';

0 commit comments

Comments
 (0)