Skip to content

Commit 4707fb2

Browse files
josephmjeoesteban
authored andcommitted
add workflow test
1 parent f0453b9 commit 4707fb2

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

dmriprep/workflows/dwi/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def init_dwi_reference_wf(omp_nthreads, dwi_file=None,
3131
intensity values, and calculates a median image.
3232
3333
Then, the reference b0 and its skull-stripped version are generated using
34-
a custom methodology taken from *niworkflows*.
34+
a custom methodology adapted from *niworkflows*.
3535
3636
.. workflow::
3737
:graph2use: orig

dmriprep/workflows/tests/__init__.py

Whitespace-only changes.

dmriprep/workflows/tests/test_util.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Test util workflows."""
2+
import pytest
3+
4+
from niworkflows.engine.workflows import LiterateWorkflow as Workflow
5+
from nipype.pipeline import engine as pe
6+
7+
from dmriprep.workflows.dwi.util import init_dwi_reference_wf
8+
from dmriprep.interfaces.vectors import CheckGradientTable
9+
10+
11+
@pytest.mark.parametrize('dataset', [
12+
'THP002'
13+
])
14+
def test_util(bids_layouts, tmpdir, output_path, dataset, workdir):
15+
"""Test creation of the workflow."""
16+
tmpdir.chdir()
17+
18+
data = bids_layouts[dataset]
19+
wf = Workflow(name='util_%s' % dataset)
20+
util_wf = init_dwi_reference_wf(omp_nthreads=1)
21+
22+
dwi_file = data.get(
23+
datatype='dwi',
24+
return_type='file',
25+
extension=['.nii', '.nii.gz'])
26+
27+
bvec_file = data.get_bvec(dwi_file)
28+
bval_file = data.get_bval(dwi_file)
29+
30+
gradient_table = pe.Node(CheckGradientTable(
31+
dwi_file=dwi_file,
32+
in_bvec=bvec_file,
33+
in_bval=bval_file), name='gradient_table')
34+
35+
util_wf.inputs.inputnode.dwi_file = dwi_file
36+
37+
wf.connect([
38+
gradient_table, util_wf, [('b0_ixs', 'b0_ixs')],
39+
])
40+
41+
if workdir:
42+
wf.base_dir = str(workdir)
43+
44+
wf.run()

0 commit comments

Comments
 (0)