Glymur 0.13.7__py3-none-any.whl → 0.14.0.post1__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/__init__.py +2 -1
- glymur/_core_converter.py +390 -0
- glymur/_iccprofile.py +73 -72
- glymur/codestream.py +385 -308
- glymur/command_line.py +129 -1
- glymur/config.py +15 -14
- glymur/core.py +18 -22
- glymur/jp2box.py +758 -576
- glymur/jp2k.py +185 -149
- glymur/jp2kr.py +59 -45
- glymur/jpeg.py +196 -0
- glymur/lib/openjp2.py +198 -285
- glymur/lib/tiff.py +1251 -1127
- glymur/options.py +33 -28
- glymur/tiff.py +77 -406
- glymur/version.py +1 -1
- {Glymur-0.13.7.dist-info → glymur-0.14.0.post1.dist-info}/METADATA +5 -3
- glymur-0.14.0.post1.dist-info/RECORD +27 -0
- {Glymur-0.13.7.dist-info → glymur-0.14.0.post1.dist-info}/WHEEL +1 -1
- {Glymur-0.13.7.dist-info → glymur-0.14.0.post1.dist-info}/entry_points.txt +1 -0
- Glymur-0.13.7.dist-info/RECORD +0 -25
- {Glymur-0.13.7.dist-info → glymur-0.14.0.post1.dist-info/licenses}/LICENSE.txt +0 -0
- {Glymur-0.13.7.dist-info → glymur-0.14.0.post1.dist-info}/top_level.txt +0 -0
glymur/options.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Manage glymur configuration settings."""
|
|
2
|
+
|
|
2
3
|
# Standard library imports
|
|
3
4
|
import copy
|
|
4
5
|
import warnings
|
|
@@ -9,11 +10,11 @@ from .lib import openjp2 as opj2
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
_original_options = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
"lib.num_threads": 1,
|
|
14
|
+
"parse.full_codestream": False,
|
|
15
|
+
"print.xml": True,
|
|
16
|
+
"print.codestream": True,
|
|
17
|
+
"print.short": False,
|
|
17
18
|
}
|
|
18
19
|
_options = copy.deepcopy(_original_options)
|
|
19
20
|
|
|
@@ -67,18 +68,18 @@ def set_option(key, value):
|
|
|
67
68
|
get_option
|
|
68
69
|
"""
|
|
69
70
|
if key not in _options.keys():
|
|
70
|
-
raise KeyError(f
|
|
71
|
+
raise KeyError(f"{key} not valid.")
|
|
71
72
|
|
|
72
|
-
if key ==
|
|
73
|
-
if version.openjpeg_version <
|
|
73
|
+
if key == "lib.num_threads":
|
|
74
|
+
if version.openjpeg_version < "2.2.0":
|
|
74
75
|
msg = (
|
|
75
|
-
f
|
|
76
|
-
f
|
|
77
|
-
f
|
|
76
|
+
f"Thread support is not available on versions of OpenJPEG "
|
|
77
|
+
f"prior to 2.2.0. Your version is "
|
|
78
|
+
f"{version.openjpeg_version}."
|
|
78
79
|
)
|
|
79
80
|
raise RuntimeError(msg)
|
|
80
81
|
if not opj2.has_thread_support():
|
|
81
|
-
msg =
|
|
82
|
+
msg = "The OpenJPEG library is not configured with thread support."
|
|
82
83
|
raise RuntimeError(msg)
|
|
83
84
|
|
|
84
85
|
_options[key] = value
|
|
@@ -128,39 +129,43 @@ def reset_option(key):
|
|
|
128
129
|
Name of a single option.
|
|
129
130
|
"""
|
|
130
131
|
global _options
|
|
131
|
-
if key ==
|
|
132
|
+
if key == "all":
|
|
132
133
|
_options = copy.deepcopy(_original_options)
|
|
133
134
|
else:
|
|
134
135
|
if key not in _options.keys():
|
|
135
|
-
raise KeyError(f
|
|
136
|
+
raise KeyError(f"{key} not valid.")
|
|
136
137
|
_options[key] = _original_options[key]
|
|
137
138
|
|
|
138
139
|
|
|
139
140
|
def set_parseoptions(full_codestream=True):
|
|
140
|
-
warnings.warn(
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
warnings.warn(
|
|
142
|
+
"Use set_option instead of set_parseoptions.", DeprecationWarning
|
|
143
|
+
)
|
|
144
|
+
set_option("parse.full_codestream", full_codestream)
|
|
143
145
|
|
|
144
146
|
|
|
145
147
|
def get_parseoptions():
|
|
146
|
-
warnings.warn(
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
warnings.warn(
|
|
149
|
+
"Use set_option instead of set_parseoptions.", DeprecationWarning
|
|
150
|
+
)
|
|
151
|
+
return {"full_codestream": get_option("parse.full_codestream")}
|
|
149
152
|
|
|
150
153
|
|
|
151
154
|
def set_printoptions(**kwargs):
|
|
152
|
-
warnings.warn(
|
|
153
|
-
|
|
155
|
+
warnings.warn(
|
|
156
|
+
"Use set_option instead of set_printoptions.", DeprecationWarning
|
|
157
|
+
)
|
|
154
158
|
for key, value in kwargs.items():
|
|
155
|
-
if key not in [
|
|
159
|
+
if key not in ["short", "xml", "codestream"]:
|
|
156
160
|
raise KeyError(f'"{key}" not a valid keyword parameter.')
|
|
157
|
-
set_option(
|
|
161
|
+
set_option("print." + key, value)
|
|
158
162
|
|
|
159
163
|
|
|
160
164
|
def get_printoptions():
|
|
161
|
-
warnings.warn(
|
|
162
|
-
|
|
165
|
+
warnings.warn(
|
|
166
|
+
"Use get_option instead of get_printoptions.", DeprecationWarning
|
|
167
|
+
)
|
|
163
168
|
d = {}
|
|
164
|
-
for key in [
|
|
165
|
-
d[key] = _options[
|
|
169
|
+
for key in ["short", "xml", "codestream"]:
|
|
170
|
+
d[key] = _options["print." + key]
|
|
166
171
|
return d
|