Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] If I have 2 runs of a task each in a different session and I select only one session (eg second one), preproc fails at coregistration #1209

Closed
1 of 9 tasks
marcobarilari opened this issue Feb 22, 2024 · 6 comments · Fixed by #1295
Assignees
Labels
bug 🐛 Something isn't working preproc
Milestone

Comments

@marcobarilari
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Operating system

  • Linux
  • Mac
  • Windows

Operating system version

No response

SPM 12 version

  • 7771
  • 7487
  • 7219

Platform

  • MATLAB
  • Octave

Platform version

No response

bidspm version

v3.1.0

bidspm branch / commit number

No response

Expected Behavior

To work with only 1 run even though 2 are present in the bids dataset

BIDS stats model

No response

Current Behavior & Error message

The batch is built in a way that expects 2 sessions at the coregistration level

Error:

21-Feb-2024 21:00:10 - Done    'Realign & Unwarp'
Dependency source available, but is missing required output.
Index exceeds matrix dimensions.
In item Other Images:
Dependency 1: Realign: Estimate & Reslice/Unwarp: Realigned Images (Sess 1) (out.sess(1).uwrfiles)
    '/Volumes/PAUL/datalad/analysis_high-res_BLAM_biMotion_localizers/outputs/derivatives/bidspm-preproc/sub-SC08/ses-02/func/usub-SC08_ses-02_task-auditoryLocalizer_run-02_part-mag_space-individual_desc-stc_bold.nii'


Dependency 2: Realign: Estimate & Reslice/Unwarp: Realigned Images (Sess 2) (out.sess(2).uwrfiles)
       sess: [1×1 struct]
    meanuwr: {'/Volumes/PAUL/datalad/analysis_high-res_BLAM_biMotion_localizers/outputs/derivatives/bidspm-preproc/sub-SC08/ses-02/func/meanusub-SC08_ses-02_task-auditoryLocalizer_run-02_part-mag_space-individual_desc-stc_bold.nii'}

Batch

here it is expecting 2 other images (2 runs but I selected only one through the session filter)

matlabbatch{3}.spm.spatial.coreg.estimate.other(1) = cfg_dep('Realign: Estimate & Reslice/Unwarp: Realigned Images (Sess 1)', substruct('.','val', '{}',{2}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{1}, '.','uwrfiles'));
matlabbatch{3}.spm.spatial.coreg.estimate.other(2) = cfg_dep('Realign: Estimate & Reslice/Unwarp: Realigned Images (Sess 2)', substruct('.','val', '{}',{2}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{2}, '.','uwrfiles'));

Anything else?

No rush, my workaround was to delete in raw the run I don't need (which is to discard anyway).

More pointers for solutions:

  • Have a filter for run
  • Be smarter that if a user select a session, metadata from other sessions are not considered in the batch
@marcobarilari marcobarilari added the bug 🐛 Something isn't working label Feb 22, 2024
Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@Remi-Gau
Copy link
Contributor

does it also fail if you have 2 sessions but only select the first one?

@marcobarilari
Copy link
Collaborator Author

I don't know, I will give it a trial and let you know.

@marcobarilari marcobarilari self-assigned this Feb 22, 2024
@marcobarilari
Copy link
Collaborator Author

Getting back to this issue, did not try yet but it is on my to do

@Remi-Gau Remi-Gau added this to the v4.0.0 milestone Jul 7, 2024
@Remi-Gau
Copy link
Contributor

Remi-Gau commented Jul 24, 2024

I can reproduce the bug on one of the openneuro datasets

clear;
clc;

addpath(fullfile(pwd, '..', '..'));
bidspm();

participant_label = {'01'};
TASK = 'linebisection'; 

root_dir = fileparts(mfilename('fullpath'));
bids_dir = fullfile(root_dir, 'inputs', 'ds000114');
output_dir = fullfile(root_dir, 'outputs', 'ds000114', 'derivatives');
preproc = fullfile(output_dir, 'bidspm-preproc');

bidspm(bids_dir, output_dir, 'subject', ...
       'participant_label', participant_label, ...
       'action', 'copy', ...
       'task', TASK, ...
       'skip_validation', true, ...
       'verbosity', 3);

bids_filter_file = struct(...
      'bold', struct('modality', 'func', 'suffix', 'bold', 'ses', 'retest'), ...
      't1w',  struct('modality', 'anat', 'suffix', 'T1w'));
bidspm(bids_dir, output_dir, 'subject', ...
       'participant_label', participant_label, ...
       'action', 'preprocess', ...
       'task', TASK, ...
       'space', {'IXI549Space'}, ...
       'skip_validation', true, ...
       'bids_filter_file', bids_filter_file, ...
       'fwhm', 6, ...
       'verbosity', 3);

@Remi-Gau
Copy link
Contributor

It seems that if you copy only a single session in from the raw dataset things work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working preproc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants