@@ -486,19 +486,22 @@ def _format_arg(self, opt, spec, val):
486
486
retval = '-t %s' % (val )
487
487
return retval
488
488
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 )
491
491
retval += ext
492
492
return retval
493
493
return super (ANTSCommand , self )._format_arg (opt , spec , val )
494
494
495
495
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 )
496
499
_ , _ , ext = split_filename (self .inputs .segmentation_priors [0 ])
497
500
for i , f in enumerate (self .inputs .segmentation_priors ):
498
- target = os .path .join (os . getcwd () ,
501
+ target = os .path .join (priors_directory ,
499
502
'BrainSegmentationPrior%02d' % (i + 1 ) + ext )
500
503
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 ,
502
505
'BrainSegmentationPrior%02d' % (i + 1 ) + ext ))
503
506
runtime = super (antsCorticalThickness , self )._run_interface (runtime )
504
507
return runtime
@@ -522,15 +525,12 @@ def _list_outputs(self):
522
525
'BrainSegmentationPosteriors01.' +
523
526
self .inputs .image_suffix )
524
527
outputs ['BrainSegmentationPosteriorsGM' ] = os .path .join (os .getcwd (),
525
- self .inputs .out_prefix +
526
528
'BrainSegmentationPosteriors02.' +
527
529
self .inputs .image_suffix )
528
530
outputs ['BrainSegmentationPosteriorsWM' ] = os .path .join (os .getcwd (),
529
- self .inputs .out_prefix +
530
531
'BrainSegmentationPosteriors03.' +
531
532
self .inputs .image_suffix )
532
533
outputs ['BrainSegmentationPosteriorsDGM' ] = os .path .join (os .getcwd (),
533
- self .inputs .out_prefix +
534
534
'BrainSegmentationPosteriors04.' +
535
535
self .inputs .image_suffix )
536
536
outputs ['CorticalThickness' ] = os .path .join (os .getcwd (),
0 commit comments