Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WIP: adding Philips XML/REC support#683

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
grlee77 wants to merge16 commits intonipy:master
base:master
Choose a base branch
Loading
fromgrlee77:xmlrec_v2
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
64ed188
add Philips XML/REC reader.
grlee77Oct 18, 2018
1ff1826
add XMLRECImage support to imageclasses.py
grlee77Oct 18, 2018
df2751e
Assign an enumerated value of -1 in the PAR image_defs header for unr…
grlee77Oct 19, 2018
8c405c1
expand enums_dict using empirically determined values
grlee77Oct 19, 2018
a4636b2
Fix reading strings into image_defs when dtype_format='xml'
grlee77Oct 19, 2018
570a7ed
XMLRECImage: file extensions should be specified in lower case
grlee77Oct 19, 2018
bbeb710
loading from .REC: special case to find .xml when .PAR not present
grlee77Oct 19, 2018
a7a9edc
remove explicit mention of PAR from warning/errors that could also oc…
grlee77Oct 19, 2018
ed43e97
Add XML/REC support to parrec2nii.py
grlee77Oct 19, 2018
5fa6810
refactor/simplify. Do not convert to PAR/REC style names
grlee77Oct 19, 2018
10bf7cc
remove permit_truncated restriction
grlee77Oct 19, 2018
8d62119
minor cleanup
grlee77Oct 19, 2018
d7bf693
XMLRECImage: fix for .REC expected case mismatch
grlee77Oct 22, 2018
fd88ccd
fix misnamed key within strict_sort
grlee77Oct 22, 2018
7048640
fix for conversion of DWI scans where only the trace was retained
grlee77Oct 22, 2018
4068548
fix bug in conversion of Boolean entries from string such as 'N' and 'Y'
grlee77Oct 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Add XML/REC support to parrec2nii.py
Add an xmlrec2nii command line script. This currently is identical to parrec2nii because the underlyingfunction now supports both formats.
  • Loading branch information
@grlee77
grlee77 committedOct 19, 2018
commited43e97467efe65ddda994a836e1fda46d4e7812
10 changes: 10 additions & 0 deletionsbin/xmlrec2nii
View file
Open in desktop
Original file line numberDiff line numberDiff 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()
22 changes: 17 additions & 5 deletionsnibabel/cmdline/parrec2nii.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
import csv
import nibabel
import nibabel.parrec as pr
import nibabel.xmlrec as xr
from nibabel.parrec import one_line
from nibabel.mriutils import calculate_dwell_time, MRIError
import nibabel.nifti1 as nifti1
Expand DownExpand Up@@ -147,7 +148,18 @@ def error(msg, exit_code):

def proc_file(infile, opts):
# figure out the output filename, and see if it exists
basefilename = splitext_addext(os.path.basename(infile))[0]
basefilename, ext = splitext_addext(os.path.basename(infile))[:2]

ext = ext.lower()
if (ext == '.xml' or
(ext == '.rec' and os.path.exists(basefilename + '.xml'))):
pr_module = xr
if opts.permit_truncated:
raise ValueError("The permit_truncated option is not currently "
"supported for .xml/.REC data")
else:
pr_module = pr

if opts.outdir is not None:
# set output path
basefilename = os.path.join(opts.outdir, basefilename)
Expand All@@ -165,10 +177,10 @@ def proc_file(infile, opts):
# load the PAR header and data
scaling = 'dv' if opts.scaling == 'off' else opts.scaling
infile = fname_ext_ul_case(infile)
pr_img =pr.load(infile,
permit_truncated=opts.permit_truncated,
scaling=scaling,
strict_sort=opts.strict_sort)
pr_img =pr_module.load(infile,
permit_truncated=opts.permit_truncated,
scaling=scaling,
strict_sort=opts.strict_sort)
pr_hdr = pr_img.header
affine = pr_hdr.get_affine(origin=opts.origin)
slope, intercept = pr_hdr.get_data_scaling(scaling)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp