1
1
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2
2
# vi: set ft=python sts=4 ts=4 sw=4 et:
3
3
4
- '''
5
- This file provides some common registration routines useful for a variety of
6
- pipelines.
7
-
8
- Including linear and non-linear image co-registration
9
- '''
4
+ """
5
+ Example of registration workflows using niftyreg, useful for a variety of
6
+ pipelines. Including linear and non-linear image co-registration
7
+ """
10
8
11
9
from builtins import str , range
12
10
import nipype .interfaces .utility as niu
@@ -20,7 +18,7 @@ def create_linear_gw_step(name="linear_gw_niftyreg",
20
18
use_mask = False ,
21
19
verbose = False ):
22
20
"""
23
- Creates a workflow that perform linear co-registration of a set of images
21
+ Creates a workflow that performs linear co-registration of a set of images
24
22
using RegAladin, producing an average image and a set of affine
25
23
transformation matrices linking each of the floating images to the average.
26
24
@@ -38,6 +36,7 @@ def create_linear_gw_step(name="linear_gw_niftyreg",
38
36
outputspec.aff_files - The affine transformation files
39
37
40
38
Optional arguments::
39
+
41
40
linear_options_hash - An options dictionary containing a list of
42
41
parameters for RegAladin that take
43
42
the same form as given in the interface (default None)
@@ -51,8 +50,8 @@ def create_linear_gw_step(name="linear_gw_niftyreg",
51
50
52
51
>>> from nipype.workflows.smri.niftyreg import create_linear_gw_step
53
52
>>> lgw = create_linear_gw_step('my_linear_coreg') # doctest: +SKIP
54
- >>> lgw.inputs.inputspec.in_files = ['file1.nii.gz', 'file2.nii.gz'] \
55
- # doctest: +SKIP
53
+ >>> lgw.inputs.inputspec.in_files = [
54
+ ... 'file1.nii.gz', 'file2.nii.gz'] # doctest: +SKIP
56
55
>>> lgw.inputs.inputspec.ref_file = ['ref.nii.gz'] # doctest: +SKIP
57
56
>>> lgw.run() # doctest: +SKIP
58
57
@@ -121,6 +120,7 @@ def create_nonlinear_gw_step(name="nonlinear_gw_niftyreg",
121
120
cpp transformation linking each of the floating images to the average.
122
121
123
122
Inputs::
123
+
124
124
inputspec.in_files - The input files to be registered
125
125
inputspec.ref_file - The initial reference image that the input files
126
126
are registered to
@@ -134,6 +134,7 @@ def create_nonlinear_gw_step(name="nonlinear_gw_niftyreg",
134
134
outputspec.cpp_files - The bspline transformation files
135
135
136
136
Optional arguments::
137
+
137
138
nonlinear_options_hash - An options dictionary containing a list of
138
139
parameters for RegAladin that take the
139
140
same form as given in the interface (default None)
@@ -144,8 +145,8 @@ def create_nonlinear_gw_step(name="nonlinear_gw_niftyreg",
144
145
-------
145
146
>>> from nipype.workflows.smri.niftyreg import create_nonlinear_gw_step
146
147
>>> nlc = create_nonlinear_gw_step('nonlinear_coreg') # doctest: +SKIP
147
- >>> nlc.inputs.inputspec.in_files = ['file1.nii.gz', 'file2.nii.gz'] \
148
- # doctest: +SKIP
148
+ >>> nlc.inputs.inputspec.in_files = [
149
+ ... 'file1.nii.gz', 'file2.nii.gz'] # doctest: +SKIP
149
150
>>> nlc.inputs.inputspec.ref_file = ['ref.nii.gz'] # doctest: +SKIP
150
151
>>> nlc.run() # doctest: +SKIP
151
152
@@ -246,6 +247,7 @@ def create_groupwise_average(name="atlas_creation",
246
247
non-linear components.
247
248
248
249
Inputs::
250
+
249
251
inputspec.in_files - The input files to be registered
250
252
inputspec.ref_file - The initial reference image that the input files
251
253
are registered to
@@ -258,12 +260,14 @@ def create_groupwise_average(name="atlas_creation",
258
260
outputspec.average_image - The average image
259
261
outputspec.cpp_files - The bspline transformation files
260
262
263
+
261
264
Example
262
265
-------
266
+
263
267
>>> from nipype.workflows.smri.niftyreg import create_groupwise_average
264
268
>>> node = create_groupwise_average('groupwise_av') # doctest: +SKIP
265
- >>> node.inputs.inputspec.in_files = ['file1.nii.gz', 'file2.nii.gz'] \
266
- # doctest: +SKIP
269
+ >>> node.inputs.inputspec.in_files = [
270
+ ... 'file1.nii.gz', 'file2.nii.gz'] # doctest: +SKIP
267
271
>>> node.inputs.inputspec.ref_file = ['ref.nii.gz'] # doctest: +SKIP
268
272
>>> node.inputs.inputspec.rmask_file = ['mask.nii.gz'] # doctest: +SKIP
269
273
>>> node.run() # doctest: +SKIP
@@ -384,3 +388,4 @@ def create_groupwise_average(name="atlas_creation",
384
388
])
385
389
386
390
return workflow
391
+
0 commit comments