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 CHANGED
@@ -9,7 +9,7 @@ from uuid import UUID
9
9
 
10
10
  # local imports
11
11
  from . import jp2box
12
- from .lib.tiff import DATATYPE2FMT
12
+ from .lib._tiff import DATATYPE2FMT
13
13
  from .jp2k import Jp2k
14
14
  from glymur.core import RESTRICTED_ICC_PROFILE
15
15
 
glymur/jp2box.py CHANGED
@@ -51,7 +51,7 @@ from .core import (
51
51
  ANY_ICC_PROFILE,
52
52
  VENDOR_COLOR_METHOD,
53
53
  )
54
- from .lib.tiff import tiff_header, BadTiffTagDatatype
54
+ from .lib._tiff import tiff_header, BadTiffTagDatatype
55
55
  from . import get_option
56
56
  from ._iccprofile import _ICCProfile
57
57
 
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.parse(force=force_parse)
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.parse(force=True)
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.3.0":
529
+ if version.openjpeg_version < "2.4.0":
530
530
  msg = (
531
- "You must have at least version 2.3.0 of OpenJPEG in order to "
532
- "write images."
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.parse(force=True)
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.3.0":
1466
+ if version.openjpeg_version < "2.4.0":
1467
1467
  msg = (
1468
- "You must have at least version 2.3.0 of OpenJPEG "
1469
- "in order to write images."
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.parse()
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 re.match("0|1|2.[012]", version.openjpeg_version):
696
+ if version.openjpeg_version < '2.4.0':
708
697
  msg = (
709
- f"You must have a version of OpenJPEG at least as high as "
710
- f"2.3.0 before you can read JPEG2000 images with glymur. "
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 the read method.
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.3.0":
879
+ if version.openjpeg_version < "2.4.0":
892
880
  msg = (
893
- f"You must have at least version 2.3.0 of OpenJPEG installed "
894
- f"before using this method. Your version of OpenJPEG is "
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
- """Determin the appropriate numpy datatype for an OpenJPEG component.
956
+ """Determine the appropriate numpy datatype for an OpenJPEG component.
970
957
 
971
958
  Parameters
972
959
  ----------