@@ -447,16 +447,17 @@ class antsCorticalThicknessoutputSpec(TraitedSpec):
447447 BrainExtractionMask = File (exists = True , desc = 'brain extraction mask' )
448448 BrainSegmentation = File (exists = True , desc = 'brain segmentaion image' )
449449 BrainSegmentationN4 = File (exists = True , desc = 'N4 corrected image' )
450- BrainSegmentationPosteriorsCSF = File (exists = True , desc = 'CSF posterior probability image' )
451- BrainSegmentationPosteriorsGM = File (exists = True , desc = 'GM posterior probability image' )
452- BrainSegmentationPosteriorsWM = File (exists = True , desc = 'WM posterior probability image' )
453- BrainSegmentationPosteriorsDGM = File (exists = True , desc = 'DGM posterior probability image' )
450+ BrainSegmentationPosteriors = OutputMultiPath (File (exists = True ),
451+ desc = 'Posterior probability images' )
454452 CorticalThickness = File (exists = True , desc = 'cortical thickness file' )
455453 TemplateToSubject1GenericAffine = File (exists = True , desc = 'Template to subject affine' )
456454 TemplateToSubject0Warp = File (exists = True , desc = 'Template to subject warp' )
457455 SubjectToTemplate1Warp = File (exists = True , desc = 'Template to subject inverse warp' )
458456 SubjectToTemplate0GenericAffine = File (exists = True , desc = 'Template to subject inverse affine' )
459- TemplateToSubjectLogJacobian = File (exists = True , desc = 'Template to subject log jacobian' )
457+ SubjectToTemplateLogJacobian = File (exists = True , desc = 'Template to subject log jacobian' )
458+ CorticalThicknessNormedToTemplate = File (exists = True ,
459+ desc = 'Normalized cortical thickness' )
460+ BrainVolumes = File (exists = True , desc = 'Brain volumes as text' )
460461
461462
462463class antsCorticalThickness (ANTSCommand ):
@@ -472,7 +473,7 @@ class antsCorticalThickness(ANTSCommand):
472473 >>> corticalthickness.inputs.segmentation_priors = ['BrainSegmentationPrior01.nii.gz', 'BrainSegmentationPrior02.nii.gz', 'BrainSegmentationPrior03.nii.gz', 'BrainSegmentationPrior04.nii.gz']
473474 >>> corticalthickness.inputs.t1_registration_template = 'brain_study_template.nii.gz'
474475 >>> corticalthickness.cmdline
475- 'antsCorticalThickness.sh -a T1.nii.gz -m ProbabilityMaskOfStudyTemplate.nii.gz -e study_template.nii.gz -d 3 -s nii.gz -o antsCT_ -p BrainSegmentationPrior%02d.nii.gz -t brain_study_template.nii.gz'
476+ 'antsCorticalThickness.sh -a T1.nii.gz -m ProbabilityMaskOfStudyTemplate.nii.gz -e study_template.nii.gz -d 3 -s nii.gz -o antsCT_ -p nipype_priors/ BrainSegmentationPrior%02d.nii.gz -t brain_study_template.nii.gz'
476477 """
477478
478479 input_spec = antsCorticalThicknessInputSpec
@@ -496,25 +497,20 @@ def _format_arg(self, opt, spec, val):
496497 retval = '-t %s' % val
497498 return retval
498499 if opt == 'segmentation_priors' :
499- priors_directory , _ , ext = split_filename (self .inputs .segmentation_priors [0 ])
500- if priors_directory is not '' :
501- retval = "-p %s/BrainSegmentationPrior%%02d" % priors_directory
502- else :
503- retval = "-p BrainSegmentationPrior%02d"
504- retval += ext
500+ _ , _ , ext = split_filename (self .inputs .segmentation_priors [0 ])
501+ retval = "-p nipype_priors/BrainSegmentationPrior%02d" + ext
505502 return retval
506503 return super (ANTSCommand , self )._format_arg (opt , spec , val )
507504
508505 def _run_interface (self , runtime , correct_return_codes = [0 ]):
509- priors_directory = os .path .join (os .getcwd (), "priors " )
506+ priors_directory = os .path .join (os .getcwd (), "nipype_priors " )
510507 if not os .path .exists (priors_directory ):
511508 os .makedirs (priors_directory )
512509 _ , _ , ext = split_filename (self .inputs .segmentation_priors [0 ])
513510 for i , f in enumerate (self .inputs .segmentation_priors ):
514511 target = os .path .join (priors_directory , 'BrainSegmentationPrior%02d' % (i + 1 ) + ext )
515512 if not (os .path .exists (target ) and os .path .realpath (target ) == os .path .abspath (f )):
516- copyfile (os .path .abspath (f ), os .path .join (priors_directory ,
517- 'BrainSegmentationPrior%02d' % (i + 1 ) + ext ))
513+ copyfile (os .path .abspath (f ), target )
518514 runtime = super (antsCorticalThickness , self )._run_interface (runtime )
519515 return runtime
520516
@@ -532,43 +528,42 @@ def _list_outputs(self):
532528 self .inputs .out_prefix +
533529 'BrainSegmentation0N4.' +
534530 self .inputs .image_suffix )
535- outputs ['BrainSegmentationPosteriorsCSF' ] = os .path .join (os .getcwd (),
536- self .inputs .out_prefix +
537- 'BrainSegmentationPosteriors01.' +
538- self .inputs .image_suffix )
539- outputs ['BrainSegmentationPosteriorsGM' ] = os .path .join (os .getcwd (),
540- self .inputs .out_prefix +
541- 'BrainSegmentationPosteriors02.' +
542- self .inputs .image_suffix )
543- outputs ['BrainSegmentationPosteriorsWM' ] = os .path .join (os .getcwd (),
544- self .inputs .out_prefix +
545- 'BrainSegmentationPosteriors03.' +
546- self .inputs .image_suffix )
547- outputs ['BrainSegmentationPosteriorsDGM' ] = os .path .join (os .getcwd (),
548- self .inputs .out_prefix +
549- 'BrainSegmentationPosteriors04.' +
550- self .inputs .image_suffix )
531+ posteriors = []
532+ for i in range (len (self .inputs .segmentation_priors )):
533+ posteriors .append (os .path .join (os .getcwd (),
534+ self .inputs .out_prefix +
535+ 'BrainSegmentationPosteriors%02d.' % (i + 1 ) +
536+ self .inputs .image_suffix ))
537+ outputs ['BrainSegmentationPosteriors' ] = posteriors
551538 outputs ['CorticalThickness' ] = os .path .join (os .getcwd (),
552539 self .inputs .out_prefix +
553540 'CorticalThickness.' +
554541 self .inputs .image_suffix )
555542 outputs ['TemplateToSubject1GenericAffine' ] = os .path .join (os .getcwd (),
543+ self .inputs .out_prefix +
556544 'TemplateToSubject1GenericAffine.mat' )
557545 outputs ['TemplateToSubject0Warp' ] = os .path .join (os .getcwd (),
558546 self .inputs .out_prefix +
559547 'TemplateToSubject0Warp.' +
560548 self .inputs .image_suffix )
561549 outputs ['SubjectToTemplate1Warp' ] = os .path .join (os .getcwd (),
562550 self .inputs .out_prefix +
563- 'SubjectToTemplate1Warp' +
551+ 'SubjectToTemplate1Warp. ' +
564552 self .inputs .image_suffix )
565553 outputs ['SubjectToTemplate0GenericAffine' ] = os .path .join (os .getcwd (),
566554 self .inputs .out_prefix +
567555 'SubjectToTemplate0GenericAffine.mat' )
568- outputs ['TemplateToSubjectLogJacobian ' ] = os .path .join (os .getcwd (),
556+ outputs ['SubjectToTemplateLogJacobian ' ] = os .path .join (os .getcwd (),
569557 self .inputs .out_prefix +
570- 'subjectToTemplateLogJacobian .' +
558+ 'SubjectToTemplateLogJacobian .' +
571559 self .inputs .image_suffix )
560+ outputs ['CorticalThicknessNormedToTemplate' ] = os .path .join (os .getcwd (),
561+ self .inputs .out_prefix +
562+ 'CorticalThickness.' +
563+ self .inputs .image_suffix )
564+ outputs ['BrainVolumes' ] = os .path .join (os .getcwd (),
565+ self .inputs .out_prefix +
566+ 'brainvols.csv' )
572567 return outputs
573568
574569class JointFusionInputSpec (ANTSCommandInputSpec ):
0 commit comments