@@ -365,7 +365,7 @@ def _run_interface(self, runtime):
365
365
366
366
CONFORMATION_TEMPLATE = """\t \t <h3 class="elem-title">Anatomical Conformation</h3>
367
367
\t \t <ul class="elem-desc">
368
- \t \t \t <li>Input T1w images: {n_t1w }</li>
368
+ \t \t \t <li>Input {anat} images: {n_anat }</li>
369
369
\t \t \t <li>Output orientation: RAS</li>
370
370
\t \t \t <li>Output dimensions: {dims}</li>
371
371
\t \t \t <li>Output voxel size: {zooms}</li>
@@ -378,16 +378,23 @@ def _run_interface(self, runtime):
378
378
379
379
380
380
class _TemplateDimensionsInputSpec (BaseInterfaceInputSpec ):
381
+ anat_type = traits .Enum ("T1w" , "T2w" , usedefault = True , desc = "Anatomical image type" )
382
+ anat_list = InputMultiObject (
383
+ File (exists = True ), xor = "t1w_list" , desc = "input anatomical images"
384
+ )
381
385
t1w_list = InputMultiObject (
382
- File (exists = True ), mandatory = True , desc = "input T1w images"
386
+ xor = "anat_list" ,
387
+ deprecated = "1.14.0" ,
388
+ new_name = "anat_list" ,
383
389
)
384
390
max_scale = traits .Float (
385
391
3.0 , usedefault = True , desc = "Maximum scaling factor in images to accept"
386
392
)
387
393
388
394
389
395
class _TemplateDimensionsOutputSpec (TraitedSpec ):
390
- t1w_valid_list = OutputMultiObject (exists = True , desc = "valid T1w images" )
396
+ t1w_valid_list = OutputMultiObject (exists = True , deprecated = "1.14.0" , desc = "valid T1w images" )
397
+ anat_valid_list = OutputMultiObject (exists = True , desc = "valid anatomical images" )
391
398
target_zooms = traits .Tuple (
392
399
traits .Float , traits .Float , traits .Float , desc = "Target zoom information"
393
400
)
@@ -399,8 +406,8 @@ class _TemplateDimensionsOutputSpec(TraitedSpec):
399
406
400
407
class TemplateDimensions (SimpleInterface ):
401
408
"""
402
- Finds template target dimensions for a series of T1w images, filtering low-resolution images,
403
- if necessary.
409
+ Finds template target dimensions for a series of anatomical images, filtering low-resolution
410
+ images, if necessary.
404
411
405
412
Along each axis, the minimum voxel size (zoom) and the maximum number of voxels (shape) are
406
413
found across images.
@@ -426,7 +433,8 @@ def _generate_segment(self, discards, dims, zooms):
426
433
)
427
434
zoom_fmt = "{:.02g}mm x {:.02g}mm x {:.02g}mm" .format (* zooms )
428
435
return CONFORMATION_TEMPLATE .format (
429
- n_t1w = len (self .inputs .t1w_list ),
436
+ anat = self .inputs .anat_type ,
437
+ n_anat = len (self .inputs .anat_list ),
430
438
dims = "x" .join (map (str , dims )),
431
439
zooms = zoom_fmt ,
432
440
n_discards = len (discards ),
@@ -435,7 +443,10 @@ def _generate_segment(self, discards, dims, zooms):
435
443
436
444
def _run_interface (self , runtime ):
437
445
# Load images, orient as RAS, collect shape and zoom data
438
- in_names = np .array (self .inputs .t1w_list )
446
+ if not self .inputs .anat_list : # Deprecate: 1.14.0
447
+ self .inputs .anat_list = self .inputs .t1w_list
448
+
449
+ in_names = np .array (self .inputs .anat_list )
439
450
orig_imgs = np .vectorize (nb .load )(in_names )
440
451
reoriented = np .vectorize (nb .as_closest_canonical )(orig_imgs )
441
452
all_zooms = np .array ([img .header .get_zooms ()[:3 ] for img in reoriented ])
@@ -452,7 +463,8 @@ def _run_interface(self, runtime):
452
463
453
464
# Ignore dropped images
454
465
valid_fnames = np .atleast_1d (in_names [valid ]).tolist ()
455
- self ._results ["t1w_valid_list" ] = valid_fnames
466
+ self ._results ["anat_valid_list" ] = valid_fnames
467
+ self ._results ["t1w_valid_list" ] = valid_fnames # Deprecate: 1.14.0
456
468
457
469
# Set target shape information
458
470
target_zooms = all_zooms [valid ].min (axis = 0 )
0 commit comments