-
Notifications
You must be signed in to change notification settings - Fork 533
Enh/newvistainterfaces #760
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d63901f
Created interface for vimage2nifti command from lipvia vista package
18363f9
updated CHANGES log
2961958
added test for Vnifti2Image interface
8692b48
Added VtoMat vista interface and updated CHANGES and autogenerated tests
ae34805
cleanup
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
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,3 @@ | ||
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- | ||
# vi: set ft=python sts=4 ts=4 sw=4 et: | ||
from .vista import (Vnifti2Image, VtoMat) |
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,44 @@ | ||
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT | ||
from nipype.testing import assert_equal | ||
from nipype.interfaces.vista.vista import Vnifti2Image | ||
def test_Vnifti2Image_inputs(): | ||
input_map = dict(ignore_exception=dict(nohash=True, | ||
usedefault=True, | ||
), | ||
out_file=dict(hash_files=False, | ||
name_template='%s.v', | ||
name_source=['in_file'], | ||
keep_extension=False, | ||
position=-1, | ||
argstr='-out %s', | ||
), | ||
args=dict(argstr='%s', | ||
), | ||
terminal_output=dict(nohash=True, | ||
mandatory=True, | ||
), | ||
environ=dict(nohash=True, | ||
usedefault=True, | ||
), | ||
in_file=dict(position=1, | ||
mandatory=True, | ||
argstr='-in %s', | ||
), | ||
attributes=dict(position=2, | ||
mandatory=False, | ||
argstr='-attr %s', | ||
), | ||
) | ||
inputs = Vnifti2Image.input_spec() | ||
|
||
for key, metadata in input_map.items(): | ||
for metakey, value in metadata.items(): | ||
yield assert_equal, getattr(inputs.traits()[key], metakey), value | ||
def test_Vnifti2Image_outputs(): | ||
output_map = dict(out_file=dict(), | ||
) | ||
outputs = Vnifti2Image.output_spec() | ||
|
||
for key, metadata in output_map.items(): | ||
for metakey, value in metadata.items(): | ||
yield assert_equal, getattr(outputs.traits()[key], metakey), value |
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,40 @@ | ||
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT | ||
from nipype.testing import assert_equal | ||
from nipype.interfaces.vista.vista import VtoMat | ||
def test_VtoMat_inputs(): | ||
input_map = dict(ignore_exception=dict(nohash=True, | ||
usedefault=True, | ||
), | ||
out_file=dict(hash_files=False, | ||
name_template='%s.mat', | ||
name_source=['in_file'], | ||
keep_extension=False, | ||
position=-1, | ||
argstr='-out %s', | ||
), | ||
args=dict(argstr='%s', | ||
), | ||
terminal_output=dict(nohash=True, | ||
mandatory=True, | ||
), | ||
environ=dict(nohash=True, | ||
usedefault=True, | ||
), | ||
in_file=dict(position=1, | ||
mandatory=True, | ||
argstr='-in %s', | ||
), | ||
) | ||
inputs = VtoMat.input_spec() | ||
|
||
for key, metadata in input_map.items(): | ||
for metakey, value in metadata.items(): | ||
yield assert_equal, getattr(inputs.traits()[key], metakey), value | ||
def test_VtoMat_outputs(): | ||
output_map = dict(out_file=dict(), | ||
) | ||
outputs = VtoMat.output_spec() | ||
|
||
for key, metadata in output_map.items(): | ||
for metakey, value in metadata.items(): | ||
yield assert_equal, getattr(outputs.traits()[key], metakey), value |
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,70 @@ | ||
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- | ||
# vi: set ft=python sts=4 ts=4 sw=4 et: | ||
""" | ||
Change directory to provide relative paths for doctests | ||
>>> import os | ||
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) | ||
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) | ||
>>> os.chdir(datadir) | ||
|
||
""" | ||
|
||
from nipype.interfaces.base import CommandLineInputSpec, CommandLine, traits, TraitedSpec, File | ||
from nipype.utils.filemanip import split_filename | ||
import os, os.path as op | ||
from nipype.interfaces.traits_extension import isdefined | ||
|
||
class Vnifti2ImageInputSpec(CommandLineInputSpec): | ||
in_file = File(exists=True, argstr='-in %s', mandatory=True, position=1, desc='in file') | ||
attributes = File(exists=True, argstr='-attr %s', mandatory=False, position=2, desc='attribute file') | ||
out_file = File(name_template="%s.v", keep_extension=False, argstr='-out %s', hash_files=False, | ||
position= -1, desc='output data file', name_source=["in_file"]) | ||
|
||
class Vnifti2ImageOutputSpec(TraitedSpec): | ||
out_file = File(exists=True, desc='Output vista file') | ||
|
||
class Vnifti2Image(CommandLine): | ||
""" | ||
Convert a nifti file into a vista file. | ||
|
||
Example | ||
------- | ||
|
||
>>> vimage = Vnifti2Image() | ||
>>> vimage.inputs.in_file = 'image.nii' | ||
>>> vimage.cmdline | ||
'vnifti2image -in image.nii -out image.v' | ||
>>> vimage.run() # doctest: +SKIP | ||
""" | ||
|
||
_cmd = 'vnifti2image' | ||
input_spec=Vnifti2ImageInputSpec | ||
output_spec=Vnifti2ImageOutputSpec | ||
|
||
|
||
class VtoMatInputSpec(CommandLineInputSpec): | ||
in_file = File(exists=True, argstr='-in %s', mandatory=True, position=1, desc='in file') | ||
out_file = File(name_template="%s.mat", keep_extension=False, argstr='-out %s', hash_files=False, | ||
position= -1, desc='output mat file', name_source=["in_file"]) | ||
|
||
class VtoMatOutputSpec(TraitedSpec): | ||
out_file = File(exists=True, desc='Output mat file') | ||
|
||
class VtoMat(CommandLine): | ||
""" | ||
Convert a nifti file into a vista file. | ||
|
||
Example | ||
------- | ||
|
||
>>> vimage = VtoMat() | ||
>>> vimage.inputs.in_file = 'image.v' | ||
>>> vimage.cmdline | ||
'vtomat -in image.v -out image.mat' | ||
>>> vimage.run() # doctest: +SKIP | ||
""" | ||
|
||
_cmd = 'vtomat' | ||
input_spec=VtoMatInputSpec | ||
output_spec=VtoMatOutputSpec | ||
|
Empty file.
Empty file.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we display the command line here? and for the next interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added them :)