@@ -416,63 +416,52 @@ def _list_outputs(self):
416
416
417
417
outputs ["tissue_class_map" ] = self ._gen_fname (suffix = "_seg" , ** _gen_fname_opts )
418
418
if self .inputs .segments :
419
- outputs ["tissue_class_files" ] = []
420
- for i in range (nclasses ):
421
- outputs ["tissue_class_files" ].append (
422
- self ._gen_fname (suffix = "_seg_%d" % i , ** _gen_fname_opts )
423
- )
419
+ outputs ["tissue_class_files" ] = [
420
+ self ._gen_fname (suffix = f"_seg_{ i } " , ** _gen_fname_opts )
421
+ for i in range (nclasses )
422
+ ]
424
423
if isdefined (self .inputs .output_biascorrected ):
425
- outputs ["restored_image" ] = []
426
424
if len (self .inputs .in_files ) > 1 :
427
425
# for multi-image segmentation there is one corrected image
428
426
# per input
429
- for val , f in enumerate (self .inputs .in_files ):
430
- # image numbering is 1-based
431
- outputs ["restored_image" ].append (
432
- self ._gen_fname (
433
- suffix = "_restore_%d" % (val + 1 ), ** _gen_fname_opts
434
- )
435
- )
427
+ outputs ["restored_image" ] = [
428
+ self ._gen_fname (suffix = f"_restore_{ i } " , ** _gen_fname_opts )
429
+ for i in range (1 , len (self .inputs .in_files ) + 1 )
430
+ ]
436
431
else :
437
432
# single image segmentation has unnumbered output image
438
- outputs ["restored_image" ]. append (
433
+ outputs ["restored_image" ] = [
439
434
self ._gen_fname (suffix = "_restore" , ** _gen_fname_opts )
440
- )
435
+ ]
441
436
442
437
outputs ["mixeltype" ] = self ._gen_fname (suffix = "_mixeltype" , ** _gen_fname_opts )
443
438
if not self .inputs .no_pve :
444
439
outputs ["partial_volume_map" ] = self ._gen_fname (
445
440
suffix = "_pveseg" , ** _gen_fname_opts
446
441
)
447
- outputs ["partial_volume_files" ] = []
448
- for i in range (nclasses ):
449
- outputs ["partial_volume_files" ].append (
450
- self ._gen_fname (suffix = "_pve_%d" % i , ** _gen_fname_opts )
451
- )
442
+ outputs ["partial_volume_files" ] = [
443
+ self ._gen_fname (suffix = f"_pve_{ i } " , ** _gen_fname_opts )
444
+ for i in range (nclasses )
445
+ ]
452
446
if self .inputs .output_biasfield :
453
- outputs ["bias_field" ] = []
454
447
if len (self .inputs .in_files ) > 1 :
455
448
# for multi-image segmentation there is one bias field image
456
449
# per input
457
- for val , f in enumerate (self .inputs .in_files ):
458
- # image numbering is 1-based
459
- outputs ["bias_field" ].append (
460
- self ._gen_fname (
461
- suffix = "_bias_%d" % (val + 1 ), ** _gen_fname_opts
462
- )
463
- )
450
+ outputs ["bias_field" ] = [
451
+ self ._gen_fname (suffix = f"_bias_{ i } " , ** _gen_fname_opts )
452
+ for i in range (1 , len (self .inputs .in_files ) + 1 )
453
+ ]
464
454
else :
465
455
# single image segmentation has unnumbered output image
466
- outputs ["bias_field" ]. append (
456
+ outputs ["bias_field" ] = [
467
457
self ._gen_fname (suffix = "_bias" , ** _gen_fname_opts )
468
- )
458
+ ]
469
459
470
460
if self .inputs .probability_maps :
471
- outputs ["probability_maps" ] = []
472
- for i in range (nclasses ):
473
- outputs ["probability_maps" ].append (
474
- self ._gen_fname (suffix = "_prob_%d" % i , ** _gen_fname_opts )
475
- )
461
+ outputs ["probability_maps" ] = [
462
+ self ._gen_fname (suffix = "_prob_{i}" , ** _gen_fname_opts )
463
+ for i in range (nclasses )
464
+ ]
476
465
return outputs
477
466
478
467
0 commit comments