Glymur 0.14.1.post1__py3-none-any.whl → 0.14.4__py3-none-any.whl
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.
- glymur/_core_converter.py +1 -1
- glymur/jp2box.py +1 -1
- glymur/jp2k.py +9 -9
- glymur/jp2kr.py +18 -31
- glymur/lib/_tiff.py +2142 -0
- glymur/lib/tiff.py +6 -2138
- glymur/options.py +3 -4
- glymur/tiff.py +2 -2
- glymur/version.py +2 -2
- {glymur-0.14.1.post1.dist-info → glymur-0.14.4.dist-info}/METADATA +2 -1
- glymur-0.14.4.dist-info/RECORD +28 -0
- {glymur-0.14.1.post1.dist-info → glymur-0.14.4.dist-info}/WHEEL +1 -1
- glymur-0.14.1.post1.dist-info/RECORD +0 -27
- {glymur-0.14.1.post1.dist-info → glymur-0.14.4.dist-info}/entry_points.txt +0 -0
- {glymur-0.14.1.post1.dist-info → glymur-0.14.4.dist-info}/licenses/LICENSE.txt +0 -0
- {glymur-0.14.1.post1.dist-info → glymur-0.14.4.dist-info}/top_level.txt +0 -0
glymur/_core_converter.py
CHANGED
glymur/jp2box.py
CHANGED
glymur/jp2k.py
CHANGED
|
@@ -216,7 +216,7 @@ class Jp2k(Jp2kr):
|
|
|
216
216
|
force : bool
|
|
217
217
|
If true, then run finalize operations
|
|
218
218
|
"""
|
|
219
|
-
self.
|
|
219
|
+
self._parse(force=force_parse)
|
|
220
220
|
|
|
221
221
|
if (
|
|
222
222
|
self._capture_resolution is None
|
|
@@ -256,7 +256,7 @@ class Jp2k(Jp2kr):
|
|
|
256
256
|
temp_filename = self.filename + ".tmp"
|
|
257
257
|
self.wrap(temp_filename, boxes=self.box)
|
|
258
258
|
shutil.move(temp_filename, self.filename)
|
|
259
|
-
self.
|
|
259
|
+
self._parse(force=True)
|
|
260
260
|
|
|
261
261
|
def _validate_kwargs(self):
|
|
262
262
|
"""Validate keyword parameters passed to the constructor."""
|
|
@@ -526,10 +526,10 @@ class Jp2k(Jp2kr):
|
|
|
526
526
|
This method can only be used to create JPEG 2000 images that can fit
|
|
527
527
|
in memory.
|
|
528
528
|
"""
|
|
529
|
-
if version.openjpeg_version < "2.
|
|
529
|
+
if version.openjpeg_version < "2.4.0":
|
|
530
530
|
msg = (
|
|
531
|
-
"
|
|
532
|
-
"
|
|
531
|
+
"The minimum supported version of OpenJPEG is 2.4.0. "
|
|
532
|
+
f"Your version is {version.openjpeg_version}."
|
|
533
533
|
)
|
|
534
534
|
raise RuntimeError(msg)
|
|
535
535
|
|
|
@@ -817,7 +817,7 @@ class Jp2k(Jp2kr):
|
|
|
817
817
|
with self.path.open("ab") as ofile:
|
|
818
818
|
box.write(ofile)
|
|
819
819
|
|
|
820
|
-
self.
|
|
820
|
+
self._parse(force=True)
|
|
821
821
|
|
|
822
822
|
def wrap(self, filename, boxes=None):
|
|
823
823
|
"""
|
|
@@ -1463,10 +1463,10 @@ class _TileWriter(object):
|
|
|
1463
1463
|
"""Write image data to a JP2/JPX/J2k file. Intended usage of the
|
|
1464
1464
|
various parameters follows that of OpenJPEG's opj_compress utility.
|
|
1465
1465
|
"""
|
|
1466
|
-
if version.openjpeg_version < "2.
|
|
1466
|
+
if version.openjpeg_version < "2.4.0":
|
|
1467
1467
|
msg = (
|
|
1468
|
-
"
|
|
1469
|
-
"
|
|
1468
|
+
"The minimum supported version of OpenJPEG is 2.4.0. "
|
|
1469
|
+
f"Your version is {version.openjpeg_version}."
|
|
1470
1470
|
)
|
|
1471
1471
|
raise RuntimeError(msg)
|
|
1472
1472
|
|
glymur/jp2kr.py
CHANGED
|
@@ -12,7 +12,6 @@ from __future__ import annotations
|
|
|
12
12
|
from contextlib import ExitStack
|
|
13
13
|
import ctypes
|
|
14
14
|
import pathlib
|
|
15
|
-
import re
|
|
16
15
|
import struct
|
|
17
16
|
import sys
|
|
18
17
|
import warnings
|
|
@@ -107,7 +106,7 @@ class Jp2kr(Jp2kBox):
|
|
|
107
106
|
if not self.path.exists():
|
|
108
107
|
raise FileNotFoundError(f"{self.filename} does not exist.")
|
|
109
108
|
|
|
110
|
-
self.
|
|
109
|
+
self._parse()
|
|
111
110
|
self._initialize_shape()
|
|
112
111
|
|
|
113
112
|
def _initialize_shape(self):
|
|
@@ -393,6 +392,15 @@ class Jp2kr(Jp2kBox):
|
|
|
393
392
|
return "\n".join(metadata)
|
|
394
393
|
|
|
395
394
|
def parse(self, force=False):
|
|
395
|
+
"""
|
|
396
|
+
.. deprecated:: 0.15.0
|
|
397
|
+
"""
|
|
398
|
+
breakpoint()
|
|
399
|
+
msg = "Deprecated, do not use."
|
|
400
|
+
warnings.warn(msg, DeprecationWarning)
|
|
401
|
+
self._parse(force=force)
|
|
402
|
+
|
|
403
|
+
def _parse(self, force=False):
|
|
396
404
|
"""Parses the JPEG 2000 file.
|
|
397
405
|
|
|
398
406
|
Parameters
|
|
@@ -633,25 +641,6 @@ class Jp2kr(Jp2kBox):
|
|
|
633
641
|
# Ok, 3 arguments in pargs.
|
|
634
642
|
return data[:, :, bands]
|
|
635
643
|
|
|
636
|
-
def read(self, **kwargs):
|
|
637
|
-
"""Read a JPEG 2000 image.
|
|
638
|
-
|
|
639
|
-
.. deprecated:: 0.13.5
|
|
640
|
-
Use numpy-style slicing instead.
|
|
641
|
-
|
|
642
|
-
Returns
|
|
643
|
-
-------
|
|
644
|
-
img_array : ndarray
|
|
645
|
-
The image data.
|
|
646
|
-
"""
|
|
647
|
-
|
|
648
|
-
if "ignore_pclr_cmap_cdef" in kwargs:
|
|
649
|
-
self.ignore_pclr_cmap_cdef = kwargs["ignore_pclr_cmap_cdef"]
|
|
650
|
-
kwargs.pop("ignore_pclr_cmap_cdef")
|
|
651
|
-
warnings.warn("Use array-style slicing instead.", DeprecationWarning)
|
|
652
|
-
img = self._read(**kwargs)
|
|
653
|
-
return img
|
|
654
|
-
|
|
655
644
|
def _subsampling_sanity_check(self):
|
|
656
645
|
"""Check for differing subsample factors."""
|
|
657
646
|
if self._decoded_components is None:
|
|
@@ -704,11 +693,10 @@ class Jp2kr(Jp2kBox):
|
|
|
704
693
|
RuntimeError
|
|
705
694
|
If the image has differing subsample factors.
|
|
706
695
|
"""
|
|
707
|
-
if
|
|
696
|
+
if version.openjpeg_version < '2.4.0':
|
|
708
697
|
msg = (
|
|
709
|
-
|
|
710
|
-
f"
|
|
711
|
-
f"Your version is {version.openjpeg_version}"
|
|
698
|
+
"The minimum supported version of OpenJPEG is 2.4.0. "
|
|
699
|
+
f"Your version is {version.openjpeg_version}."
|
|
712
700
|
)
|
|
713
701
|
raise RuntimeError(msg)
|
|
714
702
|
|
|
@@ -854,7 +842,7 @@ class Jp2kr(Jp2kBox):
|
|
|
854
842
|
|
|
855
843
|
The only time you should ever use this method is when the image has
|
|
856
844
|
different subsampling factors across components. Otherwise you should
|
|
857
|
-
use
|
|
845
|
+
use numpy-style slicing.
|
|
858
846
|
|
|
859
847
|
Parameters
|
|
860
848
|
----------
|
|
@@ -888,11 +876,10 @@ class Jp2kr(Jp2kBox):
|
|
|
888
876
|
>>> jp = glymur.Jp2k(jfile)
|
|
889
877
|
>>> components_lst = jp.read_bands(rlevel=1)
|
|
890
878
|
"""
|
|
891
|
-
if version.openjpeg_version < "2.
|
|
879
|
+
if version.openjpeg_version < "2.4.0":
|
|
892
880
|
msg = (
|
|
893
|
-
|
|
894
|
-
f"
|
|
895
|
-
f"{version.openjpeg_version}."
|
|
881
|
+
"The minimum supported version of OpenJPEG is 2.4.0. "
|
|
882
|
+
f"Your version is {version.openjpeg_version}."
|
|
896
883
|
)
|
|
897
884
|
raise RuntimeError(msg)
|
|
898
885
|
|
|
@@ -966,7 +953,7 @@ class Jp2kr(Jp2kBox):
|
|
|
966
953
|
return image
|
|
967
954
|
|
|
968
955
|
def _component2dtype(self, component):
|
|
969
|
-
"""
|
|
956
|
+
"""Determine the appropriate numpy datatype for an OpenJPEG component.
|
|
970
957
|
|
|
971
958
|
Parameters
|
|
972
959
|
----------
|