Skip to content

Commit c8bae35

Browse files
committed
ENH: Update multi-stage recon-all directives
1 parent f39e222 commit c8bae35

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,18 @@ def _gen_filename(self, name):
611611
class ReconAllInputSpec(CommandLineInputSpec):
612612
subject_id = traits.Str("recon_all", argstr='-subjid %s',
613613
desc='subject name', usedefault=True)
614-
directive = traits.Enum('all', 'autorecon1', 'autorecon2', 'autorecon2-cp',
615-
'autorecon2-wm', 'autorecon2-inflate1',
616-
'autorecon2-perhemi', 'autorecon3', 'localGI',
617-
'qcache', argstr='-%s', desc='process directive',
614+
directive = traits.Enum('all', 'autorecon1',
615+
# autorecon2 variants
616+
'autorecon2', 'autorecon2-volonly',
617+
'autorecon2-perhemi', 'autorecon2-inflate1',
618+
'autorecon2-cp', 'autorecon2-wm',
619+
# autorecon3 variants
620+
'autorecon3', 'autorecon3-T2pial',
621+
# Mix of autorecon2 and autorecon3 steps
622+
'autorecon-pial', 'autorecon-hemi',
623+
# Not "multi-stage flags"
624+
'localGI', 'qcache',
625+
argstr='-%s', desc='process directive',
618626
usedefault=True, position=0)
619627
hemi = traits.Enum('lh', 'rh', desc='hemisphere to process',
620628
argstr="-hemi %s")
@@ -963,6 +971,15 @@ def _format_arg(self, name, trait_spec, value):
963971
isdefined(self.inputs.hippocampal_subfields_T1) and
964972
self.inputs.hippocampal_subfields_T1)):
965973
trait_spec.argstr = trait_spec.argstr.replace('T2', 'T1T2')
974+
if name == 'directive' and value == 'autorecon-hemi':
975+
if not isdefined(self.inputs.hemi):
976+
raise ValueError("Directive 'autorecon-hemi' requires hemi "
977+
"input to be set")
978+
value += ' ' + self.inputs.hemi
979+
if all((name == 'hemi',
980+
isdefined(self.inputs.directive) and
981+
self.inputs.directive == 'autorecon-hemi')):
982+
return ''
966983
return super(ReconAll, self)._format_arg(name, trait_spec, value)
967984

968985
@property

0 commit comments

Comments
 (0)