Skip to content

Afni deconvolve #2

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 2 commits into from
Jun 22, 2017
Merged
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
17 changes: 10 additions & 7 deletions nipype/interfaces/afni/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
requires=['glt_sym'])


class DeconvolveOutputSpec(TraitedSpec):
pass


class Deconvolve(AFNICommand):
"""Performs OLS regression given a 4D neuroimage file and stimulus timings

Expand All @@ -179,19 +175,23 @@ class Deconvolve(AFNICommand):
>>> stim_times = [(1, 'stims1.txt', 'SPMG1(4)'), (2, 'stims2.txt', 'SPMG2(4)')]
>>> deconvolve.inputs.stim_times = stim_times
>>> deconvolve.cmdline # doctest: +ALLOW_UNICODE
'3dDeconvolve -input functional.nii -bucket output.nii -x1D output.1D -stim_times 1 stims1.txt SPMG1(4) 2 stims2.txt SPMG2(4)'
'3dDeconvolve -input functional.nii -bucket output.nii -x1D output -stim_times 1 stims1.txt SPMG1(4) 2 stims2.txt SPMG2(4)'
>>> res = deconvolve.run() # doctest: +SKIP
"""

_cmd = '3dDeconvolve'
input_spec = DeconvolveInputSpec
output_spec = DeconvolveOutputSpec
output_spec = AFNICommandOutputSpec

def _list_outputs(self):
outputs = self.output_spec().get()
if isdefined(self.inputs.x1D):
if not self.inputs.x1D.endswith('.xmat.1D'):
outputs['x1D'] = outputs['x1D'] + '.xmat.1D'
outputs['x1D'] = self.inputs.x1D + '.xmat.1D'
else:
outputs['x1D'] = self.inputs.x1D

outputs['bucket'] = self.inputs.bucket
return outputs

def _format_arg(self, name, trait_spec, value):
Expand All @@ -206,5 +206,8 @@ def _format_arg(self, name, trait_spec, value):
arg += trait_spec.argstr % value
arg = arg.rstrip()
return arg

if name == 'stim_times':
self.inputs.num_stimts = len(value)
elif name == 'glt_sym':
self.inputs.num_glt = len(value)