Skip to content

Commit 6c80289

Browse files
authored
Merge pull request #2337 from mvdoc/afni/convertdset
[ENH] Add ConvertDset interface to AFNI
2 parents 7ce5bb4 + 2957ef8 commit 6c80289

File tree

4 files changed

+105
-5
lines changed

4 files changed

+105
-5
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Upcoming release (0.14.1)
22
=========================
33

4+
* ENH: Add AFNI interface for 3dConvertDset (https://github.com/nipy/nipype/pull/2337)
45
* MAINT: Cleanup EngineBase (https://github.com/nipy/nipype/pull/2376)
56
* FIX: Robustly handled outputs of 3dFWHMx across different versions of AFNI (https://github.com/nipy/nipype/pull/2373)
67
* FIX: Cluster threshold in randomise + change default prefix (https://github.com/nipy/nipype/pull/2369)

nipype/interfaces/afni/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
ROIStats, Retroicor, Seg, SkullStrip, TCorr1D, TCorrMap, TCorrelate, TNorm,
1616
TShift, Volreg, Warp, QwarpPlusMinus, Qwarp)
1717
from .svm import (SVMTest, SVMTrain)
18-
from .utils import (ABoverlap, AFNItoNIFTI, Autobox, Axialize, BrickStat,
19-
Bucket, Calc, Cat, CatMatvec, CenterMass, Copy, Dot, Edge3,
20-
Eval, FWHMx, MaskTool, Merge, Notes, NwarpApply, NwarpCat,
21-
OneDToolPy, Refit, Resample, TCat, TCatSubBrick, TStat,
22-
To3D, Unifize, Undump, ZCutUp, GCOR, Zcat, Zeropad)
18+
from .utils import (
19+
ABoverlap, AFNItoNIFTI, Autobox, Axialize, BrickStat, Bucket, Calc, Cat,
20+
CatMatvec, CenterMass, ConvertDset, Copy, Dot, Edge3, Eval, FWHMx,
21+
MaskTool, Merge, Notes, NwarpApply, NwarpCat, OneDToolPy, Refit, Resample,
22+
TCat, TCatSubBrick, TStat, To3D, Unifize, Undump, ZCutUp, GCOR, Zcat,
23+
Zeropad)
2324
from .model import (Deconvolve, Remlfit, Synthesize)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..utils import ConvertDset
4+
5+
6+
def test_ConvertDset_inputs():
7+
input_map = dict(args=dict(argstr='%s',
8+
),
9+
environ=dict(nohash=True,
10+
usedefault=True,
11+
),
12+
ignore_exception=dict(deprecated='1.0.0',
13+
nohash=True,
14+
usedefault=True,
15+
),
16+
in_file=dict(argstr='-input %s',
17+
mandatory=True,
18+
position=-2,
19+
),
20+
out_file=dict(argstr='-prefix %s',
21+
position=-1,
22+
),
23+
out_type=dict(argstr='-o_%s',
24+
mandatory=True,
25+
position=0,
26+
),
27+
terminal_output=dict(deprecated='1.0.0',
28+
nohash=True,
29+
),
30+
)
31+
inputs = ConvertDset.input_spec()
32+
33+
for key, metadata in list(input_map.items()):
34+
for metakey, value in list(metadata.items()):
35+
assert getattr(inputs.traits()[key], metakey) == value
36+
37+
38+
def test_ConvertDset_outputs():
39+
output_map = dict(out_file=dict(),
40+
)
41+
outputs = ConvertDset.output_spec()
42+
43+
for key, metadata in list(output_map.items()):
44+
for metakey, value in list(metadata.items()):
45+
assert getattr(outputs.traits()[key], metakey) == value

nipype/interfaces/afni/utils.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,59 @@ def _list_outputs(self):
712712
return outputs
713713

714714

715+
class ConvertDsetInputSpec(AFNICommandInputSpec):
716+
in_file = File(
717+
desc='input file to ConvertDset',
718+
argstr='-input %s',
719+
position=-2,
720+
mandatory=True,
721+
exists=True)
722+
723+
out_file = File(
724+
desc='output file for ConvertDset',
725+
argstr='-prefix %s',
726+
position=-1,
727+
mandatory=True)
728+
729+
out_type = traits.Enum(
730+
('niml', 'niml_asc', 'niml_bi',
731+
'1D', '1Dp', '1Dpt',
732+
'gii', 'gii_asc', 'gii_b64', 'gii_b64gz'),
733+
desc='output type',
734+
argstr='-o_%s',
735+
mandatory=True,
736+
position=0)
737+
738+
739+
class ConvertDset(AFNICommandBase):
740+
"""Converts a surface dataset from one format to another.
741+
742+
For complete details, see the `ConvertDset Documentation.
743+
<https://afni.nimh.nih.gov/pub/dist/doc/program_help/ConvertDset.html>`_
744+
745+
Examples
746+
========
747+
748+
>>> from nipype.interfaces import afni
749+
>>> convertdset = afni.ConvertDset()
750+
>>> convertdset.inputs.in_file = 'lh.pial_converted.gii'
751+
>>> convertdset.inputs.out_type = 'niml_asc'
752+
>>> convertdset.inputs.out_file = 'lh.pial_converted.niml.dset'
753+
>>> convertdset.cmdline
754+
'ConvertDset -o_niml_asc -input lh.pial_converted.gii -prefix lh.pial_converted.niml.dset'
755+
>>> res = convertdset.run() # doctest: +SKIP
756+
"""
757+
758+
_cmd = 'ConvertDset'
759+
input_spec = ConvertDsetInputSpec
760+
output_spec = AFNICommandOutputSpec
761+
762+
def _list_outputs(self):
763+
outputs = self.output_spec().get()
764+
outputs['out_file'] = op.abspath(self.inputs.out_file)
765+
return outputs
766+
767+
715768
class CopyInputSpec(AFNICommandInputSpec):
716769
in_file = File(
717770
desc='input file to 3dcopy',

0 commit comments

Comments
 (0)