Skip to content

Commit ad2312d

Browse files
committed
interface and node tests passed
1 parent 22945a8 commit ad2312d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nipype/interfaces/ants/segmentation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,19 +486,22 @@ def _format_arg(self, opt, spec, val):
486486
retval = '-t %s' %(val)
487487
return retval
488488
if opt == 'segmentation_priors':
489-
_, _, ext = split_filename(self.inputs.segmentation_priors[0])
490-
retval = "-p BrainSegmentationPrior%02d"
489+
priors_directory, _, ext = split_filename(self.inputs.segmentation_priors[0])
490+
retval = "-p %s/BrainSegmentationPrior%%02d" %(priors_directory)
491491
retval += ext
492492
return retval
493493
return super(ANTSCommand, self)._format_arg(opt, spec, val)
494494

495495
def _run_interface(self, runtime):
496+
priors_directory = os.path.join(os.getcwd(), "priors")
497+
if not os.path.exists(priors_directory):
498+
os.makedirs(priors_directory)
496499
_, _, ext = split_filename(self.inputs.segmentation_priors[0])
497500
for i, f in enumerate(self.inputs.segmentation_priors):
498-
target = os.path.join(os.getcwd(),
501+
target = os.path.join(priors_directory,
499502
'BrainSegmentationPrior%02d' % (i + 1) + ext)
500503
if not (os.path.exists(target) and os.path.realpath(target) == os.path.abspath(f)):
501-
copyfile(os.path.abspath(f), os.path.join(os.getcwd(),
504+
copyfile(os.path.abspath(f), os.path.join(priors_directory,
502505
'BrainSegmentationPrior%02d' % (i + 1) + ext))
503506
runtime = super(antsCorticalThickness, self)._run_interface(runtime)
504507
return runtime
@@ -522,15 +525,12 @@ def _list_outputs(self):
522525
'BrainSegmentationPosteriors01.' +
523526
self.inputs.image_suffix)
524527
outputs['BrainSegmentationPosteriorsGM'] = os.path.join(os.getcwd(),
525-
self.inputs.out_prefix +
526528
'BrainSegmentationPosteriors02.' +
527529
self.inputs.image_suffix)
528530
outputs['BrainSegmentationPosteriorsWM'] = os.path.join(os.getcwd(),
529-
self.inputs.out_prefix +
530531
'BrainSegmentationPosteriors03.' +
531532
self.inputs.image_suffix)
532533
outputs['BrainSegmentationPosteriorsDGM'] = os.path.join(os.getcwd(),
533-
self.inputs.out_prefix +
534534
'BrainSegmentationPosteriors04.' +
535535
self.inputs.image_suffix)
536536
outputs['CorticalThickness'] = os.path.join(os.getcwd(),

0 commit comments

Comments
 (0)