-
Notifications
You must be signed in to change notification settings - Fork 260
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
WIP: adding Philips XML/REC support #683
Open
grlee77
wants to merge
16
commits into
nipy:master
Choose a base branch
from
grlee77:xmlrec_v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
64ed188
add Philips XML/REC reader.
grlee77 1ff1826
add XMLRECImage support to imageclasses.py
grlee77 df2751e
Assign an enumerated value of -1 in the PAR image_defs header for unr…
grlee77 8c405c1
expand enums_dict using empirically determined values
grlee77 a4636b2
Fix reading strings into image_defs when dtype_format='xml'
grlee77 570a7ed
XMLRECImage: file extensions should be specified in lower case
grlee77 bbeb710
loading from .REC: special case to find .xml when .PAR not present
grlee77 a7a9edc
remove explicit mention of PAR from warning/errors that could also oc…
grlee77 ed43e97
Add XML/REC support to parrec2nii.py
grlee77 5fa6810
refactor/simplify. Do not convert to PAR/REC style names
grlee77 10bf7cc
remove permit_truncated restriction
grlee77 8d62119
minor cleanup
grlee77 d7bf693
XMLRECImage: fix for .REC expected case mismatch
grlee77 fd88ccd
fix misnamed key within strict_sort
grlee77 7048640
fix for conversion of DWI scans where only the trace was retained
grlee77 4068548
fix bug in conversion of Boolean entries from string such as 'N' and 'Y'
grlee77 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 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,10 @@ | ||
#!python | ||
"""XML/REC to NIfTI converter | ||
""" | ||
|
||
# parrec2nii reads XML/REC as well | ||
from nibabel.cmdline.parrec2nii import main | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains 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 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 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 | ||||
---|---|---|---|---|---|---|
|
@@ -19,6 +19,7 @@ | |||||
from .arrayproxy import is_proxy | ||||||
from .py3k import FileNotFoundError | ||||||
from .deprecated import deprecate_with_version | ||||||
from .parrec import PARRECImage | ||||||
|
||||||
|
||||||
def load(filename, **kwargs): | ||||||
|
@@ -46,6 +47,15 @@ def load(filename, **kwargs): | |||||
for image_klass in all_image_classes: | ||||||
is_valid, sniff = image_klass.path_maybe_image(filename, sniff) | ||||||
if is_valid: | ||||||
if image_klass is PARRECImage and '.REC' in filename: | ||||||
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.
Suggested change
|
||||||
# a .REC file can have either a .PAR of .xml header. | ||||||
# This skip case assumes PARRECImage is beforeXMLRECImage in | ||||||
# all_image_classes. | ||||||
par_exists = os.path.exists(filename.replace('.REC', '.PAR')) | ||||||
xml_exists = os.path.exists(filename.replace('.REC', '.xml')) | ||||||
if not par_exists and xml_exists: | ||||||
continue # skip trying .PAR and proceed to .xml | ||||||
print(image_klass) | ||||||
img = image_klass.from_filename(filename, **kwargs) | ||||||
return img | ||||||
|
||||||
|
This file contains 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.
Can you import this inside
load
? See the comment involved in importingNifti*
insave()
:nibabel/nibabel/loadsave.py
Lines 109 to 112 in d5494f3