Skip to content

add more inputs to afni Refit #2180

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
Sep 11, 2017
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
14 changes: 14 additions & 0 deletions nipype/interfaces/afni/tests/test_auto_Refit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
def test_Refit_inputs():
input_map = dict(args=dict(argstr='%s',
),
atrcopy=dict(argstr='-atrcopy %s %s',
),
atrfloat=dict(argstr='-atrfloat %s %s',
),
atrint=dict(argstr='-atrint %s %s',
),
atrstring=dict(argstr='-atrstring %s %s',
),
deoblique=dict(argstr='-deoblique',
),
duporigin_file=dict(argstr='-duporigin %s',
),
environ=dict(nohash=True,
usedefault=True,
),
Expand All @@ -19,6 +29,10 @@ def test_Refit_inputs():
mandatory=True,
position=-1,
),
nosaveatr=dict(argstr='-nosaveatr',
),
saveatr=dict(argstr='-saveatr',
),
space=dict(argstr='-space %s',
),
terminal_output=dict(nohash=True,
Expand Down
51 changes: 51 additions & 0 deletions nipype/interfaces/afni/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,11 @@ class RefitInputSpec(CommandLineInputSpec):
zorigin = Str(
desc='z distance for edge voxel offset',
argstr='-zorigin %s')
duporigin_file = File(
argstr='-duporigin %s',
exists=True,
desc='Copies the xorigin, yorigin, and zorigin values from the header '
'of the given dataset')
xdel = traits.Float(
desc='new x voxel dimension in mm',
argstr='-xdel %f')
Expand All @@ -1609,6 +1614,46 @@ class RefitInputSpec(CommandLineInputSpec):
argstr='-space %s',
desc='Associates the dataset with a specific template type, e.g. '
'TLRC, MNI, ORIG')
atrcopy = traits.Tuple(
traits.File(exists=True), traits.Str(),
argstr='-atrcopy %s %s',
desc='Copy AFNI header attribute from the given file into the header '
'of the dataset(s) being modified. For more information on AFNI '
'header attributes, see documentation file README.attributes. '
'More than one \'-atrcopy\' option can be used. For AFNI '
'advanced users only. Do NOT use -atrcopy or -atrstring with '
'other modification options. See also -copyaux.')
atrstring = traits.Tuple(
traits.Str(), traits.Str(),
argstr='-atrstring %s %s',
desc='Copy the last given string into the dataset(s) being modified, '
'giving it the attribute name given by the last string.'
'To be safe, the last string should be in quotes.')
atrfloat = traits.Tuple(
traits.Str(), traits.Str(),
argstr='-atrfloat %s %s',
desc='Create or modify floating point attributes. '
'The input values may be specified as a single string in quotes '
'or as a 1D filename or string, example '
'\'1 0.2 0 0 -0.2 1 0 0 0 0 1 0\' or '
'flipZ.1D or \'1D:1,0.2,2@0,-0.2,1,2@0,2@0,1,0\'')
atrint = traits.Tuple(
traits.Str(), traits.Str(),
argstr='-atrint %s %s',
desc='Create or modify integer attributes. '
'The input values may be specified as a single string in quotes '
'or as a 1D filename or string, example '
'\'1 0 0 0 0 1 0 0 0 0 1 0\' or '
'flipZ.1D or \'1D:1,0,2@0,-0,1,2@0,2@0,1,0\'')
saveatr = traits.Bool(
argstr='-saveatr',
desc='(default) Copy the attributes that are known to AFNI into '
'the dset->dblk structure thereby forcing changes to known '
'attributes to be present in the output. This option only makes '
'sense with -atrcopy.')
nosaveatr = traits.Bool(
argstr='-nosaveatr',
desc='Opposite of -saveatr')


class Refit(AFNICommandBase):
Expand All @@ -1628,6 +1673,12 @@ class Refit(AFNICommandBase):
'3drefit -deoblique structural.nii'
>>> res = refit.run() # doctest: +SKIP

>>> refit_2 = afni.Refit()
>>> refit_2.inputs.in_file = 'structural.nii'
>>> refit_2.inputs.atrfloat = ("IJK_TO_DICOM_REAL", "'1 0.2 0 0 -0.2 1 0 0 0 0 1 0'")
>>> refit_2.cmdline # doctest: +ALLOW_UNICODE
"3drefit -atrfloat IJK_TO_DICOM_REAL '1 0.2 0 0 -0.2 1 0 0 0 0 1 0' structural.nii"
>>> res = refit_2.run() # doctest: +SKIP
"""
_cmd = '3drefit'
input_spec = RefitInputSpec
Expand Down