Skip to content

Commit cf48cbd

Browse files
oestebaneffigies
andauthored
Apply suggestions from code review
Co-Authored-By: Chris Markiewicz <effigies@gmail.com>
1 parent dffcb78 commit cf48cbd

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

nipype/interfaces/ants/segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AtroposInputSpec(ANTSCommandInputSpec):
3535
prior_image = traits.Either(
3636
File(exists=True),
3737
traits.Str,
38-
desc="either a string pattern (e.g., 'prior%%02d.nii') or an existing vector-image file.",
38+
desc="either a string pattern (e.g., 'prior%02d.nii') or an existing vector-image file.",
3939
)
4040
number_of_tissue_classes = traits.Int(mandatory=True)
4141
prior_weighting = traits.Float()

nipype/interfaces/ants/utils.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""ANTs' utilities."""
22
import os
33
from ...utils.imagemanip import copy_header as _copy_header
4-
from ..base import traits, isdefined, TraitedSpec, File, Str, InputMultiPath
4+
from ..base import traits, isdefined, TraitedSpec, File, Str, InputMultiObject
55
from .base import ANTSCommandInputSpec, ANTSCommand
66

77

@@ -400,11 +400,10 @@ class AI(ANTSCommand):
400400
'antsAI -c [10,1e-06,10] -d 3 -m Mattes[structural.nii,epi.nii,32,Regular,1]
401401
-o initialization.mat -p 0 -s [20,0.12] -t Affine[0.1] -v 0'
402402
403-
>>> AI(
404-
... fixed_image='structural.nii',
405-
... moving_image='epi.nii',
406-
... metric=('Mattes', 32, 'Regular', 1),
407-
... search_grid=(12, (1, 1, 1)),
403+
>>> AI(fixed_image='structural.nii',
404+
... moving_image='epi.nii',
405+
... metric=('Mattes', 32, 'Regular', 1),
406+
... search_grid=(12, (1, 1, 1)),
408407
... ).cmdline
409408
'antsAI -c [10,1e-06,10] -d 3 -m Mattes[structural.nii,epi.nii,32,Regular,1]
410409
-o initialization.mat -p 0 -s [20,0.12] -g [12.0,1x1x1] -t Affine[0.1] -v 0'
@@ -418,15 +417,11 @@ class AI(ANTSCommand):
418417
def _run_interface(self, runtime, correct_return_codes=(0,)):
419418
runtime = super(AI, self)._run_interface(runtime, correct_return_codes)
420419

421-
setattr(
422-
self,
423-
"_output",
424-
{
425-
"output_transform": os.path.join(
426-
runtime.cwd, os.path.basename(self.inputs.output_transform)
427-
)
428-
},
429-
)
420+
self._output = {
421+
"output_transform": os.path.join(
422+
runtime.cwd, os.path.basename(self.inputs.output_transform)
423+
)
424+
}
430425
return runtime
431426

432427
def _format_arg(self, opt, spec, val):
@@ -439,8 +434,7 @@ def _format_arg(self, opt, spec, val):
439434
return spec.argstr % val
440435

441436
if opt == "search_grid":
442-
val1 = "x".join(["%g" % v for v in val[1]])
443-
fmtval = "[%s]" % ",".join([str(val[0]), val1])
437+
fmtval = "[%s,%s]" % (val[0], "x".join("%g" % v for v in val[1]))
444438
return spec.argstr % fmtval
445439

446440
if opt == "fixed_image_mask":

0 commit comments

Comments
 (0)