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