1
- """
2
- Utility workflows
3
- ^^^^^^^^^^^^^^^^^
4
-
5
- .. autofunction:: init_dwi_reference_wf
6
- .. autofunction:: init_enhance_and_skullstrip_dwi_wf
7
-
8
- """
1
+ """Utility workflows for :abbr:`DWI (diffusion weighted imaging)` data."""
9
2
10
3
from nipype .pipeline import engine as pe
11
4
from nipype .interfaces import utility as niu , fsl , afni
24
17
def init_dwi_reference_wf (omp_nthreads , dwi_file = None ,
25
18
name = 'dwi_reference_wf' , gen_report = False ):
26
19
"""
27
- Build a workflow that generates a reference b0 image from a dwi series .
20
+ Build a workflow that generates a reference b0 image from a DWI dataset .
28
21
29
- To generate the reference b0 , this workflow takes in a dwi series ,
30
- extracts the b0s, registers them to eachother , rescales the signal
22
+ To generate the reference *b0* , this workflow takes in a DWI dataset ,
23
+ extracts the b0s, registers them to each other , rescales the signal
31
24
intensity values, and calculates a median image.
32
25
33
- Then, the reference b0 and its skull-stripped version are generated using
26
+ Then, the reference *b0* and its skull-stripped version are generated using
34
27
a custom methodology adapted from *niworkflows*.
35
28
36
- .. workflow: :
37
- :graph2use: orig
38
- :simple_form: yes
39
-
40
- from dmriprep.workflows.dwi.util import init_dwi_reference_wf
41
- wf = init_dwi_reference_wf(omp_nthreads=1)
42
-
43
- **Parameters**
44
-
45
- dwi_file : str
46
- dwi NIfTI file
47
- omp_nthreads : int
48
- Maximum number of threads an individual process may use
49
- name : str
50
- Name of workflow (default: ``dwi_reference_wf``)
51
- gen_report : bool
52
- Whether a mask report node should be appended in the end
53
-
54
- **Inputs**
55
-
56
- dwi_file
57
- dwi NIfTI file
58
- b0_ixs : list
59
- index of b0s in dwi NIfTI file
60
-
61
- **Outputs**
62
-
63
- dwi_file
64
- Validated dwi NIfTI file
65
- raw_ref_image
66
- Reference image
67
- ref_image
68
- Contrast-enhanced reference image
69
- ref_image_brain
70
- Skull-stripped reference image
71
- dwi_mask
72
- Skull-stripping mask of reference image
73
- validation_report
74
- HTML reportlet indicating whether ``dwi_file`` had a valid affine
75
-
76
-
77
- **Subworkflows**
78
-
79
- * :py:func:`~dmriprep.workflows.dwi.util.init_enhance_and_skullstrip_wf`
29
+ Workflow Graph :
30
+ .. workflow::
31
+ :graph2use: orig
32
+ :simple_form: yes
33
+
34
+ from dmriprep.workflows.dwi.util import init_dwi_reference_wf
35
+ wf = init_dwi_reference_wf(omp_nthreads=1)
36
+
37
+ Parameters
38
+ ----------
39
+ dwi_file : str
40
+ dwi NIfTI file
41
+ omp_nthreads : int
42
+ Maximum number of threads an individual process may use
43
+ name : str
44
+ Name of workflow (default: ``dwi_reference_wf``)
45
+ gen_report : bool
46
+ Whether a mask report node should be appended in the end
47
+
48
+ Inputs
49
+ ------
50
+ dwi_file
51
+ dwi NIfTI file
52
+ b0_ixs : list
53
+ index of b0s in dwi NIfTI file
54
+
55
+ Outputs
56
+ -------
57
+ dwi_file
58
+ Validated dwi NIfTI file
59
+ raw_ref_image
60
+ Reference image
61
+ ref_image
62
+ Contrast-enhanced reference image
63
+ ref_image_brain
64
+ Skull-stripped reference image
65
+ dwi_mask
66
+ Skull-stripping mask of reference image
67
+ validation_report
68
+ HTML reportlet indicating whether ``dwi_file`` had a valid affine
69
+
70
+ See also
71
+ --------
72
+ * :py:func:`~dmriprep.workflows.dwi.util.init_enhance_and_skullstrip_wf`
80
73
81
74
"""
82
75
workflow = Workflow (name = name )
@@ -141,7 +134,9 @@ def init_enhance_and_skullstrip_dwi_wf(
141
134
name = 'enhance_and_skullstrip_dwi_wf' ,
142
135
omp_nthreads = 1 ):
143
136
"""
144
- This workflow takes in a dwi reference image and sharpens the histogram
137
+ Enhance a *b0* reference and perform brain extraction.
138
+
139
+ This workflow takes in a *b0* reference image and sharpens the histogram
145
140
with the application of the N4 algorithm for removing the
146
141
:abbr:`INU (intensity non-uniformity)` bias field and calculates a signal
147
142
mask.
@@ -160,38 +155,41 @@ def init_enhance_and_skullstrip_dwi_wf(
160
155
5. Calculate a final mask as the intersection of 2) and 4).
161
156
6. Apply final mask on the enhanced reference.
162
157
163
- .. workflow ::
164
- :graph2use: orig
165
- :simple_form: yes
166
-
167
- from dmriprep.workflows.dwi.util import init_enhance_and_skullstrip_dwi_wf
168
- wf = init_enhance_and_skullstrip_dwi_wf(omp_nthreads=1)
158
+ Workflow Graph:
159
+ .. workflow ::
160
+ :graph2use: orig
161
+ :simple_form: yes
169
162
170
- **Parameters**
171
- name : str
172
- Name of workflow (default: ``enhance_and_skullstrip_dwi_wf``)
173
- omp_nthreads : int
174
- number of threads available to parallel nodes
163
+ from dmriprep.workflows.dwi.util import init_enhance_and_skullstrip_dwi_wf
164
+ wf = init_enhance_and_skullstrip_dwi_wf(omp_nthreads=1)
175
165
176
- **Inputs**
177
-
178
- in_file
179
- b0 image (single volume)
180
- pre_mask
181
- initial mask
182
-
183
- **Outputs**
166
+ .. _N4BiasFieldCorrection: https://hdl.handle.net/10380/3053
184
167
185
- bias_corrected_file
186
- the ``in_file`` after `N4BiasFieldCorrection`_
187
- skull_stripped_file
188
- the ``bias_corrected_file`` after skull-stripping
189
- mask_file
190
- mask of the skull-stripped input file
191
- out_report
192
- reportlet for the skull-stripping
168
+ Parameters
169
+ ----------
170
+ name : str
171
+ Name of workflow (default: ``enhance_and_skullstrip_dwi_wf``)
172
+ omp_nthreads : int
173
+ number of threads available to parallel nodes
174
+
175
+ Inputs
176
+ ------
177
+ in_file
178
+ The *b0* reference (single volume)
179
+ pre_mask
180
+ initial mask
181
+
182
+ Outputs
183
+ -------
184
+ bias_corrected_file
185
+ the ``in_file`` after `N4BiasFieldCorrection`_
186
+ skull_stripped_file
187
+ the ``bias_corrected_file`` after skull-stripping
188
+ mask_file
189
+ mask of the skull-stripped input file
190
+ out_report
191
+ reportlet for the skull-stripping
193
192
194
- .. _N4BiasFieldCorrection: https://hdl.handle.net/10380/3053
195
193
"""
196
194
workflow = Workflow (name = name )
197
195
inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'pre_mask' ]),
0 commit comments