@@ -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,16 +378,23 @@ 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+ xor = "anat_list" ,
387+ deprecated = "1.14.0" ,
388+ new_name = "anat_list" ,
383389 )
384390 max_scale = traits .Float (
385391 3.0 , usedefault = True , desc = "Maximum scaling factor in images to accept"
386392 )
387393
388394
389395class _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" )
391398 target_zooms = traits .Tuple (
392399 traits .Float , traits .Float , traits .Float , desc = "Target zoom information"
393400 )
@@ -399,8 +406,8 @@ class _TemplateDimensionsOutputSpec(TraitedSpec):
399406
400407class TemplateDimensions (SimpleInterface ):
401408 """
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.
404411
405412 Along each axis, the minimum voxel size (zoom) and the maximum number of voxels (shape) are
406413 found across images.
@@ -426,7 +433,8 @@ def _generate_segment(self, discards, dims, zooms):
426433 )
427434 zoom_fmt = "{:.02g}mm x {:.02g}mm x {:.02g}mm" .format (* zooms )
428435 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 ),
430438 dims = "x" .join (map (str , dims )),
431439 zooms = zoom_fmt ,
432440 n_discards = len (discards ),
@@ -435,7 +443,10 @@ def _generate_segment(self, discards, dims, zooms):
435443
436444 def _run_interface (self , runtime ):
437445 # 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 )
439450 orig_imgs = np .vectorize (nb .load )(in_names )
440451 reoriented = np .vectorize (nb .as_closest_canonical )(orig_imgs )
441452 all_zooms = np .array ([img .header .get_zooms ()[:3 ] for img in reoriented ])
@@ -452,7 +463,8 @@ def _run_interface(self, runtime):
452463
453464 # Ignore dropped images
454465 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
456468
457469 # Set target shape information
458470 target_zooms = all_zooms [valid ].min (axis = 0 )
0 commit comments