Skip to content

Commit 9021ee8

Browse files
authored
Merge pull request #345 from oesteban/rel/0.9.0-fixes
REL: Synchronization with latest fMRIPrep changes + minor improvements
2 parents ff85c47 + ea080bb commit 9021ee8

File tree

7 files changed

+30
-9
lines changed

7 files changed

+30
-9
lines changed

niworkflows/reports/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2+
# vi: set ft=python sts=4 ts=4 sw=4 et:
3+
4+
from .core import generate_reports
5+
6+
__all__ = ['generate_reports']

niworkflows/viz/reports.py renamed to niworkflows/reports/core.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from nipype.utils.filemanip import copyfile
2121

2222

23-
add_config_paths(figures=pkgrf('niworkflows', 'viz/figures.json'))
2423
PLURAL_SUFFIX = defaultdict(str('s').format, [('echo', 'es')])
2524
SVG_SNIPPET = """\
2625
<object class="svg-reportlet" type="image/svg+xml" data="./{0}">
@@ -197,7 +196,7 @@ class Report(object):
197196
>>> robj.generate_report()
198197
0
199198
>>> len((testdir / 'out' / 'niworkflows' / 'sub-01.html').read_text())
200-
16988
199+
17582
201200
202201
"""
203202

@@ -207,6 +206,11 @@ def __init__(self, reportlets_dir, out_dir, run_uuid, config=None,
207206
self.root = reportlets_dir
208207

209208
# Initialize a BIDS layout
209+
try:
210+
add_config_paths(figures=pkgrf('niworkflows', 'reports/figures.json'))
211+
except ValueError as e:
212+
if "Configuration 'figures' already exists" != str(e):
213+
raise
210214
self.layout = BIDSLayout(self.root, config='figures', validate=False)
211215

212216
# Initialize structuring elements
@@ -225,7 +229,7 @@ def __init__(self, reportlets_dir, out_dir, run_uuid, config=None,
225229
self.out_filename = 'sub-{}.html'.format(self.subject_id)
226230

227231
if config is None:
228-
config = pkgrf('niworkflows', 'viz/defaultconfig.json')
232+
config = pkgrf('niworkflows', 'reports/defaultconfig.json')
229233
self._load_config(Path(config))
230234

231235
def _load_config(self, config):

niworkflows/viz/defaultconfig.json renamed to niworkflows/reports/defaultconfig.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,21 @@
123123
"caption": "Brain mask calculated on the BOLD signal (red contour), along with the masks used for a/tCompCor.<br />The aCompCor mask (magenta contour) is a conservative CSF and white-matter mask for extracting physiological and movement confounds. <br />The fCompCor mask (blue contour) contains the top 5% most variable voxels within a heavily-eroded brain-mask.",
124124
"subtitle": "ROIs in BOLD space"
125125
},
126+
{
127+
"bids": {
128+
"datatype": "func",
129+
"desc": "[at]compcor",
130+
"suffix": "bold",
131+
"extensions": [".html"]
132+
}
133+
},
126134
{
127135
"bids": {
128136
"datatype": "func",
129137
"desc": "flirtnobbr",
130138
"suffix": "bold"
131139
},
132-
"caption": "FSL <code>flirt</code> was used to generate transformations from EPI space to T1 Space - BBR refinement rejected",
140+
"caption": "FSL <code>flirt</code> was used to generate transformations from EPI space to T1 Space - BBR refinement rejected. Note that Nearest Neighbor interpolation is used in the reportlets in order to highlight potential spin-history and other artifacts, whereas final images are resampled using Lanczos interpolation.",
133141
"subtitle": "EPI to T1 registration"
134142
},
135143
{
@@ -138,7 +146,7 @@
138146
"desc": "coreg",
139147
"suffix": "bold"
140148
},
141-
"caption": "<code>mri_coreg</code> (FreeSurfer) was used to generate transformations from EPI space to T1 Space - <code>bbregister</code> refinement rejected",
149+
"caption": "<code>mri_coreg</code> (FreeSurfer) was used to generate transformations from EPI space to T1 Space - <code>bbregister</code> refinement rejected. Note that Nearest Neighbor interpolation is used in the reportlets in order to highlight potential spin-history and other artifacts, whereas final images are resampled using Lanczos interpolation.",
142150
"subtitle": "EPI to T1 registration"
143151
},
144152
{
@@ -147,7 +155,7 @@
147155
"desc": "flirtbbr",
148156
"suffix": "bold"
149157
},
150-
"caption": "FSL <code>flirt</code> was used to generate transformations from EPI-space to T1w-space - The white matter mask calculated with FSL <code>fast</code> (brain tissue segmentation) was used for BBR",
158+
"caption": "FSL <code>flirt</code> was used to generate transformations from EPI-space to T1w-space - The white matter mask calculated with FSL <code>fast</code> (brain tissue segmentation) was used for BBR. Note that Nearest Neighbor interpolation is used in the reportlets in order to highlight potential spin-history and other artifacts, whereas final images are resampled using Lanczos interpolation.",
151159
"subtitle": "EPI to T1 registration"
152160
},
153161
{
@@ -156,7 +164,7 @@
156164
"desc": "bbregister",
157165
"suffix": "bold"
158166
},
159-
"caption": "<code>bbregister</code> was used to generate transformations from EPI-space to T1w-space",
167+
"caption": "<code>bbregister</code> was used to generate transformations from EPI-space to T1w-space. Note that Nearest Neighbor interpolation is used in the reportlets in order to highlight potential spin-history and other artifacts, whereas final images are resampled using Lanczos interpolation.",
160168
"subtitle": "EPI to T1 registration"
161169
},
162170
{
File renamed without changes.
File renamed without changes.

niworkflows/viz/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55

66
from .plots import plot_carpet
77
from .utils import SVGNS
8+
9+
__all__ = ['plot_carpet', 'SVGNS']

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ def main():
3333
'niworkflows': [
3434
'data/t1-mni_registration*.json',
3535
'data/bold-mni_registration*.json',
36-
'viz/*.json',
37-
'viz/report.tpl',
36+
'reports/defaultconfig.json',
37+
'reports/figures.json',
38+
'reports/report.tpl',
3839
]}
3940

4041
root_dir = op.dirname(op.abspath(getfile(currentframe())))

0 commit comments

Comments
 (0)