Skip to content

Commit 26e0f44

Browse files
authored
Merge pull request #1299 from poldracklab/fix/enhance_t2
[FIX] Enhance T2 contrast ``enhance_t2`` in reference estimate
2 parents f5acef1 + d8fbf00 commit 26e0f44

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.circleci/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,12 @@ jobs:
252252
name: Run fMRIPrep tests
253253
no_output_timeout: 2h
254254
command: |
255+
mkdir /tmp/data/reports && \
255256
docker run -ti --rm=false \
256257
-v /tmp/data:/tmp/data \
257258
-e FMRIPREP_REGRESSION_SOURCE=/tmp/data/fmriprep_bold_truncated \
258259
-e FMRIPREP_REGRESSION_TARGETS=/tmp/data/fmriprep_bold_mask \
260+
-e FMRIPREP_REGRESSION_REPORTS=/tmp/data/reports \
259261
--entrypoint="py.test" poldracklab/fmriprep:latest \
260262
/root/src/fmriprep/ \
261263
--doctest-modules --ignore=/root/src/fmriprep/docs --ignore=setup.py
@@ -284,7 +286,7 @@ jobs:
284286
fmriprep-docker -i poldracklab/fmriprep:latest --help
285287
fmriprep-docker -i poldracklab/fmriprep:latest --version
286288
- store_artifacts:
287-
path: /home/circleci/out/tests
289+
path: /tmp/data/reports
288290

289291

290292
build_docs:

fmriprep/workflows/bold/tests/test_util.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
import os
44

55
import numpy as np
6+
from nipype.pipeline import engine as pe
67
from nipype.utils.filemanip import fname_presuffix
78
from nilearn.image import load_img
9+
10+
from niworkflows.interfaces.masks import ROIsPlot
11+
812
from ..util import init_bold_reference_wf
913

1014

@@ -47,6 +51,24 @@ def symmetric_overlap(img1, img2):
4751
def test_masking(input_fname, expected_fname):
4852
bold_reference_wf = init_bold_reference_wf(omp_nthreads=1, enhance_t2=True)
4953
bold_reference_wf.inputs.inputnode.bold_file = input_fname
54+
55+
# Reconstruct base_fname from above
56+
dirname, basename = os.path.split(input_fname)
57+
newpath = os.path.join(os.getenv('FMRIPREP_REGRESSION_REPORTS', '.'),
58+
os.path.basename(dirname))
59+
out_fname = fname_presuffix(basename, suffix='_masks.svg', use_ext=False,
60+
newpath=newpath)
61+
os.makedirs(newpath, exist_ok=True)
62+
63+
mask_diff_plot = pe.Node(ROIsPlot(), name='mask_diff_plot')
64+
mask_diff_plot.inputs.in_mask = expected_fname
65+
mask_diff_plot.inputs.out_report = out_fname
66+
67+
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+
])])
5072
res = bold_reference_wf.run(plugin='MultiProc')
5173

5274
combine_masks = [node for node in res.nodes if node.name.endswith('combine_masks')][0]

fmriprep/workflows/bold/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def init_bold_reference_wf(omp_nthreads, bold_file=None, name='bold_reference_wf
105105
mem_gb=1) # OE: 128x128x128x50 * 64 / 8 ~ 900MB.
106106
# Re-run validation; no effect if no sbref; otherwise apply same validation to sbref as bold
107107
validate_ref = pe.Node(ValidateImage(), name='validate_ref', mem_gb=DEFAULT_MEMORY_MIN_GB)
108-
enhance_and_skullstrip_bold_wf = init_enhance_and_skullstrip_bold_wf(omp_nthreads=omp_nthreads)
108+
enhance_and_skullstrip_bold_wf = init_enhance_and_skullstrip_bold_wf(omp_nthreads=omp_nthreads,
109+
enhance_t2=enhance_t2)
109110

110111
workflow.connect([
111112
(inputnode, validate, [('bold_file', 'in_file')]),

0 commit comments

Comments
 (0)