@@ -365,7 +365,7 @@ def _run_interface(self, runtime):
365365
366366CONFORMATION_TEMPLATE = """\t \t <h3 class="elem-title">Anatomical Conformation</h3>
367367\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>
369369\t \t \t <li>Output orientation: RAS</li>
370370\t \t \t <li>Output dimensions: {dims}</li>
371371\t \t \t <li>Output voxel size: {zooms}</li>
@@ -378,8 +378,15 @@ def _run_interface(self, runtime):
378378
379379
380380class _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+ )
381385 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" ,
383390 )
384391 max_scale = traits .Float (
385392 3.0 , usedefault = True , desc = "Maximum scaling factor in images to accept"
@@ -388,6 +395,7 @@ class _TemplateDimensionsInputSpec(BaseInterfaceInputSpec):
388395
389396class _TemplateDimensionsOutputSpec (TraitedSpec ):
390397 t1w_valid_list = OutputMultiObject (exists = True , desc = "valid T1w images" )
398+ anat_valid_list = OutputMultiObject (exists = True , desc = "valid anatomical images" )
391399 target_zooms = traits .Tuple (
392400 traits .Float , traits .Float , traits .Float , desc = "Target zoom information"
393401 )
@@ -399,8 +407,8 @@ class _TemplateDimensionsOutputSpec(TraitedSpec):
399407
400408class TemplateDimensions (SimpleInterface ):
401409 """
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.
404412
405413 Along each axis, the minimum voxel size (zoom) and the maximum number of voxels (shape) are
406414 found across images.
@@ -426,7 +434,8 @@ def _generate_segment(self, discards, dims, zooms):
426434 )
427435 zoom_fmt = "{:.02g}mm x {:.02g}mm x {:.02g}mm" .format (* zooms )
428436 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 ),
430439 dims = "x" .join (map (str , dims )),
431440 zooms = zoom_fmt ,
432441 n_discards = len (discards ),
@@ -435,7 +444,10 @@ def _generate_segment(self, discards, dims, zooms):
435444
436445 def _run_interface (self , runtime ):
437446 # 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 )
439451 orig_imgs = np .vectorize (nb .load )(in_names )
440452 reoriented = np .vectorize (nb .as_closest_canonical )(orig_imgs )
441453 all_zooms = np .array ([img .header .get_zooms ()[:3 ] for img in reoriented ])
@@ -452,7 +464,8 @@ def _run_interface(self, runtime):
452464
453465 # Ignore dropped images
454466 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
456469
457470 # Set target shape information
458471 target_zooms = all_zooms [valid ].min (axis = 0 )
0 commit comments