@@ -465,7 +465,7 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
465
465
'Requires single thread computation for complete reproducibility.' ))
466
466
467
467
468
- class antsCorticalThicknessoutputSpec (TraitedSpec ):
468
+ class antsCorticalThicknessOutputSpec (TraitedSpec ):
469
469
BrainExtractionMask = File (exists = True , desc = 'brain extraction mask' )
470
470
BrainSegmentation = File (exists = True , desc = 'brain segmentaion image' )
471
471
BrainSegmentationN4 = File (exists = True , desc = 'N4 corrected image' )
@@ -503,7 +503,7 @@ class antsCorticalThickness(ANTSCommand):
503
503
"""
504
504
505
505
input_spec = antsCorticalThicknessInputSpec
506
- output_spec = antsCorticalThicknessoutputSpec
506
+ output_spec = antsCorticalThicknessOutputSpec
507
507
_cmd = 'antsCorticalThickness.sh'
508
508
509
509
def _format_arg (self , opt , spec , val ):
@@ -594,6 +594,105 @@ def _list_outputs(self):
594
594
return outputs
595
595
596
596
597
+ class antsBrainExtractionInputSpec (ANTSCommandInputSpec ):
598
+ dimension = traits .Enum (3 , 2 , argstr = '-d %d' , usedefault = True ,
599
+ desc = 'image dimension (2 or 3)' )
600
+ anatomical_image = File (exists = True , argstr = '-a %s' ,
601
+ desc = ('Structural image, typically T1. If more than one'
602
+ 'anatomical image is specified, subsequently specified'
603
+ 'images are used during the segmentation process. However,'
604
+ 'only the first image is used in the registration of priors.'
605
+ 'Our suggestion would be to specify the T1 as the first image.'
606
+ 'Anatomical template created using e.g. LPBA40 data set with'
607
+ 'buildtemplateparallel.sh in ANTs.' ),
608
+ mandatory = True )
609
+ brain_template = File (exists = True , argstr = '-e %s' ,
610
+ desc = ('Anatomical template created using e.g. LPBA40 data set with'
611
+ 'buildtemplateparallel.sh in ANTs.' ),
612
+ mandatory = True )
613
+ brain_probability_mask = File (exists = True , argstr = '-m %s' ,
614
+ desc = ('Brain probability mask created using e.g. LPBA40 data set which'
615
+ 'have brain masks defined, and warped to anatomical template and'
616
+ 'averaged resulting in a probability image.' ),
617
+ copyfile = False , mandatory = True )
618
+ out_prefix = traits .Str ('highres001_' , argstr = '-o %s' , usedefault = True ,
619
+ desc = ('Prefix that is prepended to all output'
620
+ ' files (default = highress001_)' ))
621
+
622
+ extraction_registration_mask = File (exists = True , argstr = '-f %s' ,
623
+ desc = ('Mask (defined in the template space) used during'
624
+ ' registration for brain extraction.'
625
+ 'To limit the metric computation to a specific region.' ))
626
+ image_suffix = traits .Str ('nii.gz' , desc = ('any of standard ITK formats,'
627
+ ' nii.gz is default' ),
628
+ argstr = '-s %s' , usedefault = True )
629
+ use_random_seeding = traits .Enum (0 , 1 , argstr = '-u %d' ,
630
+ desc = ('Use random number generated from system clock in Atropos'
631
+ '(default = 1)' ))
632
+ keep_temporary_files = traits .Int (argstr = '-k %d' ,
633
+ desc = 'Keep brain extraction/segmentation warps, etc (default = 0).' )
634
+ use_floatingpoint_precision = traits .Enum (0 , 1 , argstr = '-q %d' ,
635
+ desc = ('Use floating point precision '
636
+ 'in registrations (default = 0)' ))
637
+ debug = traits .Bool (argstr = '-z 1' ,
638
+ desc = ('If > 0, runs a faster version of the script.'
639
+ 'Only for testing. Implies -u 0.'
640
+ 'Requires single thread computation for complete reproducibility.' ))
641
+
642
+
643
+ class antsBrainExtractionOutputSpec (TraitedSpec ):
644
+ BrainExtractionMask = File (exists = True , desc = 'brain extraction mask' )
645
+ BrainExtractionBrain = File (exists = True , desc = 'brain extraction image' )
646
+
647
+ class antsBrainExtraction (ANTSCommand ):
648
+ """
649
+ Examples
650
+ --------
651
+ >>> from nipype.interfaces.ants.segmentation import antsBrainExtraction
652
+ >>> brainextraction = antsBrainExtraction()
653
+ >>> brainextraction.inputs.dimension = 3
654
+ >>> brainextraction.inputs.anatomical_image ='T1.nii.gz'
655
+ >>> brainextraction.inputs.brain_template = 'study_template.nii.gz'
656
+ >>> brainextraction.inputs.brain_probability_mask ='ProbabilityMaskOfStudyTemplate.nii.gz'
657
+ >>> brainextraction.cmdline
658
+ 'antsBrainExtraction.sh -a T1.nii.gz -m ProbabilityMaskOfStudyTemplate.nii.gz -e study_template.nii.gz -d 3 -s nii.gz -o highres001_
659
+
660
+ input_spec = antsBrainExtractionInputSpec
661
+ output_spec = antsBrainExtractionOutputSpec
662
+ _cmd = 'antsBrainExtraction.sh'
663
+
664
+ def _format_arg(self, opt, spec, val):
665
+ if opt == 'anatomical_image':
666
+ retval = '-a %s' % val
667
+ return retval
668
+ if opt == 'brain_template':
669
+ retval = '-e %s' % val
670
+ return retval
671
+ if opt == 'brain_probability_mask':
672
+ retval = '-m %s' % val
673
+ return retval
674
+ if opt == 'out_prefix':
675
+ retval = '-o %s' % val
676
+ return retval
677
+ return super(ANTSCommand, self)._format_arg(opt, spec, val)
678
+
679
+ def _run_interface(self, runtime, correct_return_codes=[0]):
680
+ runtime = super(antsBrainExtraction, self)._run_interface(runtime)
681
+ return runtime
682
+
683
+ def _list_outputs(self):
684
+ outputs = self._outputs().get()
685
+ outputs['BrainExtractionMask'] = os.path.join(os.getcwd(),
686
+ self.inputs.out_prefix +
687
+ 'BrainExtractionMask.' +
688
+ self.inputs.image_suffix)
689
+ outputs['BrainExtractionBrain'] = os.path.join(os.getcwd(),
690
+ self.inputs.out_prefix +
691
+ 'BrainExtractionBrain.' +
692
+ self.inputs.image_suffix)
693
+ return outputs
694
+
695
+
597
696
class JointFusionInputSpec(ANTSCommandInputSpec):
598
697
dimension = traits.Enum(3, 2, 4, argstr='%d', position=0, usedefault=True,
599
698
mandatory=True,
0 commit comments