Skip to content

[ENH] added slice_encoding_direction input to TShift #2753

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 7 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@
"name": "Ghayoor, Ali"
},
{
"name": "Liem, Franz"
"affiliation": "University of Zurich",
"name": "Liem, Franz",
"orcid": "0000-0003-0646-4810"
},
{
"name": "Millman, Jarrod"
Expand Down
14 changes: 13 additions & 1 deletion nipype/interfaces/afni/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,10 @@ class TShiftInputSpec(AFNICommandInputSpec):
desc='time offsets from the volume acquisition onset for each slice',
argstr='-tpattern @%s',
xor=['tpattern'])
slice_encoding_direction = traits.Enum(
('k', 'k-'),
desc='Direction in which slice_timing is specified (default: k). If negative,'
'slice_timing is defined in reverse order -- see BIDS specification for details.',)
rlt = traits.Bool(
desc='Before shifting, remove the mean and linear trend',
argstr='-rlt')
Expand Down Expand Up @@ -2723,9 +2727,17 @@ def _format_arg(self, name, trait_spec, value):
return super(TShift, self)._format_arg(name, trait_spec, value)

def _write_slice_timing(self):
slice_timing = self.inputs.slice_timing.copy()
if not self.inputs.slice_encoding_direction:
slice_encoding_direction = "k"
else:
slice_encoding_direction = self.inputs.slice_encoding_direction
if slice_encoding_direction.endswith("-"):
slice_timing.reverse()

fname = 'slice_timing.1D'
with open(fname, 'w') as fobj:
fobj.write('\t'.join(map(str, self.inputs.slice_timing)))
fobj.write('\t'.join(map(str, slice_timing)))
return fname

def _list_outputs(self):
Expand Down