Skip to content

Commit 6b575d3

Browse files
authored
Merge pull request #346 from oesteban/rel/0.9.0-fixes
ENH/FIX: Migrate default config to YAML, fix ROIs query.
2 parents 9021ee8 + 1e60242 commit 6b575d3

File tree

6 files changed

+124
-201
lines changed

6 files changed

+124
-201
lines changed

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# data
22
include niworkflows/data/*.json
33
include niworkflows/data/tests/work/*
4+
include niworkflows/reports/figures.json
5+
include niworkflows/reports/fmriprep.yml
6+
include niworkflows/reports/report.tpl
7+
48

59
# misc
610
include requirements.txt

niworkflows/__about__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
'packaging',
6060
'pandas',
6161
'pybids>=0.7,<0.8',
62+
'PyYAML',
6263
'scikit-image',
6364
'scipy',
6465
'seaborn',

niworkflows/reports/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
1010
"""
1111
from pathlib import Path
12-
import json
1312
import re
1413
from itertools import product
1514
from collections import defaultdict
@@ -196,7 +195,7 @@ class Report(object):
196195
>>> robj.generate_report()
197196
0
198197
>>> len((testdir / 'out' / 'niworkflows' / 'sub-01.html').read_text())
199-
17582
198+
20862
200199
201200
"""
202201

@@ -229,11 +228,12 @@ def __init__(self, reportlets_dir, out_dir, run_uuid, config=None,
229228
self.out_filename = 'sub-{}.html'.format(self.subject_id)
230229

231230
if config is None:
232-
config = pkgrf('niworkflows', 'reports/defaultconfig.json')
231+
config = pkgrf('niworkflows', 'reports/fmriprep.yml')
233232
self._load_config(Path(config))
234233

235234
def _load_config(self, config):
236-
settings = json.loads(config.read_text())
235+
from yaml import load
236+
settings = load(config.read_text())
237237
self.packagename = self.packagename or settings.get('package', None)
238238

239239
if self.packagename is not None:

niworkflows/reports/defaultconfig.json

Lines changed: 0 additions & 196 deletions
This file was deleted.

niworkflows/reports/fmriprep.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package: niworkflows
2+
sections:
3+
- name: Summary
4+
reportlets:
5+
- bids: {datatype: anat, desc: summary, suffix: T1w}
6+
- name: Anatomical
7+
reportlets:
8+
- bids:
9+
datatype: anat
10+
desc: conform
11+
extensions: [.html]
12+
suffix: T1w
13+
- bids: {datatype: anat, suffix: dseg}
14+
caption: This panel shows the template T1-weighted image (if several T1w images
15+
were found), with contours delineating the detected brain mask and brain tissue
16+
segmentations.
17+
subtitle: Brain mask and brain tissue segmentation of the T1w
18+
- bids: {datatype: anat, space: .*, suffix: T1w}
19+
caption: Spatial normalization of the T1w image to the <code>{space}</code> template.
20+
description: Results of nonlinear alignment of the T1w reference one or more template
21+
space(s). Hover on the panels with the mouse pointer to transition between both
22+
spaces.
23+
subtitle: Spatial normalization of the anatomical T1w reference
24+
- bids: {datatype: anat, desc: reconall, suffix: T1w}
25+
caption: Surfaces (white and pial) reconstructed with FreeSurfer (<code>recon-all</code>)
26+
overlaid on the participant's T1w template.
27+
subtitle: Surface reconstruction
28+
- name: Fieldmaps
29+
ordering: session
30+
reportlets:
31+
- bids: {datatype: fmap, desc: brain, suffix: mask}
32+
caption: Brain extraction of the magnitude image from the fieldmap
33+
subtitle: Skull stripped magnitude image
34+
- name: Functional
35+
ordering: session,task,run
36+
reportlets:
37+
- bids: {datatype: func, desc: summary, suffix: bold}
38+
- bids: {datatype: func, desc: validation, suffix: bold}
39+
- bids: {datatype: func, desc: magnitude, suffix: bold}
40+
caption: Results of affine coregistration between the magnitude image of the fieldmap
41+
and the reference EPI image
42+
subtitle: Fieldmap to EPI registration
43+
- bids: {datatype: func, desc: fieldmap, suffix: bold}
44+
caption: Overlaid on the reference EPI image
45+
subtitle: Fieldmap
46+
- bids: {datatype: func, desc: sdc, suffix: bold}
47+
caption: Results of performing susceptibility distortion correction (SDC) on the
48+
EPI
49+
subtitle: Susceptibility distortion correction
50+
- bids: {datatype: func, desc: forcedsyn, suffix: bold}
51+
caption: The dataset contained some fieldmap information, but the argument <code>--force-syn</code>
52+
was used. The higher-priority SDC method was used. Here, we show the results
53+
of performing SyN-based SDC on the EPI for comparison.
54+
subtitle: Experimental fieldmap-less susceptibility distortion correction
55+
- bids: {datatype: func, desc: rois, suffix: bold}
56+
caption: Brain mask calculated on the BOLD signal (red contour), along with the
57+
masks used for a/tCompCor.<br />The aCompCor mask (magenta contour) is a conservative
58+
CSF and white-matter mask for extracting physiological and movement confounds.
59+
<br />The fCompCor mask (blue contour) contains the top 5% most variable voxels
60+
within a heavily-eroded brain-mask.
61+
subtitle: ROIs in BOLD space
62+
- bids:
63+
datatype: func
64+
desc: '[at]compcor'
65+
extensions: [.html]
66+
suffix: bold
67+
- bids: {datatype: func, desc: flirtnobbr, suffix: bold}
68+
caption: FSL <code>flirt</code> was used to generate transformations from EPI
69+
space to T1 Space - BBR refinement rejected. Note that Nearest Neighbor interpolation
70+
is used in the reportlets in order to highlight potential spin-history and other
71+
artifacts, whereas final images are resampled using Lanczos interpolation.
72+
subtitle: EPI to T1 registration
73+
- bids: {datatype: func, desc: coreg, suffix: bold}
74+
caption: <code>mri_coreg</code> (FreeSurfer) was used to generate transformations
75+
from EPI space to T1 Space - <code>bbregister</code> refinement rejected. Note
76+
that Nearest Neighbor interpolation is used in the reportlets in order to highlight
77+
potential spin-history and other artifacts, whereas final images are resampled
78+
using Lanczos interpolation.
79+
subtitle: EPI to T1 registration
80+
- bids: {datatype: func, desc: flirtbbr, suffix: bold}
81+
caption: FSL <code>flirt</code> was used to generate transformations from EPI-space
82+
to T1w-space - The white matter mask calculated with FSL <code>fast</code> (brain
83+
tissue segmentation) was used for BBR. Note that Nearest Neighbor interpolation
84+
is used in the reportlets in order to highlight potential spin-history and other
85+
artifacts, whereas final images are resampled using Lanczos interpolation.
86+
subtitle: EPI to T1 registration
87+
- bids: {datatype: func, desc: bbregister, suffix: bold}
88+
caption: <code>bbregister</code> was used to generate transformations from EPI-space
89+
to T1w-space. Note that Nearest Neighbor interpolation is used in the reportlets
90+
in order to highlight potential spin-history and other artifacts, whereas final
91+
images are resampled using Lanczos interpolation.
92+
subtitle: EPI to T1 registration
93+
- bids: {datatype: func, desc: carpetplot, suffix: bold}
94+
caption: Summary statistics are plotted, which may reveal trends or artifacts
95+
in the BOLD data. Global signals calculated within the whole-brain (GS), within
96+
the white-matter (WM) and within cerebro-spinal fluid (CSF) show the mean BOLD
97+
signal in their corresponding masks. DVARS and FD show the standardized DVARS
98+
and framewise-displacement measures for each time point.<br />A carpet plot
99+
shows the time series for all voxels within the brain mask. Voxels are grouped
100+
into cortical (blue), and subcortical (orange) gray matter, cerebellum (green)
101+
and white matter and CSF (red), indicated by the color map on the left-hand
102+
side.
103+
subtitle: BOLD Summary
104+
- bids: {datatype: func, desc: aroma, suffix: bold}
105+
caption: |
106+
Maps created with maximum intensity projection (glass brain) with a
107+
black brain outline. Right hand side of each map: time series (top in seconds),
108+
frequency spectrum (bottom in Hertz). Components classified as signal are plotted
109+
in green; noise components in red.
110+
subtitle: ICA Components classified by AROMA
111+
- name: About
112+
reportlets:
113+
- bids: {datatype: anat, desc: about, suffix: T1w}
114+
template_path: report.tpl

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def main():
3333
'niworkflows': [
3434
'data/t1-mni_registration*.json',
3535
'data/bold-mni_registration*.json',
36-
'reports/defaultconfig.json',
3736
'reports/figures.json',
37+
'reports/fmriprep.yml',
3838
'reports/report.tpl',
3939
]}
4040

0 commit comments

Comments
 (0)