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

spm spatial preproc error on select BIDS dataset subjects #27

Open valeriejill opened 10 months ago

valeriejill commented 10 months ago

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