@@ -230,36 +230,39 @@ def init_anat_reports_wf(*, spaces, freesurfer, output_dir, sloppy=False, name='
230
230
231
231
def init_ds_template_wf (
232
232
* ,
233
- num_t1w ,
234
- output_dir ,
235
- name = 'ds_template_wf' ,
233
+ num_anat : int ,
234
+ output_dir : str ,
235
+ image_type : str = 'T1w' ,
236
+ name : str = 'ds_template_wf' ,
236
237
):
237
238
"""
238
239
Save the subject-specific template
239
240
240
241
Parameters
241
242
----------
242
- num_t1w : :obj:`int`
243
- Number of T1w images
243
+ num_anat : :obj:`int`
244
+ Number of anatomical images
244
245
output_dir : :obj:`str`
245
246
Directory in which to save derivatives
247
+ image_type
248
+ MR image type (T1w, T2w, etc.)
246
249
name : :obj:`str`
247
250
Workflow name (default: ds_template_wf)
248
251
249
252
Inputs
250
253
------
251
254
source_files
252
- List of input T1w images
253
- t1w_ref_xfms
254
- List of affine transforms to realign input T1w images
255
- t1w_preproc
256
- The T1w reference map, which is calculated as the average of bias-corrected
257
- and preprocessed T1w images, defining the anatomical space.
255
+ List of input anatomical images
256
+ anat_ref_xfms
257
+ List of affine transforms to realign input anatomical images
258
+ anat_preproc
259
+ The anatomical reference map, which is calculated as the average of bias-corrected
260
+ and preprocessed anatomical images, defining the anatomical space.
258
261
259
262
Outputs
260
263
-------
261
- t1w_preproc
262
- The location in the output directory of the preprocessed T1w image
264
+ anat_preproc
265
+ The location in the output directory of the preprocessed anatomical image
263
266
264
267
"""
265
268
workflow = Workflow (name = name )
@@ -268,49 +271,49 @@ def init_ds_template_wf(
268
271
niu .IdentityInterface (
269
272
fields = [
270
273
'source_files' ,
271
- 't1w_ref_xfms ' ,
272
- 't1w_preproc ' ,
274
+ 'anat_ref_xfms ' ,
275
+ 'anat_preproc ' ,
273
276
]
274
277
),
275
278
name = 'inputnode' ,
276
279
)
277
- outputnode = pe .Node (niu .IdentityInterface (fields = ['t1w_preproc ' ]), name = 'outputnode' )
280
+ outputnode = pe .Node (niu .IdentityInterface (fields = ['anat_preproc ' ]), name = 'outputnode' )
278
281
279
- ds_t1w_preproc = pe .Node (
282
+ ds_anat_preproc = pe .Node (
280
283
DerivativesDataSink (base_directory = output_dir , desc = 'preproc' , compress = True ),
281
- name = 'ds_t1w_preproc ' ,
284
+ name = 'ds_anat_preproc ' ,
282
285
run_without_submitting = True ,
283
286
)
284
- ds_t1w_preproc .inputs .SkullStripped = False
287
+ ds_anat_preproc .inputs .SkullStripped = False
285
288
286
289
# fmt:off
287
290
workflow .connect ([
288
- (inputnode , ds_t1w_preproc , [('t1w_preproc ' , 'in_file' ),
291
+ (inputnode , ds_anat_preproc , [('anat_preproc ' , 'in_file' ),
289
292
('source_files' , 'source_file' )]),
290
- (ds_t1w_preproc , outputnode , [('out_file' , 't1w_preproc ' )]),
293
+ (ds_anat_preproc , outputnode , [('out_file' , 'anat_preproc ' )]),
291
294
])
292
295
# fmt:on
293
296
294
- if num_t1w > 1 :
297
+ if num_anat > 1 :
295
298
# Please note the dictionary unpacking to provide the from argument.
296
299
# It is necessary because from is a protected keyword (not allowed as argument name).
297
- ds_t1w_ref_xfms = pe .MapNode (
300
+ ds_anat_ref_xfms = pe .MapNode (
298
301
DerivativesDataSink (
299
302
base_directory = output_dir ,
300
- to = 'T1w' ,
303
+ to = image_type ,
301
304
mode = 'image' ,
302
305
suffix = 'xfm' ,
303
306
extension = 'txt' ,
304
307
** {'from' : 'orig' },
305
308
),
306
309
iterfield = ['source_file' , 'in_file' ],
307
- name = 'ds_t1w_ref_xfms ' ,
310
+ name = 'ds_anat_ref_xfms ' ,
308
311
run_without_submitting = True ,
309
312
)
310
313
# fmt:off
311
314
workflow .connect ([
312
- (inputnode , ds_t1w_ref_xfms , [('source_files' , 'source_file' ),
313
- ( 't1w_ref_xfms ' , 'in_file' )]),
315
+ (inputnode , ds_anat_ref_xfms , [('source_files' , 'source_file' ),
316
+ ( 'anat_ref_xfms ' , 'in_file' )]),
314
317
])
315
318
# fmt:on
316
319
0 commit comments