-
Notifications
You must be signed in to change notification settings - Fork 532
ENH: ROBEX interface #3443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
ENH: ROBEX interface #3443
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
68d67a4
Added robex segment interface
mfmachado 7c211ca
Added ROBEX test.
mfmachado b45a220
Formatted code.
mfmachado 92b0d93
Minor fix.
mfmachado 35ccaa9
Update nipype/interfaces/robex/preprocess.py
mfmachado 90e6b19
Update nipype/interfaces/robex/preprocess.py
mfmachado e44e2d2
Improved example ROBEX.
mfmachado 868d8c7
Improved example ROBEX.
mfmachado e0eddc8
Update nipype/interfaces/robex/preprocess.py
mfmachado 8f29d8b
Replaced Robex test.
mfmachado a62dd8c
Update nipype/interfaces/robex/preprocess.py
effigies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,7 @@ Kshitij Chawla <[email protected]> | |
Leonie Lampe <[email protected]> | ||
Lukas Snoek <[email protected]> | ||
Marcel Falkiewicz <[email protected]> <[email protected]> | ||
Maria de Fatima Dias <[email protected]> <[email protected]> | ||
Martin Perez-Guevara <[email protected]> | ||
Mathias Goncalves <[email protected]> <[email protected]> | ||
Mathias Goncalves <[email protected]> <[email protected]> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.