Skip to content

Commit baa02d1

Browse files
authored
[FIX] ensure that setBatchCoregistrationFuncToAnat takes into account bids_filter (#1295)
* make sure setBatchCoregistration takes bids filter into account * minor side fixes * update changelog
1 parent c13138f commit baa02d1

File tree

8 files changed

+88
-7
lines changed

8 files changed

+88
-7
lines changed

.circleci/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ jobs:
158158
--space IXI549Space \
159159
--verbosity 3
160160
161-
cat /home/circleci/outputs
162-
163161
- store_artifacts:
164162
path: /home/circleci/outputs
165163

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5858

5959
### Fixed
6060

61+
* [FIX] ensure that {func}`setBatchCoregistrationFuncToAnat` takes into account bids_filter #1295 by @d-ni374
6162
* [FIX] update {func}`createDefaultStatsModel` to use proper `GroupBy` at the dataset level #1248 by @d-ni374
6263
* [FIX] make {func}`getAcquisitionTime` less brittle #1248 by @d-ni374
6364
* [FIX] fix regular expression in {func}`bidsResults` to identify contrasts #1248 by @d-ni374 and #1275 by @Remi-Gau

WIP/write_model_graph.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
from bids.modeling.statsmodels import BIDSStatsModelsGraph
44

5+
root_dir = Path("/home/remi/github/cpp-lln-lab/bidspm")
6+
57
graph = BIDSStatsModelsGraph(
6-
layout=Path("/home/remi/github/cpp-lln-lab/bidspm/demos/MoAE/inputs/raw"),
7-
model="/home/remi/github/cpp-lln-lab/bidspm/demos/openneuro/models/model-narps_desc-U26C_smdl.json",
8+
layout=root_dir / "demos/MoAE/inputs/raw",
9+
model=root_dir / "demos/openneuro/models/model-narps_desc-U26C_smdl.json",
810
)
911

1012

demos/openneuro/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ data_ds000001:
2525
cd inputs/ds000001-fmriprep && datalad get sub-0[1-5]/func/*MNI*desc-preproc*.nii.gz -J 12
2626
cd inputs/ds000001-fmriprep && datalad get sub-0[1-3]/func/*MNI*desc-*bold.nii.gz -J 12
2727

28+
data_ds000114_raw:
29+
mkdir -p inputs
30+
cd inputs && datalad install ///openneuro/ds000114
31+
cd inputs/ds000114 && datalad get sub-0[1-2]/ses-*/anat/*T1w*.nii.gz -J 12
32+
cd inputs/ds000114 && datalad get sub-0[1-2]/ses-*/func/*linebisection* -J 12
33+
2834
data_ds000114:
2935
mkdir -p inputs
3036
cd inputs && datalad install ///openneuro/ds000114
@@ -45,11 +51,11 @@ data_ds000224:
4551
cd inputs/ds000224-fmriprep && datalad get sub-MSC0[1-2]/ses-*/func/*glasslexical*MNI*_mask.nii.gz -J 12
4652
cd inputs/ds000224-fmriprep && datalad get sub-MSC0[1-2]/ses-*/func/*glasslexical*MNI*desc-preproc*bold.nii.gz -J 12
4753

48-
4954
data_ds001168:
5055
mkdir -p inputs
5156
cd inputs && datalad install ///openneuro/ds001168
52-
cd inputs/ds001168 && datalad get ds001168/sub-0[12] -J 2
57+
cd inputs/ds001168 && datalad get sub-0[12]/ses*/anat/*T1w* -J 2
58+
cd inputs/ds001168 && datalad get sub-0[12]/ses*/func/*fullbrain*bold* -J 2
5359

5460
data_ds001734:
5561
mkdir -p inputs
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
% (C) Copyright 2023 bidspm developers
2+
3+
clear;
4+
clc;
5+
6+
addpath(fullfile(pwd, '..', '..'));
7+
bidspm();
8+
9+
participant_label = {'01'};
10+
TASK = 'linebisection';
11+
12+
root_dir = fileparts(mfilename('fullpath'));
13+
bids_dir = fullfile(root_dir, 'inputs', 'ds000114');
14+
output_dir = fullfile(root_dir, 'outputs', 'ds000114', 'derivatives');
15+
preproc = fullfile(output_dir, 'bidspm-preproc');
16+
17+
bidspm(bids_dir, output_dir, 'subject', ...
18+
'participant_label', participant_label, ...
19+
'action', 'copy', ...
20+
'task', TASK, ...
21+
'skip_validation', true, ...
22+
'verbosity', 3);
23+
24+
bids_filter_file = struct( ...
25+
'bold', struct('modality', 'func', 'suffix', 'bold', 'ses', 'retest'), ...
26+
't1w', struct('modality', 'anat', 'suffix', 'T1w'));
27+
bidspm(bids_dir, output_dir, 'subject', ...
28+
'participant_label', participant_label, ...
29+
'action', 'preprocess', ...
30+
'task', TASK, ...
31+
'space', {'IXI549Space'}, ...
32+
'skip_validation', true, ...
33+
'ignore', {'slicetiming', 'unwarp'}, ...
34+
'bids_filter_file', bids_filter_file, ...
35+
'fwhm', 6, ...
36+
'verbosity', 3);

demos/openneuro/ds001168_run.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
'action', 'preprocess', ...
3939
'task', 'rest', ...
4040
'space', {'IXI549Space'}, ...
41-
'ignore', {'slicetiming'}, ...
41+
'skip_validation', true, ...
42+
'ignore', {'slicetiming', 'fieldmaps'}, ...
4243
'options', opt);
4344

4445
%% denoise with GLM
@@ -50,5 +51,6 @@
5051
'action', 'stats', ...
5152
'participant_label', {'01'}, ...
5253
'preproc_dir', preproc_dir, ...
54+
'skip_validation', true, ...
5355
'model_file', model_file, ...
5456
'keep_residuls', true);

src/batches/preproc/setBatchCoregistrationFuncToAnat.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656

5757
% OTHER IMAGES : DEPENDENCY FROM REALIGNEMENT
5858

59+
opt.query = opt.bidsFilterFile.bold;
60+
5961
[sessions, nbSessions] = getInfo(BIDS, subLabel, opt, 'Sessions');
6062

6163
runCounter = 1;

tests/tests_batches/preproc/test_setBatchCoregistrationFuncToAnat.m

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,40 @@ function test_setBatchCoregistrationFuncToAnat_basic()
5656

5757
end
5858

59+
function test_setBatchCoregistrationFuncToAnat_one_session()
60+
61+
subLabel = '01';
62+
63+
opt = setOptions('vismotion', subLabel);
64+
65+
opt.bidsFilterFile.bold.ses = '02';
66+
67+
BIDS = getLayout(opt);
68+
69+
opt.orderBatches.selectAnat = 1;
70+
opt.orderBatches.realign = 2;
71+
72+
matlabbatch = {};
73+
matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, opt, subLabel);
74+
75+
nbRuns = 2;
76+
77+
meanImageToUse = 'meanuwr';
78+
otherImageToUse = 'uwrfiles';
79+
80+
expectedBatch = returnExpectedBatch(nbRuns, meanImageToUse, otherImageToUse);
81+
assertEqual( ...
82+
matlabbatch{1}.spm.spatial.coreg.estimate.ref, ...
83+
expectedBatch{1}.spm.spatial.coreg.estimate.ref);
84+
assertEqual( ...
85+
matlabbatch{1}.spm.spatial.coreg.estimate.source, ...
86+
expectedBatch{1}.spm.spatial.coreg.estimate.source);
87+
assertEqual( ...
88+
matlabbatch{1}.spm.spatial.coreg.estimate.other, ...
89+
expectedBatch{1}.spm.spatial.coreg.estimate.other);
90+
91+
end
92+
5993
function test_setBatchCoregistrationFuncToAnat_no_unwarp()
6094

6195
subLabel = '01';

0 commit comments

Comments
 (0)