Skip to content

Commit

Permalink
Merge pull request #102 from oesteban/enh/new-datasinks
Browse files Browse the repository at this point in the history
ENH: Use new ``DerivativesDataSink`` from NiWorkflows 1.2.0
  • Loading branch information
oesteban authored May 7, 2020
2 parents 5878bc3 + 2ff4790 commit a6ca8af
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ git+https://github.com/rwblair/sphinxcontrib-versioning.git@39b40b0b84bf872fc398
nbsphinx
niflow-nipype1-workflows ~= 0.0.1
nipype>=1.3.1
niworkflows >=1.2.0rc4,<1.4
git+https://github.com/nipreps/niworkflows.git@master
packaging
pydot>=1.2.3
pydotplus
Expand Down
2 changes: 1 addition & 1 deletion sdcflows/workflows/fmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def init_fmap2field_wf(omp_nthreads, debug, name='fmap2field_wf',
reference_label='EPI Reference',
moving_label='Magnitude', show='both'), name='fmap_rpt')
ds_report_sdc = pe.Node(
DerivativesDataSink(desc='fieldmap', suffix='bold'),
DerivativesDataSink(desc='fieldmap', suffix='bold', datatype='figures'),
name='ds_report_fmap', mem_gb=0.01, run_without_submitting=True
)

Expand Down
4 changes: 2 additions & 2 deletions sdcflows/workflows/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def init_sdc_unwarp_report_wf(name='sdc_unwarp_report_wf', forcedsyn=False):
bold_rpt = pe.Node(SimpleBeforeAfter(), name='bold_rpt',
mem_gb=0.1)
ds_report_sdc = pe.Node(
DerivativesDataSink(desc='sdc' if not forcedsyn else 'forcedsyn',
suffix='bold'), name='ds_report_sdc',
DerivativesDataSink(desc=('sdc', 'forcedsyn')[forcedsyn], suffix='bold',
datatype='figures'), name='ds_report_sdc',
mem_gb=DEFAULT_MEMORY_MIN_GB, run_without_submitting=True
)

Expand Down
5 changes: 2 additions & 3 deletions sdcflows/workflows/tests/test_pepolar.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ def test_pepolar_wf1(bids_layouts, output_path, dataset, workdir):
rep = pe.Node(FieldmapReportlet(reference_label='EPI Reference'), 'simple_report')
rep.interface._always_run = True
dsink = pe.Node(DerivativesDataSink(
base_directory=str(output_path), keep_dtype=True,
desc='pepolar'), name='dsink')
dsink.interface.out_path_base = 'sdcflows'
base_directory=str(output_path), out_path_base='sdcflows', datatype="figures",
suffix='fieldmap', desc='pepolar', dismiss_entities='fmap'), name='dsink')
dsink.inputs.source_file = epidata[0].path

boiler.connect([
Expand Down
26 changes: 14 additions & 12 deletions sdcflows/workflows/tests/test_phdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ def test_phdiff(bids_layouts, tmpdir, output_path, dataset, workdir):
rep = pe.Node(FieldmapReportlet(reference_label='Magnitude'), 'simple_report')
rep.interface._always_run = True

dsink = pe.Node(DerivativesDataSink(
base_directory=str(output_path), keep_dtype=True), name='dsink')
dsink.interface.out_path_base = 'sdcflows'
dsink.inputs.source_file = phdiff_files[0].path
ds_report = pe.Node(DerivativesDataSink(
base_directory=str(output_path), out_path_base='sdcflows', datatype='figures',
suffix='fieldmap', desc='phasediff', dismiss_entities='fmap'), name='ds_report')
ds_report.inputs.source_file = phdiff_files[0].path

dsink_fmap = pe.Node(DerivativesDataSink(
base_directory=str(output_path), keep_dtype=True), name='dsink_fmap')
base_directory=str(output_path), dismiss_entities='fmap',
desc='phasediff', suffix='fieldmap'), name='dsink_fmap')
dsink_fmap.interface.out_path_base = 'sdcflows'
dsink_fmap.inputs.source_file = phdiff_files[0].path

Expand All @@ -55,7 +56,7 @@ def test_phdiff(bids_layouts, tmpdir, output_path, dataset, workdir):
('outputnode.fmap', 'fieldmap'),
('outputnode.fmap_ref', 'reference'),
('outputnode.fmap_mask', 'mask')]),
(rep, dsink, [('out_report', 'in_file')]),
(rep, ds_report, [('out_report', 'in_file')]),
(phdiff_wf, dsink_fmap, [('outputnode.fmap', 'in_file')]),
])
else:
Expand Down Expand Up @@ -91,13 +92,14 @@ def test_phases(bids_layouts, tmpdir, output_path, workdir):
rep = pe.Node(FieldmapReportlet(reference_label='Magnitude'), 'simple_report')
rep.interface._always_run = True

dsink = pe.Node(DerivativesDataSink(
base_directory=str(output_path), keep_dtype=True), name='dsink')
dsink.interface.out_path_base = 'sdcflows'
dsink.inputs.source_file = phdiff_files[0].path
ds_report = pe.Node(DerivativesDataSink(
base_directory=str(output_path), out_path_base='sdcflows', datatype='figures',
suffix='fieldmap', desc='twophases', dismiss_entities='fmap'), name='ds_report')
ds_report.inputs.source_file = phdiff_files[0].path

dsink_fmap = pe.Node(DerivativesDataSink(
base_directory=str(output_path), keep_dtype=True), name='dsink_fmap')
base_directory=str(output_path), suffix='fieldmap', desc='twophases',
dismiss_entities='fmap'), name='dsink_fmap')
dsink_fmap.interface.out_path_base = 'sdcflows'
dsink_fmap.inputs.source_file = phdiff_files[0].path

Expand All @@ -106,7 +108,7 @@ def test_phases(bids_layouts, tmpdir, output_path, workdir):
('outputnode.fmap', 'fieldmap'),
('outputnode.fmap_ref', 'reference'),
('outputnode.fmap_mask', 'mask')]),
(rep, dsink, [('out_report', 'in_file')]),
(rep, ds_report, [('out_report', 'in_file')]),
(phdiff_wf, dsink_fmap, [('outputnode.fmap', 'in_file')]),
])
else:
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ install_requires =
nibabel >=3.0.1
niflow-nipype1-workflows ~= 0.0.1
nipype >=1.3.1,<2.0
niworkflows >=1.2.0rc4,<1.4
niworkflows @ git+https://github.com/nipreps/niworkflows.git@master
numpy
pybids >= 0.9.2
pybids >= 0.10.2
templateflow >=0.4
test_requires =
codecov
Expand Down

0 comments on commit a6ca8af

Please sign in to comment.