bids-apps / SPM

BIDS App containing an instance of the SPM software.
https://hub.docker.com/r/bids/spm/tags
Apache License 2.0
14 stars 12 forks source link

can't get bids spm12 started #7

Closed mike21499 closed 7 years ago

mike21499 commented 7 years ago

Hi there

Im using the command: docker run -i --rm -v J:/dataset:/bids_dataset:ro -v J:/outputs/SPM:/outputs spm12 /bids_dataset /outputs participant --participant_label 01

..and tried different things (BIDS dataset works e.g. for fmriprep. But I get the following error mesage for SPM, see attached. thanks for your help! spm_error

gllmflndn commented 7 years ago

Hi Mike,

If your dataset is BIDS valid then this is a bug in spm_BIDS.m. We made a number of changes in this function since the version used in this App - would you be able to put somewhere the data from subject 01 so that I can check everything works before compiling and pushing a new version, or I can send you a new spm_BIDS.m to test if you have access to MATLAB.

mike21499 commented 7 years ago

Dear Guillaume

Thanks. Ok, please send me the new spm_BIDS.m to test! cheers, mike

gllmflndn commented 7 years ago

Here it is: https://gist.github.com/gllmflndn/af0f2f5d4ed1bc695ed24d25ef5b075f

mike21499 commented 7 years ago

ok. But: is it spm_BIDS.m or spm_BIDS_App.m as these are two different files ? thanks

gllmflndn commented 7 years ago

That's spm_BIDS.m. From MATLAB, try

  spm_BIDS('J:/dataset')
mike21499 commented 7 years ago

okay, yes. This m-file is correctly loading the datafile

gllmflndn commented 7 years ago

I just tagged a new version of the SPM12 BIDS App that uses the latest spm_BIDS.m: https://github.com/BIDS-Apps/SPM/releases/tag/v0.0.7 It should trigger the build of a new container on Docker Hub. Let me know if it fixes the issue for you. Then have a look at issue https://github.com/BIDS-Apps/SPM/issues/6 to see how to specify your own pipeline using the --config option.

wem3 commented 7 years ago

Hi! I just pulled the latest bids/spm container and called

docker run -i --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v /Users/wem3/bids/ds005:/bids_dataset -v /Users/wem3/bids/ds005_out:/outputs bids/spm /bids_dataset /outputs participant --participant_label 01

where /Users/wem3/bids/ds005 is a validated (see image) BIDS dataset, ds005

and received the following error:

docker run -i --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v /Users/wem3/bids/ds005:/bids_dataset -v /Users/wem3/bids/ds005_out:/outputs bids/spm /bids_dataset /outputs participant --participant_label 01
SPM12, version 7048 (standalone)
MATLAB, version 9.2.0.538062 (R2017a)
 ___  ____  __  __                                            
/ __)(  _ \(  \/  )                                           
\__ \ )___/ )    (   Statistical Parametric Mapping           
(___/(__)  (_/\/\_)  SPM12 - http://www.fil.ion.ucl.ac.uk/spm/

Execution failed: /opt/spm12/spm_BIDS_App.m
Error using system
Unexpected system error: bang: poll [4] Interrupted system call
Error in spm (line 1206)
Error in spm_standalone (line 115)

(I receive an identical error if I try to run the docker container w/o the --read-only flag or bind-mounting /tmp & /var/tmp, or if I build the docker container locally as directed in README.md.)

Perhaps that there is no slice timing information in ds005, as indicated by the validation check, is problematic, but it appears to me that the default pipeline_participant.m doesn't include slice timing by default, right?

image

edit: corrected error message w/ output instead of foolishly posting the input twice

wem3 commented 7 years ago

(I can also load the dataset via direct call to spm_BIDS.m in MATLAB)

gllmflndn commented 7 years ago

Hi, thanks for the report - I think it should be in a new issue but let's continue here for now.

Is it that it used to work with a previous version of the App or you just tried with the latest? The error message is a bit cryptic but there is a single system call in spm_BIDS_App.m: https://github.com/BIDS-Apps/SPM/blob/master/spm_BIDS_App.m#L158 where it calls the command line bids-validator.

I would try to run the docker container interactively (-ti --entrypoint=/bin/bash) and call bids-validator manually on your BIDS dataset and see if it reproduces the error message.

It could also maybe happen when bids-validator is called from within MATLAB (and the latest version of the App use a different, more recent, version of MATLAB) so you could build a new container after commenting out the lines 158-165 in spm_BIDS_App.m that calls the BIDS validator.

wem3 commented 7 years ago

Apologies if I put this in the wrong place.

I have only tried to run the latest version of the BIDS app, so it's not a situation where "it used to work but now it doesn't."

If I manually call bids-validator after launching the container in interactive mode, I get:

1: You should define 'SliceTiming' for this file. If you don't provide this information slice time correction will not be possible. (code: 13 - SLICE_TIMING_NOT_DEFINED)
        /sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.nii.gz
        /sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.nii.gz
        /sub-01/func/sub-01_task-mixedgamblestask_run-03_bold.nii.gz
        /sub-02/func/sub-02_task-mixedgamblestask_run-01_bold.nii.gz
        /sub-02/func/sub-02_task-mixedgamblestask_run-02_bold.nii.gz
        /sub-02/func/sub-02_task-mixedgamblestask_run-03_bold.nii.gz
        /sub-03/func/sub-03_task-mixedgamblestask_run-01_bold.nii.gz
        /sub-03/func/sub-03_task-mixedgamblestask_run-02_bold.nii.gz
        /sub-03/func/sub-03_task-mixedgamblestask_run-03_bold.nii.gz
        /sub-04/func/sub-04_task-mixedgamblestask_run-01_bold.nii.gz
        ... and 38 more files having this issue (Use --verbose to see them all).

I also tried this with ds003, and receive essentially the same error message.

Is slice-timing info required for bids/spm? My understanding from the pipeline_participant.m example file was that implementing slice-timing correction would require additional code (it's not invoked automatically by spm_preproc, right?).

I'll try building a Docker container with the system call commented out of spm_BIDS_App.m forthwith.

Thanks much!

chrisgorgo commented 7 years ago

This is just a warning not an error (there should be a "Warning" header above it). SliceTiming is recommended, but not mandatory in BIDS.

The failure of the app might be unrelated to the SliceTiming warning.

On Thu, Apr 6, 2017 at 9:29 AM, Will Moore notifications@github.com wrote:

Apologies if I put this in the wrong place.

I have only tried to run the latest version of the BIDS app, so it's not a situation where "it used to work but now it doesn't."

If I manually call bids-validator after launching the container in interactive mode, I get:

1: You should define 'SliceTiming' for this file. If you don't provide this information slice time correction will not be possible. (code: 13 - SLICE_TIMING_NOT_DEFINED) /sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.nii.gz /sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.nii.gz /sub-01/func/sub-01_task-mixedgamblestask_run-03_bold.nii.gz /sub-02/func/sub-02_task-mixedgamblestask_run-01_bold.nii.gz /sub-02/func/sub-02_task-mixedgamblestask_run-02_bold.nii.gz /sub-02/func/sub-02_task-mixedgamblestask_run-03_bold.nii.gz /sub-03/func/sub-03_task-mixedgamblestask_run-01_bold.nii.gz /sub-03/func/sub-03_task-mixedgamblestask_run-02_bold.nii.gz /sub-03/func/sub-03_task-mixedgamblestask_run-03_bold.nii.gz /sub-04/func/sub-04_task-mixedgamblestask_run-01_bold.nii.gz ... and 38 more files having this issue (Use --verbose to see them all).

I also tried this with ds003, and receive essentially the same error message.

Is slice-timing info required for bids/spm? My understanding from the pipeline_participant.m example file was that implementing slice-timing correction would require additional code (it's not invoked automatically by spm_preproc, right?).

I'll try building a Docker container with the system call commented out of spm_BIDS_App.m forthwith.

Thanks much!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BIDS-Apps/SPM/issues/7#issuecomment-292229976, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkp38e-IrBBUq40IG2aVnsGmHAMcMRks5rtRMGgaJpZM4MlIXe .

wem3 commented 7 years ago

Ah, thanks. I should know better than to conflate warnings and errors, but I still do.

Building the docker container with lines 158 - 165 of spm_BIDS_App.m and running it a la

docker run -i --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v /Users/wem3/bids/ds005:/bids_dataset -v /Users/wem3/bids/ds005_out:/outputs wem3/spm12 /bids_dataset /outputs

results in the same error I get with the original docker container:

SPM12, version 7048 (standalone)
MATLAB, version 9.2.0.538062 (R2017a)
 ___  ____  __  __                                            
/ __)(  _ \(  \/  )                                           
\__ \ )___/ )    (   Statistical Parametric Mapping           
(___/(__)  (_/\/\_)  SPM12 - http://www.fil.ion.ucl.ac.uk/spm/

Execution failed: /opt/spm12/spm_BIDS_App.m
Error using copyfile
Unexpected system error: bang: poll [4] Interrupted system call
Error in spm (line 1206)
Error in spm_standalone (line 115)

Is there another system call in spm_standalone ?

gllmflndn commented 7 years ago

Thanks for the feedback. There is a difference though: this seems to still be a system error but this time with "copyfile". Could you try again with bids/spm:v0.0.6 instead of bids/spm:v0.0.7 (ie current bids/spm:latest) in case this is something specific about MCR R2017a - I doubt it as the tests on CircleCI passed though... Also, which version of Docker are you using?

wem3 commented 7 years ago

bids/spm:v0.0.6 works like a charm.

I'm using docker version 17.03.1-ce on macOS 10.12.3 (not sure if this is enough info, but I went for parsimony this time, and am happy to append any additional version/system details that are helpful).

gllmflndn commented 7 years ago

Thanks, that's good news even if I still don't understand what is going on.

The only changes between v0.0.6 and v0.0.7 are the MCR version (from R2016b to R2017a) and the SPM version (from r6906 to r7048). I would guess the current issue has to do with the former but it still odd that the tests of CircleCI pass while it doesn't work for you: is the error always happening at the same time, whatever the dataset is?

I thought at first it would be an issue of making system calls from MATLAB with dynamically linked executables (as there could be interactions with the libraries shipped with MATLAB, see !echo $LD_LIBRARY_PATH) but it wouldn't explain an error with copyfile.

I'm going to push a change to use R2016b again and we will see how it goes.

wem3 commented 7 years ago

I get the same error at the same time with ds005 and ds003, but have not tested on other datasets.

I installed MATLAB R2017a (in addition to R2016b) before I started any docker builds/pulls, but I did not change /Applications/MATLAB_R2016b.app/bin to /Applications/MATLAB_R2017a.app/bin in my $PATH variable. Manually changing $PATH to the latter doesn't change the error.

I'm not sure how/when MATLAB is appending this change to my $PATH, as there's no instruction to do so in my .bashrc or .bash_profile, but I don't think it should matter which local MATLAB bash cares about, since bids/spm is pointing to the MCR within the docker container anyway.

If that's off the mark, please let me know what sort of changes to bash environment variables might be worth testing, and I'll happily do so. Thanks so much for all your help and hard work!

gllmflndn commented 7 years ago

Thanks. I was a bit unclear in my previous message: it shouldn't matter which MATLAB versions you installed on your host machine; what I meant is that $LD_LIBRARY_PATH is modified by MATLAB at runtime to point to its own versions of some libraries, so if you do a system call from MATLAB to a dynamically built executable, it might not run in the same way than if you call it directly outside MATLAB if libraries differ. But let's forget this for now; it's hopefully not the issue here.

Docker should make things reproducible so can we all try to run the same thing (using ds000003) and see what happens (I hope @chrisfilo is monitoring this):

docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/openfmri/ds000003_R2.0.2:/bids_dataset -v ${HOME}/data/openfmri/outputs:/outputs bids/spm /bids_dataset /outputs participant --participant_label 01

It runs as expected for me, with the first two output lines being:

SPM12, version 7048 (standalone)
MATLAB, version 9.2.0.538062 (R2017a)
wem3 commented 7 years ago
docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/openfmri/ds000003_R2.0.2:/bids_dataset -v ${HOME}/data/openfmri/outputs:/outputs bids/spm /bids_dataset /outputs participant --participant_label 01

works for me on ds000003

gllmflndn commented 7 years ago

OK, that's reassuring, thanks. Can you point out to a public dataset and a command line that will generate this system error?

wem3 commented 7 years ago

Whoops! The system error I kept getting was very much an end-user issue.

I was calling docker run -i ... (as in the first post in this issue), which throws the aforementioned system error regardless of which openfmri dataset is used.

However, docker run -ti ... runs without any problems on every openfmri dataset I've tried.

Please accept my sincere apologies for impinging on your time with my own false flag operation, and know that I much appreciate all of your help and hard work!

If there's something I can do to help with this project (e.g., testing new versions, working on documentation, or anything else that might be useful), please let me know and I'll be on it!

gllmflndn commented 7 years ago

Forgot to thank you for the feedback and close the report. I'm glad we figured out what the issue was - it was spooky!