Skip to content

Commit 61265fe

Browse files
authored
Merge pull request #2180 from salma1601/afni-refit
add more inputs to afni Refit
2 parents 67e58b4 + a7d1565 commit 61265fe

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

nipype/interfaces/afni/tests/test_auto_Refit.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@
66
def test_Refit_inputs():
77
input_map = dict(args=dict(argstr='%s',
88
),
9+
atrcopy=dict(argstr='-atrcopy %s %s',
10+
),
11+
atrfloat=dict(argstr='-atrfloat %s %s',
12+
),
13+
atrint=dict(argstr='-atrint %s %s',
14+
),
15+
atrstring=dict(argstr='-atrstring %s %s',
16+
),
917
deoblique=dict(argstr='-deoblique',
1018
),
19+
duporigin_file=dict(argstr='-duporigin %s',
20+
),
1121
environ=dict(nohash=True,
1222
usedefault=True,
1323
),
@@ -19,6 +29,10 @@ def test_Refit_inputs():
1929
mandatory=True,
2030
position=-1,
2131
),
32+
nosaveatr=dict(argstr='-nosaveatr',
33+
),
34+
saveatr=dict(argstr='-saveatr',
35+
),
2236
space=dict(argstr='-space %s',
2337
),
2438
terminal_output=dict(nohash=True,

nipype/interfaces/afni/utils.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,11 @@ class RefitInputSpec(CommandLineInputSpec):
15951595
zorigin = Str(
15961596
desc='z distance for edge voxel offset',
15971597
argstr='-zorigin %s')
1598+
duporigin_file = File(
1599+
argstr='-duporigin %s',
1600+
exists=True,
1601+
desc='Copies the xorigin, yorigin, and zorigin values from the header '
1602+
'of the given dataset')
15981603
xdel = traits.Float(
15991604
desc='new x voxel dimension in mm',
16001605
argstr='-xdel %f')
@@ -1609,6 +1614,46 @@ class RefitInputSpec(CommandLineInputSpec):
16091614
argstr='-space %s',
16101615
desc='Associates the dataset with a specific template type, e.g. '
16111616
'TLRC, MNI, ORIG')
1617+
atrcopy = traits.Tuple(
1618+
traits.File(exists=True), traits.Str(),
1619+
argstr='-atrcopy %s %s',
1620+
desc='Copy AFNI header attribute from the given file into the header '
1621+
'of the dataset(s) being modified. For more information on AFNI '
1622+
'header attributes, see documentation file README.attributes. '
1623+
'More than one \'-atrcopy\' option can be used. For AFNI '
1624+
'advanced users only. Do NOT use -atrcopy or -atrstring with '
1625+
'other modification options. See also -copyaux.')
1626+
atrstring = traits.Tuple(
1627+
traits.Str(), traits.Str(),
1628+
argstr='-atrstring %s %s',
1629+
desc='Copy the last given string into the dataset(s) being modified, '
1630+
'giving it the attribute name given by the last string.'
1631+
'To be safe, the last string should be in quotes.')
1632+
atrfloat = traits.Tuple(
1633+
traits.Str(), traits.Str(),
1634+
argstr='-atrfloat %s %s',
1635+
desc='Create or modify floating point attributes. '
1636+
'The input values may be specified as a single string in quotes '
1637+
'or as a 1D filename or string, example '
1638+
'\'1 0.2 0 0 -0.2 1 0 0 0 0 1 0\' or '
1639+
'flipZ.1D or \'1D:1,0.2,2@0,-0.2,1,2@0,2@0,1,0\'')
1640+
atrint = traits.Tuple(
1641+
traits.Str(), traits.Str(),
1642+
argstr='-atrint %s %s',
1643+
desc='Create or modify integer attributes. '
1644+
'The input values may be specified as a single string in quotes '
1645+
'or as a 1D filename or string, example '
1646+
'\'1 0 0 0 0 1 0 0 0 0 1 0\' or '
1647+
'flipZ.1D or \'1D:1,0,2@0,-0,1,2@0,2@0,1,0\'')
1648+
saveatr = traits.Bool(
1649+
argstr='-saveatr',
1650+
desc='(default) Copy the attributes that are known to AFNI into '
1651+
'the dset->dblk structure thereby forcing changes to known '
1652+
'attributes to be present in the output. This option only makes '
1653+
'sense with -atrcopy.')
1654+
nosaveatr = traits.Bool(
1655+
argstr='-nosaveatr',
1656+
desc='Opposite of -saveatr')
16121657

16131658

16141659
class Refit(AFNICommandBase):
@@ -1628,6 +1673,12 @@ class Refit(AFNICommandBase):
16281673
'3drefit -deoblique structural.nii'
16291674
>>> res = refit.run() # doctest: +SKIP
16301675
1676+
>>> refit_2 = afni.Refit()
1677+
>>> refit_2.inputs.in_file = 'structural.nii'
1678+
>>> refit_2.inputs.atrfloat = ("IJK_TO_DICOM_REAL", "'1 0.2 0 0 -0.2 1 0 0 0 0 1 0'")
1679+
>>> refit_2.cmdline # doctest: +ALLOW_UNICODE
1680+
"3drefit -atrfloat IJK_TO_DICOM_REAL '1 0.2 0 0 -0.2 1 0 0 0 0 1 0' structural.nii"
1681+
>>> res = refit_2.run() # doctest: +SKIP
16311682
"""
16321683
_cmd = '3drefit'
16331684
input_spec = RefitInputSpec

0 commit comments

Comments
 (0)