-
Notifications
You must be signed in to change notification settings - Fork 265
WIP: add GIFTI to nib.load/save (and enable non-SpatialImage classes in load/save) #360
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 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cab9b71
Make Gifti extend FileBasedImage, implement from_file_obj, to_file_obj.
a0c04f9
Deprecate giftiio
6733a46
STY: Ignore output of coverage --html
ad0225e
Make GIFTI call superclass __init__
2fdc088
STY: PEP8 and import cleanup
effigies 6fc6899
Code cleanup for @effigies code review.
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 |
---|---|---|
|
@@ -62,6 +62,7 @@ dist/ | |
.tox/ | ||
.coverage | ||
.ropeproject/ | ||
htmlcov/ | ||
|
||
# Logs and databases # | ||
###################### | ||
|
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 |
---|---|---|
|
@@ -10,12 +10,15 @@ | |
# Stephan Gerhard, Oktober 2010 | ||
############## | ||
|
||
import os | ||
import codecs | ||
import warnings | ||
|
||
from .parse_gifti_fast import parse_gifti_file | ||
import numpy as np | ||
|
||
|
||
warnings.warn('Please use nibabel.load/save.', DeprecationWarning) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
@np.deprecate_with_doc("Use nibabel.load() instead.") | ||
def read(filename): | ||
""" Load a Gifti image from a file | ||
|
||
|
@@ -29,11 +32,11 @@ def read(filename): | |
img : GiftiImage | ||
Returns a GiftiImage | ||
""" | ||
if not os.path.isfile(filename): | ||
raise IOError("No such file or directory: '%s'" % filename) | ||
return parse_gifti_file(filename) | ||
from ..loadsave import load | ||
return load(filename) | ||
|
||
|
||
@np.deprecate_with_doc("Use nibabel.save() instead.") | ||
def write(image, filename): | ||
""" Save the current image to a new file | ||
|
||
|
@@ -79,6 +82,6 @@ def write(image, filename): | |
|
||
The Gifti file is stored in endian convention of the current machine. | ||
""" | ||
# Our giftis are always utf-8 encoded - see GiftiImage.to_xml | ||
with open(filename, 'wb') as f: | ||
f.write(image.to_xml()) | ||
from ..loadsave import save | ||
return save(image, filename) | ||
|
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
Oops, something went wrong.
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.
Duplicated
valid_exts
.