Skip to content

[FIX] Fix surf_reg input trait #2352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_SampleToSurface_inputs():
),
subject_id=dict(),
subjects_dir=dict(),
surf_reg=dict(argstr='--surfreg',
surf_reg=dict(argstr='--surfreg %s',
requires=['target_subject'],
),
surface=dict(argstr='--surf %s',
Expand Down
9 changes: 7 additions & 2 deletions nipype/interfaces/freesurfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ class SampleToSurfaceInputSpec(FSTraitedSpec):
subject_id = traits.String(desc="subject id")
target_subject = traits.String(argstr="--trgsubject %s",
desc="sample to surface of different subject than source")
surf_reg = traits.Bool(argstr="--surfreg", requires=["target_subject"],
desc="use surface registration to target subject")
surf_reg = traits.Either(traits.Bool, traits.Str(),
argstr="--surfreg %s", requires=["target_subject"],
desc="use surface registration to target subject")
ico_order = traits.Int(argstr="--icoorder %d", requires=["target_subject"],
desc="icosahedron order when target_subject is 'ico'")

Expand Down Expand Up @@ -238,6 +239,10 @@ def _format_arg(self, name, spec, value):

if value in implicit_filetypes:
return ""
if name == 'surf_reg':
if value is True:
return spec.argstr % 'sphere.reg'

return super(SampleToSurface, self)._format_arg(name, spec, value)

def _get_outfilename(self, opt="out_file"):
Expand Down