Describe the bug
MIA tries to run pipelines even if Matlab and SPM are not configured in the preferences. However, when doing so, MIA crashes.
An unconfigured SPM in the preferences can occur, when unchecking the "Use Matlab" checkbox after enabling SPM. In this case, the "Use SPM" checkbox is disabled, and not re-enabled automatically if Matlab is enabled again.
Generated error
________________________________________________________________________________
[Process] Calling nipype.interfaces.spm.preprocess.Smooth...
nipype.interfaces.spm.preprocess.Smooth(output_directory=/home/nietob/Data/mia/projects/test/scripts, synchronize=0, fwhm=[3.0, 3.0, 3.0], in_files=['/home/nietob/Data/mia/projects/test/data/raw_data/MAP-VS-704-599566309-2019-04-05_09-39-09-00-3D_pCASL_singleshot-3D_pCASL_singleshot-.nii'], matlab_cmd=/usr/local/MATLAB/R2019a/bin/matlab, mfile=True, out_prefix=s, use_mcr=False, use_v8struct=True)
Exception hooking in progress ...
Clean up before closing mia done ...
Traceback (most recent call last):
File "/home/nietob/Code/Populse_mia/populse_mia/python/populse_mia/user_interface/pipeline_manager/pipeline_manager_tab.py", line 1465, in run
study_config.run(pipeline, verbose=1)
File "/home/nietob/.local/lib/python3.6/site-packages/capsul/study_config/study_config.py", line 414, in run
verbose)
File "/home/nietob/.local/lib/python3.6/site-packages/capsul/study_config/study_config.py", line 471, in _run
**kwargs)
File "/home/nietob/.local/lib/python3.6/site-packages/capsul/study_config/run.py", line 102, in run_process
returncode = process_instance._run_process()
File "/home/nietob/.local/lib/python3.6/site-packages/capsul/process/process.py", line 1240, in _run_process
results = self._nipype_interface.run()
File "/home/nietob/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 375, in run
runtime = self._run_interface(runtime)
File "/home/nietob/.local/lib/python3.6/site-packages/nipype/interfaces/spm/base.py", line 376, in _run_interface
results = self.mlab.run()
File "/home/nietob/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 375, in run
runtime = self._run_interface(runtime)
File "/home/nietob/.local/lib/python3.6/site-packages/nipype/interfaces/matlab.py", line 170, in _run_interface
self.raise_exception(runtime)
File "/home/nietob/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 695, in raise_exception
).format(**runtime.dictcopy()))
RuntimeError: Command:
/usr/local/MATLAB/R2019a/bin/matlab -nodesktop -nosplash -singleCompThread -r "addpath('/home/nietob/Data/mia/projects/test/scripts');pyscript_smooth;exit"
Standard output:
< M A T L A B (R) >
Copyright 1984-2019 The MathWorks, Inc.
R2019a Update 2 (9.6.0.1114505) 64-bit (glnxa64)
May 1, 2019
To get started, type doc.
For product information, visit www.mathworks.com.
The Window Command log is currently saved in ~/Documents/MATLAB/diaryWindowCommand file. Purge sometimes the diaryWindowCommand file in MATLAB directory.
- diary off: suspends the diary.
- diary on: resumes diary mode.
By default at start up a debugging option is launched producing a breakpoint and pause execution if a run-time error occurs.
- For stop this option: dbclear all.
- For start this option: dbstop if error.
- For known the current option: dbstatus.
Executing pyscript_smooth at 18-Jun-2019 12:15:32:
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.6.0.1114505 (R2019a) Update 2
MATLAB License Number: 100877
Operating System: Linux 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64
Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.6 (R2019a)
Deep Learning Toolbox Version 12.1 (R2019a)
Image Processing Toolbox Version 10.4 (R2019a)
MATLAB Compiler Version 7.0.1 (R2019a)
MATLAB Compiler SDK Version 6.6.1 (R2019a)
Optimization Toolbox Version 8.3 (R2019a)
Parallel Computing Toolbox Version 7.0 (R2019a)
Signal Processing Toolbox Version 8.2 (R2019a)
Statistical Parametric Mapping Version 7487 (SPM12)
Statistics and Machine Learning Toolbox Version 11.5 (R2019a)
Standard error:
MATLAB code threw an exception:
Cannot CD to /home/nietob/Data/mia/projects/test/scripts/<undefined> (Name is nonexistent or not a directory).
File:/home/nietob/Data/mia/projects/test/scripts/pyscript_smooth.m
Name:pyscript_smooth
Line:4
Return code: 0
QObject::~QObject: Timers cannot be stopped from another thread
Segmentation fault (core dumped)
Notice that the option "paths=['/home/nietob/spm12']" is missing from the call to nipype.interfaces.spm.preprocess.Smooth.
To Reproduce
Steps to reproduce the behavior:
- Open a project
- In Preferences > Pipeline uncheck "Use Matlab" and check it again. The "Use SPM" checkbox got disabled in the process.
- Click on "OK".
- Configure a simple pipeline with an SPM module like smooth. Initialize and run it.
- MIA crashes.
Expected behavior
MIA should open an error dialog, informing the user that SPM and/or Matlab needs to be enabled in the preferences.
In the preferences dialog, maybe SPM should not be automatically disabled when disabling Matlab (or it should be automatically re-enabled when it was automatically disabled before).
Desktop (please complete the following information):
- OS: Linux - Ubuntu 18.04, Plasma desktop
- Populse_MIA version 1.2.1
To discuss