Skip to content

Commit e31573b

Browse files
authored
Merge pull request #3443 from mfmachado/robex-interface
ENH: ROBEX interface
2 parents 79132b5 + a62dd8c commit e31573b

File tree

6 files changed

+134
-1
lines changed

6 files changed

+134
-1
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Kshitij Chawla <kc.insight.pi@gmail.com>
121121
Leonie Lampe <leonie.lampe@gmail.com>
122122
Lukas Snoek <lukassnoek@gmail.com>
123123
Marcel Falkiewicz <mfalkiewicz@gmail.com> <m.falkiewicz@nencki.gov.pl>
124+
Maria de Fatima Dias <mfatimamachado13@gmail.com> <fmachado@dei.uc.pt>
124125
Martin Perez-Guevara <mperezguevara@gmail.com>
125126
Mathias Goncalves <goncalves.mathias@gmail.com> <mathiasg@mit.edu>
126127
Mathias Goncalves <goncalves.mathias@gmail.com> <mathiasg@stanford.edu>

.zenodo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263
},
264264
{
265265
"affiliation": "CIBIT, UC",
266-
"name": "Machado, F\u00e1tima",
266+
"name": "Dias, Maria de Fatima",
267267
"orcid": "0000-0001-8878-1750"
268268
},
269269
{

nipype/interfaces/robex/__init__.py

Whitespace-only changes.

nipype/interfaces/robex/preprocess.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import os
2+
from pathlib import Path
3+
4+
from nipype.interfaces.base import (
5+
TraitedSpec,
6+
CommandLineInputSpec,
7+
CommandLine,
8+
File,
9+
traits,
10+
isdefined,
11+
)
12+
from nipype.utils.filemanip import split_filename
13+
14+
15+
class RobexInputSpec(CommandLineInputSpec):
16+
in_file = File(
17+
desc="Input volume", exists=True, mandatory=True, position=0, argstr="%s"
18+
)
19+
out_file = File(
20+
desc="Output volume",
21+
position=1,
22+
argstr="%s",
23+
hash_files=False,
24+
name_template='%s_brain',
25+
name_source=["in_file"],
26+
keep_extension=True,
27+
)
28+
out_mask = File(
29+
desc="Output mask",
30+
position=2,
31+
argstr="%s",
32+
hash_files=False,
33+
name_template='%s_brainmask',
34+
name_source=["in_file"],
35+
keep_extension=True,
36+
)
37+
seed = traits.Int(desc="Seed for random number generator", position=3, argstr="%i")
38+
39+
40+
class RobexOutputSpec(TraitedSpec):
41+
out_file = File(desc="Output volume")
42+
out_mask = File(desc="Output mask")
43+
44+
45+
class RobexSegment(CommandLine):
46+
"""
47+
48+
ROBEX is an automatic whole-brain extraction tool for T1-weighted MRI data (commonly known as skull stripping).
49+
ROBEX aims for robust skull-stripping across datasets with no parameter settings. It fits a triangular mesh,
50+
constrained by a shape model, to the probabilistic output of a supervised brain boundary classifier.
51+
Because the shape model cannot perfectly accommodate unseen cases, a small free deformation is subsequently allowed.
52+
The deformation is optimized using graph cuts.
53+
The method ROBEX is based on was published in IEEE Transactions on Medical Imaging;
54+
please visit the website http://www.jeiglesias.com to download the paper.
55+
56+
Examples
57+
--------
58+
>>> from nipype.interfaces.robex.preprocess import RobexSegment
59+
>>> robex = RobexSegment()
60+
>>> robex.inputs.in_file = 'structural.nii'
61+
>>> robex.cmdline
62+
'runROBEX.sh structural.nii structural_brain.nii structural_brainmask.nii'
63+
>>> robex.run() # doctest: +SKIP
64+
65+
"""
66+
67+
input_spec = RobexInputSpec
68+
output_spec = RobexOutputSpec
69+
_cmd = 'runROBEX.sh'

nipype/interfaces/robex/tests/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ..preprocess import RobexSegment
3+
4+
5+
def test_RobexSegment_inputs():
6+
input_map = dict(
7+
args=dict(
8+
argstr="%s",
9+
),
10+
environ=dict(
11+
nohash=True,
12+
usedefault=True,
13+
),
14+
in_file=dict(
15+
argstr="%s",
16+
extensions=None,
17+
mandatory=True,
18+
position=0,
19+
),
20+
out_file=dict(
21+
argstr="%s",
22+
extensions=None,
23+
hash_files=False,
24+
keep_extension=True,
25+
name_source=["in_file"],
26+
name_template="%s_brain",
27+
position=1,
28+
),
29+
out_mask=dict(
30+
argstr="%s",
31+
extensions=None,
32+
hash_files=False,
33+
keep_extension=True,
34+
name_source=["in_file"],
35+
name_template="%s_brainmask",
36+
position=2,
37+
),
38+
seed=dict(
39+
argstr="%i",
40+
position=3,
41+
),
42+
)
43+
inputs = RobexSegment.input_spec()
44+
45+
for key, metadata in list(input_map.items()):
46+
for metakey, value in list(metadata.items()):
47+
assert getattr(inputs.traits()[key], metakey) == value
48+
49+
50+
def test_RobexSegment_outputs():
51+
output_map = dict(
52+
out_file=dict(
53+
extensions=None,
54+
),
55+
out_mask=dict(
56+
extensions=None,
57+
),
58+
)
59+
outputs = RobexSegment.output_spec()
60+
61+
for key, metadata in list(output_map.items()):
62+
for metakey, value in list(metadata.items()):
63+
assert getattr(outputs.traits()[key], metakey) == value

0 commit comments

Comments
 (0)