Skip to content

Commit 50f47c2

Browse files
committed
Add MRIsCombine.
1 parent 39348e8 commit 50f47c2

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..utils import MRIsCombine
4+
5+
6+
def test_MRIsCombine_inputs():
7+
input_map = dict(args=dict(argstr='%s',
8+
),
9+
environ=dict(nohash=True,
10+
usedefault=True,
11+
),
12+
ignore_exception=dict(nohash=True,
13+
usedefault=True,
14+
),
15+
in_file1=dict(argstr='--combinesurfs %s',
16+
mandatory=True,
17+
position=0,
18+
),
19+
in_file2=dict(argstr='%s',
20+
mandatory=True,
21+
position=1,
22+
),
23+
out_file=dict(argstr='%s',
24+
genfile=True,
25+
mandatory=True,
26+
position=-1,
27+
),
28+
subjects_dir=dict(),
29+
terminal_output=dict(nohash=True,
30+
),
31+
)
32+
inputs = MRIsCombine.input_spec()
33+
34+
for key, metadata in list(input_map.items()):
35+
for metakey, value in list(metadata.items()):
36+
assert getattr(inputs.traits()[key], metakey) == value
37+
38+
39+
def test_MRIsCombine_outputs():
40+
output_map = dict(out_file=dict(),
41+
)
42+
outputs = MRIsCombine.output_spec()
43+
44+
for key, metadata in list(output_map.items()):
45+
for metakey, value in list(metadata.items()):
46+
assert getattr(outputs.traits()[key], metakey) == value

nipype/interfaces/freesurfer/utils.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,54 @@ def _gen_outfilename(self):
954954
return name + ext + "_converted." + self.inputs.out_datatype
955955

956956

957+
class MRIsCombineInputSpec(FSTraitedSpec):
958+
"""
959+
Uses Freesurfer's mris_convert to combine two surface files into one.
960+
"""
961+
in_file1 = File(exists=True, mandatory=True, position=0,
962+
argstr='--combinesurfs %s',
963+
desc='File to be combined with in_file2')
964+
in_file2 = File(exists=True, mandatory=True, position=1,
965+
argstr='%s',
966+
desc='File to be combined with in_file1')
967+
out_file = File(argstr='%s', position=-1, genfile=True,
968+
mandatory=True,
969+
desc='Output filename. Combined surfaces from in_file1 and '
970+
'in_file2.')
971+
972+
973+
class MRIsCombineOutputSpec(TraitedSpec):
974+
"""
975+
Uses Freesurfer's mris_convert to combine two surface files into one.
976+
"""
977+
out_file = File(exists=True, desc='Output filename. Combined surfaces from '
978+
'in_file1 and in_file2.')
979+
980+
981+
class MRIsCombine(FSCommand):
982+
"""
983+
Uses Freesurfer's mris_convert to combine two surface files into one.
984+
985+
For complete details, see the `mris_convert Documentation.
986+
<https://surfer.nmr.mgh.harvard.edu/fswiki/mris_convert>`_
987+
988+
Example
989+
-------
990+
991+
>>> import nipype.interfaces.freesurfer as fs
992+
>>> mris = fs.MRIsConvert()
993+
>>> mris.inputs.in_file1 = 'lh.pial'
994+
>>> mris.inputs.in_file2 = 'rh.pial'
995+
>>> mris.inputs.out_file = 'bh.pial'
996+
>>> mris.cmdline # doctest: +ALLOW_UNICODE
997+
'mris_convert --combine_surfs lh.pial rh.pial bh.pial'
998+
>>> mris.run() # doctest: +SKIP
999+
"""
1000+
_cmd = 'mris_convert'
1001+
input_spec = MRIsCombineInputSpec
1002+
output_spec = MRIsCombineOutputSpec
1003+
1004+
9571005
class MRITessellateInputSpec(FSTraitedSpec):
9581006
"""
9591007
Uses Freesurfer's mri_tessellate to create surfaces by tessellating a given input volume

0 commit comments

Comments
 (0)