Skip to content

Commit 3959b97

Browse files
committed
fix graphic windows set up when in command line mode
1 parent 4deda58 commit 3959b97

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

demos/MoAE/MoAEpilot_run.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
WD = fileparts(mfilename('fullpath'));
2020

2121
% we add all the subfunctions that are in the sub directories
22-
addpath(fullfile(WD, '..'));
23-
addpath(genpath(fullfile(WD, '..', 'src')));
24-
addpath(genpath(fullfile(WD, '..', 'lib')));
22+
addpath(genpath(fullfile(WD, '..', '..', 'src')));
23+
addpath(genpath(fullfile(WD, '..', '..', 'lib')));
2524

2625
%% Set options
2726
opt = MoAEpilot_getOption();

src/reports/copyGraphWindownOutput.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
%
2525
% assumes that no file was generated if SPM is running in command line mode
2626

27-
if ~spm('CmdLine')
27+
if nargin < 4 || isempty(imgNb)
28+
imgNb = 1;
29+
end
2830

29-
if nargin < 4 || isempty(imgNb)
30-
imgNb = 1;
31-
end
31+
if nargin < 3 || isempty(action)
32+
action = '';
33+
end
3234

33-
if nargin < 3 || isempty(action)
34-
action = '';
35-
end
35+
if ~spm('CmdLine') && ~isOctave
3636

3737
figureDir = fullfile(opt.derivativesDir, ['sub-' subID], 'figures');
3838
if ~exist(figureDir, 'dir')

src/utils/setGraphicWindow.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
% (C) Copyright 2019 CPP BIDS SPM-pipeline developpers
22

33
function [interactiveWindow, graphWindow, cmdLine] = setGraphicWindow()
4-
[interactiveWindow, graphWindow, cmdLine] = spm('FnUIsetup');
4+
5+
interactiveWindow = [];
6+
graphWindow = [];
7+
cmdLine = true;
8+
9+
if ~spm('CmdLine') && ~isOctave
10+
11+
try
12+
[interactiveWindow, graphWindow, cmdLine] = spm('FnUIsetup');
13+
catch
14+
warning('Could not open a graphic window. No figure will be created.');
15+
end
16+
17+
end
18+
519
end

0 commit comments

Comments
 (0)