jdata 0.9.4__tar.gz → 0.9.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {jdata-0.9.4/jdata.egg-info → jdata-0.9.5}/PKG-INFO +2 -2
  2. {jdata-0.9.4 → jdata-0.9.5}/README.md +1 -1
  3. {jdata-0.9.4 → jdata-0.9.5}/jdata/__init__.py +1 -1
  4. {jdata-0.9.4 → jdata-0.9.5}/jdata/jfile.py +1 -1
  5. {jdata-0.9.4 → jdata-0.9.5}/jdata/jnifti.py +8 -18
  6. {jdata-0.9.4 → jdata-0.9.5/jdata.egg-info}/PKG-INFO +2 -2
  7. {jdata-0.9.4 → jdata-0.9.5}/pyproject.toml +1 -1
  8. {jdata-0.9.4 → jdata-0.9.5}/setup.py +1 -1
  9. {jdata-0.9.4 → jdata-0.9.5}/LICENSE.txt +0 -0
  10. {jdata-0.9.4 → jdata-0.9.5}/MANIFEST.in +0 -0
  11. {jdata-0.9.4 → jdata-0.9.5}/jdata/__main__.py +0 -0
  12. {jdata-0.9.4 → jdata-0.9.5}/jdata/csvtsv.py +0 -0
  13. {jdata-0.9.4 → jdata-0.9.5}/jdata/h5.py +0 -0
  14. {jdata-0.9.4 → jdata-0.9.5}/jdata/jdata.py +0 -0
  15. {jdata-0.9.4 → jdata-0.9.5}/jdata/jdictionary.py +0 -0
  16. {jdata-0.9.4 → jdata-0.9.5}/jdata/jgifti.py +0 -0
  17. {jdata-0.9.4 → jdata-0.9.5}/jdata/jpath.py +0 -0
  18. {jdata-0.9.4 → jdata-0.9.5}/jdata/jschema.py +0 -0
  19. {jdata-0.9.4 → jdata-0.9.5}/jdata/neurojson.py +0 -0
  20. {jdata-0.9.4 → jdata-0.9.5}/jdata/njprep.py +0 -0
  21. {jdata-0.9.4 → jdata-0.9.5}/jdata.egg-info/SOURCES.txt +0 -0
  22. {jdata-0.9.4 → jdata-0.9.5}/jdata.egg-info/dependency_links.txt +0 -0
  23. {jdata-0.9.4 → jdata-0.9.5}/jdata.egg-info/requires.txt +0 -0
  24. {jdata-0.9.4 → jdata-0.9.5}/jdata.egg-info/top_level.txt +0 -0
  25. {jdata-0.9.4 → jdata-0.9.5}/setup.cfg +0 -0
  26. {jdata-0.9.4 → jdata-0.9.5}/test/test_comprehensive.py +0 -0
  27. {jdata-0.9.4 → jdata-0.9.5}/test/testgifti.py +0 -0
  28. {jdata-0.9.4 → jdata-0.9.5}/test/testjd.py +0 -0
  29. {jdata-0.9.4 → jdata-0.9.5}/test/testjdict.py +0 -0
  30. {jdata-0.9.4 → jdata-0.9.5}/test/testneuroj.py +0 -0
  31. {jdata-0.9.4 → jdata-0.9.5}/test/testnifti.py +0 -0
  32. {jdata-0.9.4 → jdata-0.9.5}/test/testsnirf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jdata
3
- Version: 0.9.4
3
+ Version: 0.9.5
4
4
  Summary: JSON/binary JSON formats for exchanging Python and Numpy data
5
5
  Home-page: https://github.com/NeuroJSON/pyjdata
6
6
  Author: Qianqian Fang
@@ -74,7 +74,7 @@ Dynamic: platform
74
74
 
75
75
  - Copyright: (C) Qianqian Fang (2019-2026) <q.fang at neu.edu>
76
76
  - License: Apache License, Version 2.0
77
- - Version: 0.9.3
77
+ - Version: 0.9.4
78
78
  - URL: https://github.com/NeuroJSON/pyjdata
79
79
  - Acknowledgement: This project is supported by US National Institute of Health (NIH)
80
80
  grant [U24-NS124027](https://reporter.nih.gov/project-details/10308329)
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Copyright: (C) Qianqian Fang (2019-2026) <q.fang at neu.edu>
6
6
  - License: Apache License, Version 2.0
7
- - Version: 0.9.3
7
+ - Version: 0.9.4
8
8
  - URL: https://github.com/NeuroJSON/pyjdata
9
9
  - Acknowledgement: This project is supported by US National Institute of Health (NIH)
10
10
  grant [U24-NS124027](https://reporter.nih.gov/project-details/10308329)
@@ -60,7 +60,7 @@ from .jschema import *
60
60
  from .njprep import *
61
61
  from .neurojson import *
62
62
 
63
- __version__ = "0.9.3"
63
+ __version__ = "0.9.5"
64
64
  __all__ = (
65
65
  jdata.__all__
66
66
  + jfile.__all__
@@ -103,7 +103,7 @@ def load(fname, opt=None, **kwargs):
103
103
  if re.match("^https*://", fname):
104
104
  newdata, fname, _ = downloadlink(fname, opt, **kwargs)
105
105
  if newdata:
106
- return newdata[0]
106
+ return newdata
107
107
 
108
108
  spl = os.path.splitext(fname)
109
109
  ext = spl[1].lower()
@@ -71,13 +71,9 @@ def nii2jnii(filename, format="jnii", *varargin, **kwargs):
71
71
  fileinfo = os.stat(hdrfile)
72
72
  if fileinfo.st_size == 0:
73
73
  raise ValueError("specified file does not exist")
74
- header = mmap.mmap(
75
- hdrfile,
76
- 0,
77
- access=mmap.ACCESS_READ,
78
- format=niftiheader[: (fileinfo.st_size < 352)],
79
- )
80
- nii = {"hdr": header[0]}
74
+ with open(hdrfile, "rb") as finput:
75
+ hdrbytes = finput.read()
76
+ nii = {"hdr": memmapstream(hdrbytes, niftiheader)}
81
77
 
82
78
  dataendian = sys.byteorder
83
79
 
@@ -92,13 +88,7 @@ def nii2jnii(filename, format="jnii", *varargin, **kwargs):
92
88
  if "gzdata" in locals():
93
89
  nii["hdr"] = memmapstream(gzdata, niftiheader)
94
90
  else:
95
- header = mmap.mmap(
96
- hdrfile,
97
- 0,
98
- access=mmap.ACCESS_READ,
99
- format=niftiheader[: (fileinfo.st_size < 352)],
100
- )
101
- nii["hdr"] = header[0]
91
+ nii["hdr"] = memmapstream(hdrbytes, niftiheader)
102
92
 
103
93
  if nii["hdr"]["dim"][0] > 7:
104
94
  names = list(nii["hdr"].keys())
@@ -186,7 +176,7 @@ def nii2jnii(filename, format="jnii", *varargin, **kwargs):
186
176
  if re.search(r"\.[Hh][Dd][Rr](\.[Gg][Zz])*$", filename):
187
177
  filename = re.sub(r"\.[Hh][Dd][Rr](\.[Gg][Zz])*$", ".img\g<1>", filename)
188
178
 
189
- imgbytenum = np.prod(nii["hdr"]["dim"][1 : nii["hdr"]["dim"][0] + 1]) * nii["voxelbyte"]
179
+ imgbytenum = int(np.prod(nii["hdr"]["dim"][1 : nii["hdr"]["dim"][0] + 1]) * nii["voxelbyte"])
190
180
 
191
181
  if isnii == 0 and re.search(r"\.[Gg][Zz]$", filename):
192
182
  with open(filename, "rb") as finput:
@@ -1301,13 +1291,13 @@ def loadjnifti(filename, *args, **kwargs):
1301
1291
  jnii['NIFTIData'] - the main image data array
1302
1292
  jnii['NIFTIExtension'] - a list containing the extension data buffers
1303
1293
  """
1304
- if not filename.endswith((".nii", ".jnii", ".bnii")):
1294
+ if not filename.endswith((".nii", ".nii.gz", ".jnii", ".bnii")):
1305
1295
  raise ValueError(
1306
1296
  "File suffix must be .jnii for text JNIfTI, .bnii for binary JNIfTI or .nii for NIFTI-1/2 files"
1307
1297
  )
1308
1298
 
1309
- if filename.endswith(".nii"):
1310
- nii = loadnifti(filename, **kwargs)
1299
+ if filename.endswith((".nii", ".nii.gz")):
1300
+ jnii = loadnifti(filename, **kwargs)
1311
1301
  elif filename.endswith(".jnii"):
1312
1302
  # Assuming loadjson is available from JSONLab
1313
1303
  jnii = jd.load(filename, *args, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jdata
3
- Version: 0.9.4
3
+ Version: 0.9.5
4
4
  Summary: JSON/binary JSON formats for exchanging Python and Numpy data
5
5
  Home-page: https://github.com/NeuroJSON/pyjdata
6
6
  Author: Qianqian Fang
@@ -74,7 +74,7 @@ Dynamic: platform
74
74
 
75
75
  - Copyright: (C) Qianqian Fang (2019-2026) <q.fang at neu.edu>
76
76
  - License: Apache License, Version 2.0
77
- - Version: 0.9.3
77
+ - Version: 0.9.4
78
78
  - URL: https://github.com/NeuroJSON/pyjdata
79
79
  - Acknowledgement: This project is supported by US National Institute of Health (NIH)
80
80
  grant [U24-NS124027](https://reporter.nih.gov/project-details/10308329)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jdata"
7
- version = "0.9.4"
7
+ version = "0.9.5"
8
8
  description = "JSON/binary JSON formats for exchanging Python and Numpy data"
9
9
  readme = "README.md"
10
10
  license = {text = "Apache-2.0"}
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
  setup(
7
7
  name="jdata",
8
8
  packages=["jdata"],
9
- version="0.9.3",
9
+ version="0.9.5",
10
10
  license="Apache license 2.0",
11
11
  description="JSON/binary JSON formats for exchanging Python and Numpy data",
12
12
  long_description=readme,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes