Skip to content

Commit 48a206b

Browse files
committed
ENH: Add mris_expand interface
1 parent 70b2084 commit 48a206b

File tree

2 files changed

+85
-0
lines changed

2 files changed

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

nipype/interfaces/freesurfer/utils.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,3 +2879,41 @@ def _list_outputs(self):
28792879
outputs = self._outputs().get()
28802880
outputs["out_file"] = os.path.abspath(self.inputs.out_file)
28812881
return outputs
2882+
2883+
2884+
class MRIsExpandInputSpec(FSTraitedSpec):
2885+
in_file = File(
2886+
exists=True, mandatory=True, argstr='%s', position=-3,
2887+
desc='Surface to expand')
2888+
distance = traits.Float(
2889+
mandatory=True, argstr='%g', position=-2,
2890+
desc='Distance in mm or fraction of cortical thickness')
2891+
out_file = File(
2892+
name_template='%s_expanded', name_source='in_file', position=-1,
2893+
desc='Output surface file')
2894+
thickness = traits.Bool(
2895+
argstr='-thickness',
2896+
desc='Expand by fraction of cortical thickness, not mm')
2897+
2898+
2899+
class MRIsExpandOutputSpec(TraitedSpec):
2900+
out_file = File(desc='Output surface file')
2901+
2902+
2903+
class MRIsExpand(FSCommand):
2904+
"""
2905+
Expands a surface (typically ?h.white) outwards while maintaining
2906+
smoothness and self-intersection constraints.
2907+
2908+
Examples
2909+
========
2910+
>>> from nipype.interfaces.freesurfer import MRIsExpand
2911+
>>> mris_expand = MRIsExpand(thickness=True, distance=0.5)
2912+
>>> mris_expand.inputs.in_file = 'lh.white'
2913+
>>> mris_expand.inputs.out_file = 'lh.graymid'
2914+
>>> mris_expand.cmdline # doctest: +ALLOW_UNICODE
2915+
'mris_expand -thickness lh.white 0.5 lh.graymid'
2916+
"""
2917+
_cmd = 'mris_epxand'
2918+
input_spec = MRIsExpandInputSpec
2919+
output_spec = MRIsExpandOutputSpec

0 commit comments

Comments
 (0)