@@ -56,7 +56,7 @@ def diffeomorphic_tensor_pipeline(name='DiffeoTen',
56
56
Note: the requirements for a diffeomorphic registration specify that
57
57
the dimension 0 is a power of 2 so images are resliced prior to
58
58
registration. Remember to move origin and reslice prior to applying xfm to
59
- another file
59
+ another file!
60
60
61
61
Example
62
62
-------
@@ -135,3 +135,45 @@ def diffeomorphic_tensor_pipeline(name='DiffeoTen',
135
135
wf .connect (reslice_node_moving , 'out_file' , outputnode , 'moving_resliced' )
136
136
137
137
return wf
138
+
139
+
140
+ def apply_diffeo (name = 'ApplyDiffeo' , params = {'array_size' : (128 , 128 , 64 )}):
141
+
142
+ """
143
+ Workflow that applies a dtitk diffeomorphic registration to a scalar volume
144
+ by moving the origin and reslicing, then applying the transform.
145
+
146
+ Example
147
+ -------
148
+
149
+ >>> from nipype.workflows.dmri.dtitk.tensor_registration import apply_diffeo
150
+ >>> app_diffeo = diffeomorphic_tensor_pipeline()
151
+ >>> app_diffeo.inputs.inputnode.moving_file = 'im1.nii'
152
+ >>> app_diffeo.inputs.inputnode.xfm_file = 'im_warp.df.nii'
153
+ >>> app_diffeo.run() # doctest: +SKIP
154
+
155
+
156
+ """
157
+ inputnode = pe .Node (niu .IdentityInterface (
158
+ fields = ['moving_file' , 'xfm_file' ]),
159
+ name = 'inputnode' )
160
+ outputnode = pe .Node (niu .IdentityInterface (
161
+ fields = ['out_file' ]),
162
+ name = 'outputnode' )
163
+ origin_node = pe .Node (dtitk .TVAdjustVoxSp (origin = (0 , 0 , 0 )),
164
+ name = 'origin_node' )
165
+ reslice_node_pow2 = pe .Node (dtitk .TVResample (
166
+ origin = (0 , 0 , 0 ),
167
+ array_size = params ['array_size' ]),
168
+ name = 'reslice_node_pow2' )
169
+ apply_xfm_node = pe .Node (dtitk .DiffeoScalarVol (), name = 'apply_xfm_node' )
170
+
171
+ wf = pe .Workflow (name = name )
172
+
173
+ wf .connect (inputnode , 'moving_file' , origin_node , 'in_file' )
174
+ wf .connect (origin_node , 'out_file' , reslice_node_pow2 , 'in_file' )
175
+ wf .connect (reslice_node_pow2 , 'out_file' , apply_xfm_node , 'in_file' )
176
+ wf .connect (inputnode , 'xfm_file' , apply_xfm_node , 'transform' )
177
+ wf .connect (apply_xfm_node , 'out_file' , outputnode , 'out_file' )
178
+
179
+ return wf
0 commit comments