@@ -51,17 +51,7 @@ def anat_qc_workflow(
51
51
wf_inputs_metadata = None ,
52
52
wf_species = "human" ,
53
53
wf_template_id = "MNI152NLin2009cAsym" ,
54
- ) -> [
55
- "ty.Any" ,
56
- "ty.Any" ,
57
- "ty.Any" ,
58
- "ty.Any" ,
59
- "ty.Any" ,
60
- "ty.Any" ,
61
- "ty.Any" ,
62
- "ty.Any" ,
63
- "ty.Any" ,
64
- ]:
54
+ ) -> tuple [ty .Any , ty .Any , ty .Any , ty .Any , ty .Any , ty .Any , ty .Any , ty .Any , ty .Any ]:
65
55
"""
66
56
One-subject-one-session-one-run pipeline to extract the NR-IQMs from
67
57
anatomical images
@@ -151,10 +141,10 @@ def anat_qc_workflow(
151
141
norm = workflow .add (
152
142
spatial_normalization (
153
143
wf_species = wf_species ,
144
+ nipype_omp_nthreads = nipype_omp_nthreads ,
154
145
wf_template_id = wf_template_id ,
155
146
exec_ants_float = exec_ants_float ,
156
147
exec_debug = exec_debug ,
157
- nipype_omp_nthreads = nipype_omp_nthreads ,
158
148
modality = modality ,
159
149
name = "norm" ,
160
150
)
@@ -196,9 +186,9 @@ def anat_qc_workflow(
196
186
# Reports
197
187
anat_report_wf = workflow .add (
198
188
init_anat_report_wf (
199
- wf_species = wf_species ,
200
189
exec_verbose_reports = exec_verbose_reports ,
201
190
exec_work_dir = exec_work_dir ,
191
+ wf_species = wf_species ,
202
192
in_ras = to_ras .out_file ,
203
193
headmask = hmsk .out_file ,
204
194
airmask = amw .air_mask ,
@@ -235,12 +225,12 @@ def anat_qc_workflow(
235
225
# fmt: on
236
226
outputs_ ["norm_report" ] = norm .report
237
227
outputs_ ["iqmswf_noise_report" ] = iqmswf .noise_report
228
+ outputs_ ["anat_report_wf_airmask_report" ] = anat_report_wf .airmask_report
229
+ outputs_ ["anat_report_wf_bg_report" ] = anat_report_wf .bg_report
238
230
outputs_ ["anat_report_wf_bmask_report" ] = anat_report_wf .bmask_report
239
231
outputs_ ["anat_report_wf_artmask_report" ] = anat_report_wf .artmask_report
240
- outputs_ ["anat_report_wf_headmask_report" ] = anat_report_wf .headmask_report
241
- outputs_ ["anat_report_wf_bg_report" ] = anat_report_wf .bg_report
242
- outputs_ ["anat_report_wf_airmask_report" ] = anat_report_wf .airmask_report
243
232
outputs_ ["anat_report_wf_zoom_report" ] = anat_report_wf .zoom_report
233
+ outputs_ ["anat_report_wf_headmask_report" ] = anat_report_wf .headmask_report
244
234
outputs_ ["anat_report_wf_segm_report" ] = anat_report_wf .segm_report
245
235
246
236
return tuple (outputs_ )
@@ -252,7 +242,7 @@ def airmsk_wf(
252
242
in_file : ty .Any = attrs .NOTHING ,
253
243
ind2std_xfm : ty .Any = attrs .NOTHING ,
254
244
name = "AirMaskWorkflow" ,
255
- ) -> [ " ty.Any" , " ty.Any" , " ty.Any" , " ty.Any" ]:
245
+ ) -> tuple [ ty .Any , ty .Any , ty .Any , ty .Any ]:
256
246
"""
257
247
Calculate air, artifacts and "hat" masks to evaluate noise in the background.
258
248
@@ -314,7 +304,7 @@ def headmsk_wf(
314
304
name = "HeadMaskWorkflow" ,
315
305
omp_nthreads = 1 ,
316
306
wf_species = "human" ,
317
- ) -> [ " ty.Any" , " ty.Any" ]:
307
+ ) -> tuple [ ty .Any , ty .Any ]:
318
308
"""
319
309
Computes a head mask as in [Mortamet2009]_.
320
310
@@ -337,56 +327,32 @@ def _select_wm(inlist):
337
327
return [f for f in inlist if "WM" in f ][0 ]
338
328
339
329
enhance = workflow .add (
340
- FunctionTask (
341
- func = _enhance ,
342
- input_spec = SpecInfo (
343
- name = "FunctionIn" ,
344
- bases = (BaseSpec ,),
345
- fields = [("in_file" , ty .Any ), ("wm_tpm" , ty .Any )],
346
- ),
347
- output_spec = SpecInfo (
348
- name = "FunctionOut" , bases = (BaseSpec ,), fields = [("out_file" , ty .Any )]
349
- ),
350
- in_file = in_file ,
351
- wm_tpm = in_tpms ,
352
- ),
330
+ python .define (
331
+ _enhance ,
332
+ inputs = {"in_file" : ty .Any , "wm_tpm" : ty .Any },
333
+ outputs = {"out_file" : ty .Any },
334
+ )(in_file = in_file , wm_tpm = in_tpms ),
353
335
name = "enhance" ,
354
336
)
355
337
gradient = workflow .add (
356
- FunctionTask (
357
- func = image_gradient ,
358
- input_spec = SpecInfo (
359
- name = "FunctionIn" ,
360
- bases = (BaseSpec ,),
361
- fields = [("in_file" , ty .Any ), ("brainmask" , ty .Any ), ("sigma" , ty .Any )],
362
- ),
363
- output_spec = SpecInfo (
364
- name = "FunctionOut" , bases = (BaseSpec ,), fields = [("out_file" , ty .Any )]
365
- ),
366
- brainmask = brainmask ,
367
- in_file = enhance .out_file ,
368
- ),
338
+ python .define (
339
+ image_gradient ,
340
+ inputs = {"in_file" : ty .Any , "brainmask" : ty .Any , "sigma" : ty .Any },
341
+ outputs = {"out_file" : ty .Any },
342
+ )(brainmask = brainmask , in_file = enhance .out_file ),
369
343
name = "gradient" ,
370
344
)
371
345
thresh = workflow .add (
372
- FunctionTask (
373
- func = gradient_threshold ,
374
- input_spec = SpecInfo (
375
- name = "FunctionIn" ,
376
- bases = (BaseSpec ,),
377
- fields = [
378
- ("in_file" , ty .Any ),
379
- ("brainmask" , ty .Any ),
380
- ("aniso" , ty .Any ),
381
- ("thresh" , ty .Any ),
382
- ],
383
- ),
384
- output_spec = SpecInfo (
385
- name = "FunctionOut" , bases = (BaseSpec ,), fields = [("out_file" , ty .Any )]
386
- ),
387
- brainmask = brainmask ,
388
- in_file = gradient .out_file ,
389
- ),
346
+ python .define (
347
+ gradient_threshold ,
348
+ inputs = {
349
+ "in_file" : ty .Any ,
350
+ "brainmask" : ty .Any ,
351
+ "aniso" : ty .Any ,
352
+ "thresh" : ty .Any ,
353
+ },
354
+ outputs = {"out_file" : ty .Any },
355
+ )(brainmask = brainmask , in_file = gradient .out_file ),
390
356
name = "thresh" ,
391
357
)
392
358
if wf_species != "human" :
@@ -412,7 +378,7 @@ def init_brain_tissue_segmentation(
412
378
name = "brain_tissue_segmentation" ,
413
379
nipype_omp_nthreads = 12 ,
414
380
std_tpms : ty .Any = attrs .NOTHING ,
415
- ) -> [ " ty.Any" , " ty.Any" ]:
381
+ ) -> tuple [ ty .Any , ty .Any ]:
416
382
"""
417
383
Setup a workflow for brain tissue segmentation.
418
384
@@ -454,15 +420,12 @@ def _format_tpm_names(in_files, fname_string=None):
454
420
return file_format , out_files
455
421
456
422
format_tpm_names = workflow .add (
457
- FunctionTask (
423
+ python .define (
424
+ _format_tpm_names ,
425
+ inputs = {"in_files" : ty .Any },
426
+ outputs = {"file_format" : ty .Any },
427
+ )(
458
428
execution = {"keep_inputs" : True , "remove_unnecessary_outputs" : False },
459
- func = _format_tpm_names ,
460
- input_spec = SpecInfo (
461
- name = "FunctionIn" , bases = (BaseSpec ,), fields = [("in_files" , ty .Any )]
462
- ),
463
- output_spec = SpecInfo (
464
- name = "FunctionOut" , bases = (BaseSpec ,), fields = [("file_format" , ty .Any )]
465
- ),
466
429
in_files = std_tpms ,
467
430
),
468
431
name = "format_tpm_names" ,
@@ -510,7 +473,7 @@ def spatial_normalization(
510
473
nipype_omp_nthreads = 12 ,
511
474
wf_species = "human" ,
512
475
wf_template_id = "MNI152NLin2009cAsym" ,
513
- ) -> [ " ty.Any" , " ty.Any" , " ty.Any" ]:
476
+ ) -> tuple [ ty .Any , ty .Any , ty .Any ]:
514
477
"""Create a simplified workflow to perform fast spatial normalization."""
515
478
from pydra .tasks .niworkflows .interfaces .reportlets .registration import (
516
479
SpatialNormalizationRPT as RobustMNINormalization ,
@@ -595,7 +558,7 @@ def compute_iqms(
595
558
segmentation : ty .Any = attrs .NOTHING ,
596
559
std_tpms : ty .Any = attrs .NOTHING ,
597
560
wf_species = "human" ,
598
- ) -> [ " ty.Any" , " ty.Any" ]:
561
+ ) -> tuple [ ty .Any , ty .Any ]:
599
562
"""
600
563
Setup the workflow that actually computes the IQMs.
601
564
0 commit comments