diff --git a/.mailmap b/.mailmap index 0509365e65..99dc087a60 100644 --- a/.mailmap +++ b/.mailmap @@ -121,6 +121,7 @@ Kshitij Chawla Leonie Lampe Lukas Snoek Marcel Falkiewicz +Maria de Fatima Dias Martin Perez-Guevara Mathias Goncalves Mathias Goncalves diff --git a/.zenodo.json b/.zenodo.json index 19909579b2..44159ebd58 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -263,7 +263,7 @@ }, { "affiliation": "CIBIT, UC", - "name": "Machado, F\u00e1tima", + "name": "Dias, Maria de Fatima", "orcid": "0000-0001-8878-1750" }, { diff --git a/nipype/interfaces/robex/__init__.py b/nipype/interfaces/robex/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/nipype/interfaces/robex/preprocess.py b/nipype/interfaces/robex/preprocess.py new file mode 100644 index 0000000000..85660f8211 --- /dev/null +++ b/nipype/interfaces/robex/preprocess.py @@ -0,0 +1,69 @@ +import os +from pathlib import Path + +from nipype.interfaces.base import ( + TraitedSpec, + CommandLineInputSpec, + CommandLine, + File, + traits, + isdefined, +) +from nipype.utils.filemanip import split_filename + + +class RobexInputSpec(CommandLineInputSpec): + in_file = File( + desc="Input volume", exists=True, mandatory=True, position=0, argstr="%s" + ) + out_file = File( + desc="Output volume", + position=1, + argstr="%s", + hash_files=False, + name_template='%s_brain', + name_source=["in_file"], + keep_extension=True, + ) + out_mask = File( + desc="Output mask", + position=2, + argstr="%s", + hash_files=False, + name_template='%s_brainmask', + name_source=["in_file"], + keep_extension=True, + ) + seed = traits.Int(desc="Seed for random number generator", position=3, argstr="%i") + + +class RobexOutputSpec(TraitedSpec): + out_file = File(desc="Output volume") + out_mask = File(desc="Output mask") + + +class RobexSegment(CommandLine): + """ + + ROBEX is an automatic whole-brain extraction tool for T1-weighted MRI data (commonly known as skull stripping). + ROBEX aims for robust skull-stripping across datasets with no parameter settings. It fits a triangular mesh, + constrained by a shape model, to the probabilistic output of a supervised brain boundary classifier. + Because the shape model cannot perfectly accommodate unseen cases, a small free deformation is subsequently allowed. + The deformation is optimized using graph cuts. + The method ROBEX is based on was published in IEEE Transactions on Medical Imaging; + please visit the website http://www.jeiglesias.com to download the paper. + + Examples + -------- + >>> from nipype.interfaces.robex.preprocess import RobexSegment + >>> robex = RobexSegment() + >>> robex.inputs.in_file = 'structural.nii' + >>> robex.cmdline + 'runROBEX.sh structural.nii structural_brain.nii structural_brainmask.nii' + >>> robex.run() # doctest: +SKIP + + """ + + input_spec = RobexInputSpec + output_spec = RobexOutputSpec + _cmd = 'runROBEX.sh' diff --git a/nipype/interfaces/robex/tests/__init__.py b/nipype/interfaces/robex/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/nipype/interfaces/robex/tests/test_auto_RobexSegment.py b/nipype/interfaces/robex/tests/test_auto_RobexSegment.py new file mode 100644 index 0000000000..caccd469e3 --- /dev/null +++ b/nipype/interfaces/robex/tests/test_auto_RobexSegment.py @@ -0,0 +1,63 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from ..preprocess import RobexSegment + + +def test_RobexSegment_inputs(): + input_map = dict( + args=dict( + argstr="%s", + ), + environ=dict( + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=0, + ), + out_file=dict( + argstr="%s", + extensions=None, + hash_files=False, + keep_extension=True, + name_source=["in_file"], + name_template="%s_brain", + position=1, + ), + out_mask=dict( + argstr="%s", + extensions=None, + hash_files=False, + keep_extension=True, + name_source=["in_file"], + name_template="%s_brainmask", + position=2, + ), + seed=dict( + argstr="%i", + position=3, + ), + ) + inputs = RobexSegment.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_RobexSegment_outputs(): + output_map = dict( + out_file=dict( + extensions=None, + ), + out_mask=dict( + extensions=None, + ), + ) + outputs = RobexSegment.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value