Skip to content

Commit f0453b9

Browse files
josephmjeoesteban
authored andcommitted
update docs and doctests
1 parent 76371f7 commit f0453b9

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

dmriprep/data/tests/dwi_mask.nii.gz

Whitespace-only changes.

dmriprep/interfaces/images.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ class ExtractB0OutputSpec(TraitedSpec):
2020

2121
class ExtractB0(SimpleInterface):
2222
"""
23+
Extract all b=0 volumes from a dwi series.
2324
2425
Example
2526
-------
2627
2728
>>> os.chdir(tmpdir)
2829
>>> extract_b0 = ExtractB0()
2930
>>> extract_b0.inputs.in_file = str(data_dir / 'dwi.nii.gz')
30-
>>> extract_b0.inputs.b0_ixs = [0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 100]
31-
>>> res = extract_b0.run()
32-
>>> import nibabel as nb
33-
>>> nb.load(res.outputs.out_file).shape
31+
>>> extract_b0.inputs.b0_ixs = [0, 1, 2]
32+
>>> res = extract_b0.run() # doctest: +SKIP
3433
3534
"""
3635
input_spec = ExtractB0InputSpec
@@ -76,6 +75,20 @@ class RescaleB0OutputSpec(TraitedSpec):
7675

7776

7877
class RescaleB0(SimpleInterface):
78+
"""
79+
Rescale the b0 volumes to deal with average signal decay over time
80+
and output the median image.
81+
82+
Example
83+
-------
84+
85+
>>> os.chdir(tmpdir)
86+
>>> rescale_b0 = RescaleB0()
87+
>>> rescale_b0.inputs.in_file = str(data_dir / 'dwi.nii.gz')
88+
>>> rescale_b0.inputs.mask_file = str(data_dir / 'dwi_mask.nii.gz')
89+
>>> res = rescale_b0.run() # doctest: +SKIP
90+
91+
"""
7992

8093
input_spec = RescaleB0InputSpec
8194
output_spec = RescaleB0OutputSpec
@@ -90,10 +103,7 @@ def _run_interface(self, runtime):
90103

91104
def rescale_b0(in_file, mask_file, newpath=None):
92105
"""
93-
Rescale the b0 volumes to deal with average signal decay over time
94-
and calculate the median.
95-
"""
96-
from dipy.segment.mask import applymask
106+
Rescale the *b0* volumes from a DWI dataset."""
97107
import numpy as np
98108
import nibabel as nib
99109
from nipype.utils.filemanip import fname_presuffix

dmriprep/workflows/dwi/util.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ def init_dwi_reference_wf(omp_nthreads, dwi_file=None,
2626
"""
2727
Build a workflow that generates a reference b0 image from a dwi series.
2828
29+
To generate the reference b0, this workflow takes in a dwi series,
30+
extracts the b0s, registers them to eachother, rescales the signal
31+
intensity values, and calculates a median image.
32+
33+
Then, the reference b0 and its skull-stripped version are generated using
34+
a custom methodology taken from *niworkflows*.
35+
2936
.. workflow::
3037
:graph2use: orig
3138
:simple_form: yes
@@ -73,10 +80,7 @@ def init_dwi_reference_wf(omp_nthreads, dwi_file=None,
7380
7481
"""
7582
workflow = Workflow(name=name)
76-
workflow.__desc__ = """\
77-
First, a reference volume and its skull-stripped version were generated
78-
using a custom methodology taken from *fMRIPrep*.
79-
"""
83+
8084
inputnode = pe.Node(niu.IdentityInterface(fields=['dwi_file', 'b0_ixs']),
8185
name='inputnode')
8286
outputnode = pe.Node(
@@ -133,16 +137,6 @@ def init_dwi_reference_wf(omp_nthreads, dwi_file=None,
133137
return workflow
134138

135139

136-
def init_b0_template_wf(
137-
name='b0_template_wf'
138-
):
139-
"""[summary]
140-
141-
Keyword Arguments:
142-
name {str} -- [description] (default: {'b0_template_wf'})
143-
"""
144-
145-
146140
def init_enhance_and_skullstrip_dwi_wf(
147141
name='enhance_and_skullstrip_dwi_wf',
148142
omp_nthreads=1):

0 commit comments

Comments
 (0)