Skip to content

Commit cf2a590

Browse files
committed
ENH: Update multi-stage recon-all directives
1 parent a092cde commit cf2a590

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")
@@ -958,6 +966,15 @@ def _format_arg(self, name, trait_spec, value):
958966
isdefined(self.inputs.hippocampal_subfields_T1) and
959967
self.inputs.hippocampal_subfields_T1)):
960968
trait_spec.argstr = trait_spec.argstr.replace('T2', 'T1T2')
969+
if name == 'directive' and value == 'autorecon-hemi':
970+
if not isdefined(self.inputs.hemi):
971+
raise ValueError("Directive 'autorecon-hemi' requires hemi "
972+
"input to be set")
973+
value += ' ' + self.inputs.hemi
974+
if all((name == 'hemi',
975+
isdefined(self.inputs.directive) and
976+
self.inputs.directive == 'autorecon-hemi')):
977+
return ''
961978
return super(ReconAll, self)._format_arg(name, trait_spec, value)
962979

963980
@property

0 commit comments

Comments
 (0)