Skip to content

Commit 235aa1c

Browse files
committed
[skip tests][skip docs][skip ds210][skip ds054] pass mask into ica-aroma and merge with upstream
1 parent 3c6303d commit 235aa1c

File tree

6 files changed

+62
-31
lines changed

6 files changed

+62
-31
lines changed

.circleci/config.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ jobs:
165165
steps:
166166
- restore_cache:
167167
keys:
168-
- regression-v0-{{ epoch }}
169-
- regression-v0-
168+
- regression-v2-{{ epoch }}
169+
- regression-v2-
170170
- run:
171171
name: Get truncated BOLD series
172172
command: |
@@ -193,7 +193,7 @@ jobs:
193193
paths:
194194
- data
195195
- save_cache:
196-
key: regression-v0-{{ epoch }}
196+
key: regression-v2-{{ epoch }}
197197
paths:
198198
- /tmp/data
199199

@@ -227,10 +227,6 @@ jobs:
227227
fi
228228
- attach_workspace:
229229
at: /tmp
230-
- restore_cache:
231-
keys:
232-
- regression-v0-{{ epoch }}
233-
- regression-v0-
234230
- run:
235231
name: Check PyPi preconditions
236232
command: |
@@ -260,7 +256,13 @@ jobs:
260256
-e FMRIPREP_REGRESSION_REPORTS=/tmp/data/reports \
261257
--entrypoint="py.test" poldracklab/fmriprep:latest \
262258
/root/src/fmriprep/ \
263-
--doctest-modules --ignore=/root/src/fmriprep/docs --ignore=setup.py
259+
-svx --doctest-modules --ignore=/root/src/fmriprep/docs --ignore=setup.py
260+
- run:
261+
name: Package new masks
262+
no_output_timeout: 10m
263+
working_directory: /tmp/data/reports
264+
command: |
265+
tar cfz fmriprep_bold_mask.tar.gz fmriprep_bold_mask/*/*.nii.gz
264266
- run:
265267
name: Test fmriprep-wrapper (Python 2)
266268
command: |
@@ -719,7 +721,9 @@ workflows:
719721
- get_data:
720722
filters:
721723
branches:
722-
ignore: /docs?\/.*/
724+
ignore:
725+
- /docs?\/.*/
726+
- /tests?\/.*/
723727
tags:
724728
only: /.*/
725729

@@ -732,6 +736,8 @@ workflows:
732736
requires:
733737
- build
734738
filters:
739+
branches:
740+
ignore: /tests?\/.*/
735741
tags:
736742
only: /.*/
737743

@@ -740,7 +746,9 @@ workflows:
740746
- build
741747
filters:
742748
branches:
743-
ignore: /docs?\/.*/
749+
ignore:
750+
- /docs?\/.*/
751+
- /tests?\/.*/
744752
tags:
745753
only: /.*/
746754

@@ -760,7 +768,9 @@ workflows:
760768
- build
761769
filters:
762770
branches:
763-
ignore: /docs?\/.*/
771+
ignore:
772+
- /docs?\/.*/
773+
- /tests?\/.*/
764774
tags:
765775
only: /.*/
766776

@@ -770,7 +780,9 @@ workflows:
770780
- build
771781
filters:
772782
branches:
773-
ignore: /docs?\/.*/
783+
ignore:
784+
- /docs?\/.*/
785+
- /tests?\/.*/
774786
tags:
775787
only: /.*/
776788

@@ -781,7 +793,9 @@ workflows:
781793
filters:
782794
branches:
783795
# only: /meepi.*/
784-
ignore: /docs?\/.*/
796+
ignore:
797+
- /docs?\/.*/
798+
- /tests?\/.*/
785799
tags:
786800
only: /.*/
787801

fmriprep/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
'pybids==0.6.5',
9999
'nitime',
100100
'nipype>=1.1.3',
101-
'niworkflows>=0.4.3',
101+
'niworkflows>=0.4.4',
102102
'statsmodels',
103103
'seaborn',
104104
'indexed_gzip>=0.8.2',

fmriprep/interfaces/cifti.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,9 @@ def _fetch_data(self):
130130
raise IOError("Freesurfer annotations for %s not found in %s" % (
131131
self.inputs.surface_target, self.inputs.subjects_dir))
132132

133-
label_space = 'tpl-OASISTRT20'
134-
label_dir = getters.get_oasis_dkt31_mni152()
135-
label_file = os.path.join(label_dir,
136-
'tpl-OASISTRT20_variant-DKT31_space-MNI152NLin2009cAsym.nii.gz')
133+
label_space = 'OASISTRT20'
134+
label_file = str(getters.get_template(label_space) /
135+
'tpl-OASISTRT20_variant-DKT31_space-MNI152NLin2009cAsym.nii.gz')
137136

138137
download_link = getters.OSF_PROJECT_URL + getters.OSF_RESOURCES[label_space][0]
139138
return annotation_files, label_file, download_link

fmriprep/workflows/bold/confounds.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,8 @@ def _getbtthresh(medianval):
581581
# connect nodes to ICA-AROMA
582582
(smooth, ica_aroma, [('smoothed_file', 'in_file')]),
583583
(bold_mni_trans_wf, ica_aroma, [
584-
('outputnode.bold_mask_mni', 'report_mask')]),
584+
('outputnode.bold_mask_mni', 'report_mask'),
585+
('outputnode.bold_mask_mni', 'mask')]),
585586
(melodic, ica_aroma, [('out_dir', 'melodic_dir')]),
586587
# generate tsvs from ICA-AROMA
587588
(ica_aroma, ica_aroma_confound_extraction, [('out_dir', 'in_directory')]),

fmriprep/workflows/bold/tests/test_util.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
''' Testing module for fmriprep.workflows.bold.util '''
22
import pytest
33
import os
4+
from pathlib import Path
45

56
import numpy as np
67
from nipype.pipeline import engine as pe
7-
from nipype.utils.filemanip import fname_presuffix
8+
from nipype.utils.filemanip import fname_presuffix, copyfile
89
from nilearn.image import load_img
910

1011
from niworkflows.interfaces.masks import ROIsPlot
@@ -46,33 +47,49 @@ def symmetric_overlap(img1, img2):
4647
'ds000216/sub-03_task-rest_echo-4_bold.nii.gz',
4748
'ds000237/sub-03_task-MemorySpan_acq-multiband_run-01_bold.nii.gz',
4849
'ds000237/sub-06_task-MemorySpan_acq-multiband_run-01_bold.nii.gz',
49-
)
50-
])
50+
'ds001240/sub-26_task-localizerimagination_bold.nii.gz',
51+
'ds001240/sub-26_task-localizerviewing_bold.nii.gz',
52+
'ds001240/sub-26_task-molencoding_run-01_bold.nii.gz',
53+
'ds001240/sub-26_task-molencoding_run-02_bold.nii.gz',
54+
'ds001240/sub-26_task-molretrieval_run-01_bold.nii.gz',
55+
'ds001240/sub-26_task-molretrieval_run-02_bold.nii.gz',
56+
'ds001240/sub-26_task-rest_bold.nii.gz',
57+
'ds001362/sub-01_task-taskname_run-01_bold.nii.gz',
58+
)
59+
])
5160
def test_masking(input_fname, expected_fname):
5261
bold_reference_wf = init_bold_reference_wf(omp_nthreads=1, enhance_t2=True)
5362
bold_reference_wf.inputs.inputnode.bold_file = input_fname
5463

5564
# Reconstruct base_fname from above
5665
dirname, basename = os.path.split(input_fname)
57-
newpath = os.path.join(os.getenv('FMRIPREP_REGRESSION_REPORTS', '.'),
58-
os.path.basename(dirname))
66+
dsname = os.path.basename(dirname)
67+
reports_dir = Path(os.getenv('FMRIPREP_REGRESSION_REPORTS', ''))
68+
newpath = reports_dir / dsname
5969
out_fname = fname_presuffix(basename, suffix='_masks.svg', use_ext=False,
60-
newpath=newpath)
61-
os.makedirs(newpath, exist_ok=True)
70+
newpath=str(newpath))
71+
newpath.mkdir(parents=True, exist_ok=True)
6272

6373
mask_diff_plot = pe.Node(ROIsPlot(), name='mask_diff_plot')
6474
mask_diff_plot.inputs.in_mask = expected_fname
6575
mask_diff_plot.inputs.out_report = out_fname
6676

77+
outputnode = bold_reference_wf.get_node('outputnode')
6778
bold_reference_wf.connect([
68-
(bold_reference_wf.get_node('outputnode'), mask_diff_plot, [
69-
('ref_image', 'in_file'),
70-
('bold_mask', 'in_rois'),
71-
])])
79+
(outputnode, mask_diff_plot, [('ref_image', 'in_file'),
80+
('bold_mask', 'in_rois')])
81+
])
7282
res = bold_reference_wf.run(plugin='MultiProc')
7383

7484
combine_masks = [node for node in res.nodes if node.name.endswith('combine_masks')][0]
7585
overlap = symmetric_overlap(expected_fname,
7686
combine_masks.result.outputs.out_file)
7787

88+
mask_dir = reports_dir / 'fmriprep_bold_mask' / dsname
89+
mask_dir.mkdir(parents=True, exist_ok=True)
90+
copyfile(combine_masks.result.outputs.out_file,
91+
fname_presuffix(basename, suffix='_mask',
92+
use_ext=True, newpath=str(mask_dir)),
93+
copy=True)
94+
7895
assert overlap > 0.95, input_fname

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
niworkflows>=0.4.3
1+
niworkflows>=0.4.4
22
grabbit==0.2.3
33
pybids==0.6.5
44
versioneer

0 commit comments

Comments
 (0)