Giter VIP home page Giter VIP logo

spm's Introduction

SPM BIDS App

Description

BIDS App containing an instance of the SPM12 software.

Documentation

Extensive documentation can be found in the SPM manual.

Usage

To launch an instance of the container and analyse some data in BIDS format, type:

$ docker run bids/spm bids_dir output_dir level [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--config CFG_FILE]

For example, to run an analysis in participant level mode, type:

$ docker run -ti --rm \
  -v /tmp:/tmp \
  -v /var/tmp:/var/tmp \
  -v /path/to/local/bids/input/dataset/:/data \
  -v /path/to/local/output/:/output \
  bids/spm \
  /data /output participant --participant_label 01

For example, to run an analysis in group level mode with a user-defined pipeline, type:

$ docker run -ti --rm \
  -v /tmp:/tmp \
  -v /var/tmp:/var/tmp \
  -v /path/to/local/bids/input/dataset/:/data \
  -v /path/to/local/output/:/output \
  -v /path/to/local/cfg/:/cfg \
  bids/spm \
  /data /output group --config /cfg/my_pipeline_group.m

To build the container, type:

$ docker build -t <yourhandle>/spm12 .

Configuration file

The configuration file is a MATLAB script detailing the analysis pipeline to be executed. Two struct variables, BIDS and BIDS_App are available from within the script, containing details from the command line and the BIDS-formatted dataset. In particular, the BIDS structure can be queried using the spm_BIDS() function (see this). The default configuration files for first and second level analyses are pipeline_participant.m and pipeline_group.m. A template for a single configuration file for all levels could be as follow:

if strcmp(BIDS_App.level,'participant')
    % First level analysis

    % Get T1-weighted image filename for given subject:
    % a = spm_BIDS(BIDS,'data', 'modality','anat', 'type','T1w');
    % ...
else
    % Second level analysis

    % The name of the directory containing first level outputs is stored in:
    % BIDS_App.outdir
    % ...
end

Error Reporting

If you have a specific problem with the SPM BIDS App, please open an issue on GitHub.

If your issue concerns SPM more generally, please use the SPM mailing list.

Acknowledgement

Please refer to:

@Book{spm,
  editor = {K.J. Friston and J. Ashburner and S.J. Kiebel and T.E. Nichols and W.D. Penny},
  title = {Statistical Parametric Mapping: The Analysis of Functional Brain Images},
  publisher = {Academic Press},
  year = {2007},
  url = {http://store.elsevier.com/product.jsp?isbn=9780123725608}
}

spm's People

Contributors

chrisgorgo avatar gllmflndn avatar jordandekraker avatar pre-commit-ci[bot] avatar remi-gau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spm's Issues

Error on fresh install with default conf files

Hello

I am new to BIDS and plan to update all my custom spm scripts to run on BIDS data.
BIDS-Apps/SPM seems to be a first step in this direction, but running on some of my data (one subject, one run, anat and func images only) I get the following error:

Execution failed: /opt/spm12/spm_BIDS_App.m
Error using cell/ismember
Input A of class double and input B of class cell must be cell arrays of character vectors, unless one is a character vector.
Error in ismember
Error in spm (line 1139)
Error in spm_standalone (line 115)

Note that SPM starts successfully (I can see the SPM logo after executing the docker run command). The error message appears after quite some time (about 5 minutes or so), so it seems to work on something, but in my output folder there seems to be only copies of the original files.

Of course my data are BIDS validated.

Thanks for you help!

Support for the hierarchical rule is missing

Execution failed: /opt/spm12/spm_BIDS_App.m
Error using fileread (line 22)
Could not open file /snapshot/data/sub-001/fmap/sub-001_dir-AP_epi.json. No such file or directory.
Error in fileread (line 22)
Error in parse_subject (line 326)
Error in spm_BIDS (line 122)
Error in spm (line 1210)
Error in spm_standalone (line 115)

The correct JSON file was in /snapshot/data/dir-AP_epi.json

More info at https://openneuro.org/datasets/ds001105/versions/00001?app=SPM&version=17&job=5a298a27fce2fd0001047fb6

spm spatial preproc error on select BIDS dataset subjects

Hi there!!

I recently installed a singularity sif container with the SPM bids app using the "latest" docker tag (singularity build /Volumes/Hera/Projects/corticalmyelin_development/software/spm-latest.sif docker://bids/spm:latest, https://hub.docker.com/layers/bids/spm/latest/images/sha256-cb77a4589bd6a3fb4cf79c76781e8a0cd92ce045ee1373679ddc431afb2a0a16?context=explore).

I have a BIDS dataset with ~160 subjects, many of which have multiple sessions of data. I'm aiming to use the SPM segmentation workflow to bias-correct 7T MP2RAGE UNI and R1 images. Both types of images are located in participant's sub-$sub/ses-$ses/anat folders, with the names sub-$sub_ses-$ses_acq-UNIDENT1_T1w.nii.gz and sub-$sub_ses-$ses_T1map.nii.gz.

I've modified the example pipeline_participant.m configuration file for my singularity run call. I am testing a range of parameters, but an example configuration is below. (To run this on the T1map, I change 'type', 'T1map').

vox_anat = [1 1 1];

anat = spm_BIDS(BIDS,'data', 'modality','anat', 'type','T1w');
if isempty(anat), error('Cannot find T1-weighted image.'); end

clear matlabbatch

% UNICORT Correction via SPM Segmentation
%------------------------------------------------------------------
matlabbatch{1}.spm.spatial.preproc.channel.vols  = cellstr(anat);
matlabbatch{1}.spm.spatial.preproc.channel.biasreg  = 0.01;
matlabbatch{1}.spm.spatial.preproc.channel.biasfwhm  = 30;
matlabbatch{1}.spm.spatial.preproc.channel.write  = [1 1];
matlabbatch{1}.spm.spatial.preproc.warp.mrf = 1;
matlabbatch{1}.spm.spatial.preproc.warp.cleanup = 1;
matlabbatch{1}.spm.spatial.preproc.warp.reg = [0 0.001 0.5 0.05 0.2];
matlabbatch{1}.spm.spatial.preproc.warp.affreg = 'mni';
matlabbatch{1}.spm.spatial.preproc.warp.fwhm = 0;
matlabbatch{1}.spm.spatial.preproc.warp.samp = 3;
matlabbatch{1}.spm.spatial.preproc.warp.write = [0 0];


[~,prov] = spm_jobman('run',matlabbatch);

When I launch this with singularity run, it runs and completes successfully on some subjects but fails on others with the error:

Execution failed: /opt/spm12/spm_BIDS_App.m
The logical indices contain a true value outside of the array bounds.
Error in spm (line 1147)
Error in spm_standalone (line 115)

There is not a difference (that I can deduce) in file organization, acquisition, session number, etc. between subjects that run successfully and those that exit with this error. I have also tried modifying the config file to just specify the channel.vols and channel.write lines (no other params), as well as including 'subjects' or 'sessions' or a specific sub-session combo in the config anat line, and running the container without specifying a config file, and the subjects it works with versus fails on does not change.

Any thoughts on how I may debug this? Thank you so much for the help!!! I extremely appreciate any input or guidance.

Best,
Valerie

single-trial GLM integration

We wrote a script to load in fmriprep outputs and then run single trial GLMs using SPM. We are wondering if it would be worthwhile to integrate our code with your BIDS App (i.e. using spm_BIDS as the data loader, and providing the single-trial GLM script as an example of a configuration file). We weren't too sure if this repo is still active, so if you're interested then let us know!

spm8 equivalent?

hey BIDS maintainers!

I'm working on an older (spm8) pipeline and wondering if there was a container (or just the binary that is installed inside) for spm8? If not, can we make one, can I make one?

Many thanks!

can't get bids spm12 started

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

running with singularity

I'm trying to run this container on a HPC cluster with no sudo and no docker available, which should still be fine as a singularity image. However, I'm getting the following issues:

Pulled the image using singularity pull docker://bids/spm, which seems to have worked successfully, I can even shell into the image. However, I get the following errors when trying to return the usage:

$ singularity run spm.simg --help
/opt/spm12/run.sh: line 4: /opt/spm12/spm12: Permission denied
/opt/spm12/run.sh: line 4: exec: /opt/spm12/spm12: cannot execute: Permission denied

These scripts appear to be user executable however, because when I shell into the container I can also see:

Singularity spm.simg:~> ls -al /opt/spm12
total 86689
drwxr-xr-x 3 root root      184 Jun  3 14:03 .
drwxr-xr-x 4 root root       51 Nov 22  2018 ..
-rw-rw-r-- 1 root root     1184 Nov 22  2018 pipeline_group.m
-rw-rw-r-- 1 root root     2838 Nov 22  2018 pipeline_participant.m
-rwxrwxr-x 1 root root      101 Nov 22  2018 run.sh
-rwxr--r-- 1 root root      873 Nov 15  2018 run_spm12.sh
-rwxr--r-- 1 root root    64416 Nov 15  2018 spm12
-rw-r--r-- 1 root root 88687062 Nov 15  2018 spm12.ctf
drwxr-xr-x 7 root root      129 Nov 22  2018 spm12_mcr
-rw-rw-r-- 1 root root    11202 Nov 22  2018 spm_BIDS_App.m

Any advice?
Thanks!

Cannot analyze BIDS dataset

Using this command

docker run -i --rm -v /Users/andek/Research_projects/BIDSSPM/test/ds003:/bids_dataset -v /Users/andek/Research_projects/BIDSSPM/test/results:/outputs bids/spm /bids_dataset /outputs participant --participant_label 01

For this BIDS dataset

https://drive.google.com/open?id=0B2JWN60ZLkgkSEtlSl8wd0xhbzQ

I got this error

SPM12: BIDS PARTICIPANT sub-01 13:08:04 - 27/02/2017

Execution failed: /opt/spm12/pipeline_participant.m
Execution failed: /opt/spm12/spm_BIDS_App.m
Reference to non-existent field 'filename'.
Error in spm (line 1202)
Error in spm (line 1202)
Error in spm_standalone (line 47)

Increasing the log verbosity

I'm trying to run SPM on a dataset I unfortunately cannot share and I am getting the following error:

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 spm_BIDS (line 56)
  BIDS dataset description could not be read.
  Error in spm_BIDS (line 56)
  Error in spm (line 1206)
  Error in spm_standalone (line 115)

Would there be a way to increase verbosity of the logs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.