Skip to content

Commit 25a20ba

Browse files
authored
Merge pull request #108 from oesteban/enh/new-datasinks
ENH: Use new ``DerivativesDataSink`` from NiWorkflows 1.2.0
2 parents f2df371 + de14073 commit 25a20ba

File tree

11 files changed

+60
-72
lines changed

11 files changed

+60
-72
lines changed

MANIFEST.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
# General
2-
include CHANGES.rst
3-
include LICENSE
4-
5-
# versioneer
61
include versioneer.py
7-
include dmriprep/_version.py

dmriprep/cli/run.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def main():
129129
failed_reports = generate_reports(
130130
config.execution.participant_label,
131131
config.execution.output_dir,
132-
config.execution.work_dir,
133132
config.execution.run_uuid,
134133
config=pkgrf("dmriprep", "config/reports-spec.yml"),
135134
packagename="dmriprep",

dmriprep/cli/workflow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def build_workflow(config_file, retval):
5757
retval["return_code"] = generate_reports(
5858
subject_list,
5959
config.execution.output_dir,
60-
config.execution.work_dir,
6160
config.execution.run_uuid,
6261
config=pkgrf("dmriprep", "config/reports-spec.yml"),
6362
packagename="dmriprep",

dmriprep/config/reports-spec.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@ package: dmriprep
22
sections:
33
- name: Summary
44
reportlets:
5-
- bids: {datatype: anat, desc: summary, suffix: T1w}
5+
- bids: {datatype: figures, desc: summary, suffix: T1w}
66
- name: Anatomical
77
reportlets:
88
- bids:
9-
datatype: anat
9+
datatype: figures
1010
desc: conform
1111
extension: [.html]
1212
suffix: T1w
13-
- bids: {datatype: anat, suffix: dseg}
13+
- bids: {datatype: figures, suffix: dseg}
1414
caption: This panel shows the template T1-weighted image (if several T1w images
1515
were found), with contours delineating the detected brain mask and brain tissue
1616
segmentations.
1717
subtitle: Brain mask and brain tissue segmentation of the T1w
18-
- bids: {datatype: anat, space: .*, suffix: T1w, regex_search: True}
18+
- bids: {datatype: figures, space: .*, suffix: T1w, regex_search: True}
1919
caption: Spatial normalization of the T1w image to the <code>{space}</code> template.
2020
description: Results of nonlinear alignment of the T1w reference one or more template
2121
space(s). Hover on the panels with the mouse pointer to transition between both
2222
spaces.
2323
static: false
2424
subtitle: Spatial normalization of the anatomical T1w reference
25-
- bids: {datatype: anat, desc: reconall, suffix: T1w}
25+
- bids: {datatype: figures, desc: reconall, suffix: T1w}
2626
caption: Surfaces (white and pial) reconstructed with FreeSurfer (<code>recon-all</code>)
2727
overlaid on the participant's T1w template.
2828
subtitle: Surface reconstruction
2929
- name: Diffusion
3030
ordering: session,acquisition,run
3131
reportlets:
32-
- bids: {datatype: dwi, desc: validation, suffix: dwi}
33-
- bids: {datatype: dwi, desc: brain, suffix: mask}
32+
- bids: {datatype: figures, desc: validation, suffix: dwi}
33+
- bids: {datatype: figures, desc: brain, suffix: mask}
3434
caption: Average b=0 that serves for reference in early preprocessing steps.
3535
descriptions: The reference b=0 is obtained as the voxel-wise median across
3636
all b=0 found in the dataset, after accounting for signal drift.
3737
The red contour shows the brain mask calculated using this reference b=0.
3838
subtitle: Reference b=0 and brain mask
3939
- name: About
4040
reportlets:
41-
- bids: {datatype: anat, desc: about, suffix: T1w}
41+
- bids: {datatype: figures, desc: about, suffix: T1w}

dmriprep/workflows/base.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def init_single_subject_wf(subject_id):
165165
166166
"""
167167
spaces = config.workflow.spaces
168-
reportlets_dir = str(config.execution.work_dir / "reportlets")
168+
output_dir = config.execution.output_dir
169169

170170
fsinputnode = pe.Node(niu.IdentityInterface(fields=["subjects_dir"]),
171171
name="fsinputnode")
@@ -185,13 +185,11 @@ def init_single_subject_wf(subject_id):
185185
name="about", run_without_submitting=True)
186186

187187
ds_report_summary = pe.Node(
188-
DerivativesDataSink(base_directory=reportlets_dir,
189-
desc="summary", keep_dtype=True),
188+
DerivativesDataSink(base_directory=str(output_dir), desc="summary", datatype="figures"),
190189
name="ds_report_summary", run_without_submitting=True)
191190

192191
ds_report_about = pe.Node(
193-
DerivativesDataSink(base_directory=reportlets_dir,
194-
desc="about", keep_dtype=True),
192+
DerivativesDataSink(base_directory=str(output_dir), desc="about", datatype="figures"),
195193
name="ds_report_about", run_without_submitting=True)
196194

197195
anat_derivatives = config.execution.anat_derivatives
@@ -214,8 +212,7 @@ def init_single_subject_wf(subject_id):
214212
hires=config.workflow.hires,
215213
longitudinal=config.workflow.longitudinal,
216214
omp_nthreads=config.nipype.omp_nthreads,
217-
output_dir=str(config.execution.output_dir),
218-
reportlets_dir=reportlets_dir,
215+
output_dir=str(output_dir),
219216
skull_strip_fixed_seed=config.workflow.skull_strip_fixed_seed,
220217
skull_strip_mode="force",
221218
skull_strip_template=Reference.from_string(

dmriprep/workflows/dwi/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ def init_early_b0ref_wf(
8888
])
8989

9090
# REPORTING ############################################################
91-
reportlets_dir = str(config.execution.work_dir / 'reportlets')
92-
reportlets_wf = init_reportlets_wf(reportlets_dir)
91+
reportlets_wf = init_reportlets_wf(str(config.execution.output_dir))
9392
workflow.connect([
9493
(inputnode, reportlets_wf, [('dwi_file', 'inputnode.source_file')]),
9594
(dwi_reference_wf, reportlets_wf, [

dmriprep/workflows/dwi/outputs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from ...interfaces import DerivativesDataSink
66

77

8-
def init_reportlets_wf(reportlets_dir, name='reportlets_wf'):
8+
def init_reportlets_wf(output_dir, name='reportlets_wf'):
99
"""Set up a battery of datasinks to store reports in the right location."""
1010
from niworkflows.interfaces.masks import SimpleShowMaskRPT
1111
workflow = Workflow(name=name)
@@ -17,12 +17,11 @@ def init_reportlets_wf(reportlets_dir, name='reportlets_wf'):
1717
mask_reportlet = pe.Node(SimpleShowMaskRPT(), name='mask_reportlet')
1818

1919
ds_report_mask = pe.Node(
20-
DerivativesDataSink(base_directory=reportlets_dir,
21-
desc='brain', suffix='mask'),
20+
DerivativesDataSink(base_directory=output_dir, desc='brain', suffix='mask',
21+
datatype="figures"),
2222
name='ds_report_mask', run_without_submitting=True)
2323
ds_report_validation = pe.Node(
24-
DerivativesDataSink(base_directory=reportlets_dir,
25-
desc='validation', keep_dtype=True),
24+
DerivativesDataSink(base_directory=output_dir, desc='validation', datatype="figures"),
2625
name='ds_report_validation', run_without_submitting=True)
2726

2827
workflow.connect([

docs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ git+https://github.com/AleksandarPetrov/napoleon.git@0dc3f28a309ad602be5f44a9049
22
git+https://github.com/rwblair/sphinxcontrib-versioning.git@39b40b0b84bf872fc398feff05344051bbce0f63#egg=sphinxcontrib-versioning
33
nbsphinx
44
nipype ~= 1.4
5-
niworkflows >=1.2.0rc1,<1.3
5+
git+https://github.com/nipreps/niworkflows.git@master#egg=niworkflows
66
packaging
77
pydot>=1.2.3
88
pydotplus
9-
smriprep >=0.6.0rc2
9+
git+https://github.com/poldracklab/smriprep.git@master#egg=smriprep
1010
sphinx-argparse
1111
sphinx >=2.1.2,<3.0
1212
sphinx_rtd_theme

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[build-system]
2+
# setuptools can be configured with setup.cfg when >=30.3
3+
# Most bugfixes regarding setup.cfg are included before 38.3
24
requires = ["setuptools >= 40.8.0", "wheel"]

setup.cfg

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
[metadata]
2-
url = https://github.com/nipreps/dmriprep
3-
author = The dMRIPrep developers
4-
author_email = [email protected]
5-
maintainer = Oscar Esteban
6-
maintainer_email = [email protected]
7-
description = dMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse dMRI data.
8-
long_description = file:README.rst
9-
long_description_content_type = text/x-rst; charset=UTF-8
10-
license = Apache License, Version 2.0
2+
author = The NiPreps developers
3+
author_email = [email protected]
114
classifiers =
125
Development Status :: 3 - Alpha
136
Intended Audience :: Science/Research
@@ -16,28 +9,51 @@ classifiers =
169
Programming Language :: Python :: 3.6
1710
Programming Language :: Python :: 3.7
1811
Programming Language :: Python :: 3.8
12+
description = dMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse dMRI data.
13+
license = Apache License, Version 2.0
14+
long_description = file:README.rst
15+
long_description_content_type = text/x-rst; charset=UTF-8
16+
name = dmriprep
17+
project_urls =
18+
Home = https://github.com/nipreps/dmriprep
19+
Documentation = https://www.nipreps.org/dmriprep
1920

2021
[options]
21-
python_requires = >=3.5
22+
python_requires = >=3.6
2223
install_requires =
2324
dipy >=1.0.0
2425
indexed_gzip >=0.8.8
2526
nibabel ~= 3.0
2627
nipype ~= 1.4
27-
niworkflows >=1.2.0rc4,<1.3
28+
niworkflows @ git+https://github.com/nipreps/niworkflows.git@master
2829
numpy
2930
pybids >=0.10.2
3031
pyyaml
31-
sdcflows >= 1.2.3
32-
smriprep >=0.6.0rc4,<0.7
33-
templateflow >= 0.4.2
32+
sdcflows @ git+https://github.com/nipreps/sdcflows.git@master
33+
smriprep @ git+https://github.com/poldracklab/smriprep.git@master
34+
templateflow ~= 0.6
3435
toml
36+
setup_requires =
37+
setuptools >= 40.8.0
3538
test_requires =
3639
codecov
3740
coverage
3841
pytest
3942
packages = find:
40-
include_package_data = True
43+
44+
[options.packages.find]
45+
exclude =
46+
*.tests
47+
48+
[options.package_data]
49+
dmriprep =
50+
VERSION
51+
config/reports-spec.yml
52+
data/boilerplate.bib
53+
data/tests/config.toml
54+
data/tests/THP/*
55+
data/tests/THP/sub-THP0005/anat/*
56+
data/tests/THP/sub-THP0005/dwi/*
4157

4258
[options.exclude_package_data]
4359
* = tests
@@ -77,16 +93,6 @@ all =
7793
%(popylar)s
7894
%(tests)s
7995

80-
[options.package_data]
81-
dmriprep =
82-
VERSION
83-
config/reports-spec.yml
84-
data/boilerplate.bib
85-
data/tests/config.toml
86-
data/tests/THP/*
87-
data/tests/THP/sub-THP0005/anat/*
88-
data/tests/THP/sub-THP0005/dwi/*
89-
9096
[options.entry_points]
9197
console_scripts =
9298
dmriprep=dmriprep.cli.run:main

0 commit comments

Comments
 (0)