Glymur 0.13.3__tar.gz → 0.13.4__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 (54) hide show
  1. {glymur-0.13.3 → glymur-0.13.4}/CHANGES.txt +4 -0
  2. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/PKG-INFO +1 -1
  3. {glymur-0.13.3 → glymur-0.13.4}/PKG-INFO +1 -1
  4. {glymur-0.13.3 → glymur-0.13.4}/glymur/codestream.py +9 -2
  5. {glymur-0.13.3 → glymur-0.13.4}/glymur/jp2box.py +7 -4
  6. {glymur-0.13.3 → glymur-0.13.4}/glymur/jp2k.py +7 -7
  7. {glymur-0.13.3 → glymur-0.13.4}/glymur/version.py +1 -1
  8. {glymur-0.13.3 → glymur-0.13.4}/setup.cfg +1 -1
  9. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2box.py +11 -1
  10. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2k.py +14 -0
  11. {glymur-0.13.3 → glymur-0.13.4}/tests/test_printing.py +21 -0
  12. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/SOURCES.txt +0 -0
  13. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/dependency_links.txt +0 -0
  14. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/entry_points.txt +0 -0
  15. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/not-zip-safe +0 -0
  16. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/requires.txt +0 -0
  17. {glymur-0.13.3 → glymur-0.13.4}/Glymur.egg-info/top_level.txt +0 -0
  18. {glymur-0.13.3 → glymur-0.13.4}/LICENSE.txt +0 -0
  19. {glymur-0.13.3 → glymur-0.13.4}/MANIFEST.in +0 -0
  20. {glymur-0.13.3 → glymur-0.13.4}/README.md +0 -0
  21. {glymur-0.13.3 → glymur-0.13.4}/glymur/__init__.py +0 -0
  22. {glymur-0.13.3 → glymur-0.13.4}/glymur/_iccprofile.py +0 -0
  23. {glymur-0.13.3 → glymur-0.13.4}/glymur/command_line.py +0 -0
  24. {glymur-0.13.3 → glymur-0.13.4}/glymur/config.py +0 -0
  25. {glymur-0.13.3 → glymur-0.13.4}/glymur/core.py +0 -0
  26. {glymur-0.13.3 → glymur-0.13.4}/glymur/data/__init__.py +0 -0
  27. {glymur-0.13.3 → glymur-0.13.4}/glymur/data/goodstuff.j2k +0 -0
  28. {glymur-0.13.3 → glymur-0.13.4}/glymur/data/heliov.jpx +0 -0
  29. {glymur-0.13.3 → glymur-0.13.4}/glymur/data/nemo.jp2 +0 -0
  30. {glymur-0.13.3 → glymur-0.13.4}/glymur/jp2kr.py +0 -0
  31. {glymur-0.13.3 → glymur-0.13.4}/glymur/lib/__init__.py +0 -0
  32. {glymur-0.13.3 → glymur-0.13.4}/glymur/lib/openjp2.py +0 -0
  33. {glymur-0.13.3 → glymur-0.13.4}/glymur/lib/tiff.py +0 -0
  34. {glymur-0.13.3 → glymur-0.13.4}/glymur/options.py +0 -0
  35. {glymur-0.13.3 → glymur-0.13.4}/glymur/tiff.py +0 -0
  36. {glymur-0.13.3 → glymur-0.13.4}/pyproject.toml +0 -0
  37. {glymur-0.13.3 → glymur-0.13.4}/tests/test_callbacks.py +0 -0
  38. {glymur-0.13.3 → glymur-0.13.4}/tests/test_cinema.py +0 -0
  39. {glymur-0.13.3 → glymur-0.13.4}/tests/test_codestream.py +0 -0
  40. {glymur-0.13.3 → glymur-0.13.4}/tests/test_colour_specification_box.py +0 -0
  41. {glymur-0.13.3 → glymur-0.13.4}/tests/test_config.py +0 -0
  42. {glymur-0.13.3 → glymur-0.13.4}/tests/test_geo.py +0 -0
  43. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2box_jpx.py +0 -0
  44. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2box_uuid.py +0 -0
  45. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2box_xml.py +0 -0
  46. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2k_writes.py +0 -0
  47. {glymur-0.13.3 → glymur-0.13.4}/tests/test_jp2kr.py +0 -0
  48. {glymur-0.13.3 → glymur-0.13.4}/tests/test_libtiff.py +0 -0
  49. {glymur-0.13.3 → glymur-0.13.4}/tests/test_openjp2.py +0 -0
  50. {glymur-0.13.3 → glymur-0.13.4}/tests/test_set_decoded_components.py +0 -0
  51. {glymur-0.13.3 → glymur-0.13.4}/tests/test_slicing.py +0 -0
  52. {glymur-0.13.3 → glymur-0.13.4}/tests/test_threading.py +0 -0
  53. {glymur-0.13.3 → glymur-0.13.4}/tests/test_tiff2jp2.py +0 -0
  54. {glymur-0.13.3 → glymur-0.13.4}/tests/test_warnings.py +0 -0
@@ -1,3 +1,7 @@
1
+ July 4, 2024 - v0.13.4
2
+ Don't reset openjpeg codec in Jp2k if already set in Jp2kr.
3
+ Update CI configuration to specify openjpeg versions.
4
+
1
5
  June 30, 2024 - v0.13.3
2
6
  Refactor parsing errors and warnings.
3
7
  Update CI configuration for numpy 2.0.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Glymur
3
- Version: 0.13.3
3
+ Version: 0.13.4
4
4
  Home-page: https://github.com/quintusdias/glymur
5
5
  Author: 'John Evans'
6
6
  Author-email: "John Evans" <jevans667cc@proton.me>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Glymur
3
- Version: 0.13.3
3
+ Version: 0.13.4
4
4
  Home-page: https://github.com/quintusdias/glymur
5
5
  Author: 'John Evans'
6
6
  Author-email: "John Evans" <jevans667cc@proton.me>
@@ -736,7 +736,9 @@ class Codestream(object):
736
736
  data = struct.unpack_from('>HIIIIIIIIH', read_buffer)
737
737
 
738
738
  rsiz = data[0]
739
- if rsiz not in _KNOWN_PROFILES:
739
+
740
+ # Bit 14 (16384) signifies HTJ2K (JPH)
741
+ if rsiz not in _KNOWN_PROFILES and not np.bitwise_and(rsiz, 16384):
740
742
  msg = f"Invalid profile: (Rsiz={rsiz})."
741
743
  warnings.warn(msg, UserWarning)
742
744
 
@@ -1666,7 +1668,12 @@ class SIZsegment(Segment):
1666
1668
  try:
1667
1669
  profile = _CAPABILITIES_DISPLAY[self.rsiz]
1668
1670
  except KeyError:
1669
- profile = f'{self.rsiz} (invalid)'
1671
+ if np.bitwise_and(self.rsiz, 16384):
1672
+ # HTJ2K profile that is uninterpreted
1673
+ profile = f'{self.rsiz}'
1674
+ else:
1675
+ # profile unknown
1676
+ profile = f'{self.rsiz} (invalid)'
1670
1677
  msg = msg.format(
1671
1678
  profile=profile,
1672
1679
  height=self.ysiz, width=self.xsiz,
@@ -1259,7 +1259,7 @@ class FileTypeBox(Jp2kBox):
1259
1259
  """
1260
1260
  box_id = 'ftyp'
1261
1261
  longname = 'File Type'
1262
- _valid_cls = ['jp2 ', 'jpx ', 'jpxb']
1262
+ _valid_cls = ['jp2 ', 'jph ', 'jpx ', 'jpxb']
1263
1263
 
1264
1264
  def __init__(
1265
1265
  self, brand='jp2 ', minor_version=0, compatibility_list=None,
@@ -1304,16 +1304,19 @@ class FileTypeBox(Jp2kBox):
1304
1304
  return text
1305
1305
 
1306
1306
  def _validate(self, writing=False):
1307
- """Validate the box before writing to file."""
1308
- if self.brand not in ['jp2 ', 'jpx ']:
1307
+ """
1308
+ Validate the box before writing to file.
1309
+ """
1310
+ if self.brand not in ['jp2 ', 'jpx ', 'jph ']:
1309
1311
  msg = (
1310
1312
  f"The file type brand was '{self.brand}'. "
1311
- f"It should be either 'jp2 ' or 'jpx '."
1313
+ f"It should be either 'jp2 ', 'jpx ', or 'jph '."
1312
1314
  )
1313
1315
  if writing:
1314
1316
  raise InvalidJp2kError(msg)
1315
1317
  else:
1316
1318
  warnings.warn(msg, UserWarning)
1319
+
1317
1320
  for item in self.compatibility_list:
1318
1321
  if item not in self._valid_cls:
1319
1322
  msg = (
@@ -206,13 +206,13 @@ class Jp2k(Jp2kr):
206
206
  # Must be determined when writing.
207
207
  self._shape = None
208
208
 
209
- # If there already was a shape attribute, then don't mess with it,
210
- # it was set by the reader superclass.
211
-
212
- if self.filename[-4:].endswith(('.jp2', '.JP2', '.jpx', 'JPX')):
213
- self._codec_format = opj2.CODEC_JP2
214
- else:
215
- self._codec_format = opj2.CODEC_J2K
209
+ if not hasattr(self, '_codec_format'):
210
+ # Only set codec format if the superclass has not done so, i.e.
211
+ # we are writing instead of reading.
212
+ if self.filename[-4:].endswith(('.jp2', '.JP2', '.jpx', 'JPX')):
213
+ self._codec_format = opj2.CODEC_JP2
214
+ else:
215
+ self._codec_format = opj2.CODEC_J2K
216
216
 
217
217
  self._validate_kwargs()
218
218
 
@@ -20,7 +20,7 @@ from .lib import tiff
20
20
 
21
21
  # Do not change the format of this next line! Doing so risks breaking
22
22
  # setup.py
23
- version = "0.13.3"
23
+ version = "0.13.4"
24
24
 
25
25
  version_tuple = parse(version).release
26
26
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = Glymur
3
- version = 0.13.3
3
+ version = 0.13.4
4
4
  author = 'John Evans'
5
5
  author_email = "John Evans" <jevans667cc@proton.me>
6
6
  license = 'MIT'
@@ -20,7 +20,7 @@ import numpy as np
20
20
 
21
21
  # Local imports ...
22
22
  import glymur
23
- from glymur import Jp2k
23
+ from glymur import Jp2k, Jp2kr
24
24
  from glymur.jp2box import (
25
25
  ColourSpecificationBox, ContiguousCodestreamBox, FileTypeBox,
26
26
  ImageHeaderBox, JP2HeaderBox, JPEG2000SignatureBox, BitsPerComponentBox,
@@ -356,6 +356,16 @@ class TestChannelDefinition(fixtures.TestCommon):
356
356
  class TestFileTypeBox(fixtures.TestCommon):
357
357
  """Test suite for ftyp box issues."""
358
358
 
359
+ def test_jph(self):
360
+ """
361
+ SCENARIO: JPH box
362
+
363
+ EXPECTED RESULT: The brand is verified.
364
+ """
365
+ path = ir.files('tests.data').joinpath('oj-ht-byte.jph')
366
+ j = Jp2kr(path)
367
+ self.assertEqual(j.box[1].brand, 'jph ')
368
+
359
369
  def test_bad_brand_on_parse(self):
360
370
  """
361
371
  SCENARIO: The JP2 file file type box does not contain a valid brand.
@@ -38,6 +38,20 @@ class TestJp2k(fixtures.TestCommon):
38
38
  super().setUp()
39
39
  glymur.reset_option('all')
40
40
 
41
+ @unittest.skipIf(
42
+ glymur.version.openjpeg_version < '2.5.0', "Requires as least v2.5.0"
43
+ )
44
+ def test_read_htj2k(self):
45
+ """
46
+ Scenario: read an HTJ2K (JPH) file using Jp2k
47
+
48
+ Expected response: The size of the image read is verified.
49
+ """
50
+ path = ir.files('tests.data').joinpath('oj-ht-byte.jph')
51
+ j = Jp2k(path)
52
+ d = j[:]
53
+ self.assertEqual(d.shape, (20, 20))
54
+
41
55
  def test_repr(self):
42
56
  """
43
57
  Scenario: run repr on Jp2k object
@@ -1607,6 +1607,27 @@ class TestPrinting(fixtures.TestCommon):
1607
1607
  )
1608
1608
  self.assertEqual(actual, expected)
1609
1609
 
1610
+ def test_jph_rsiz(self):
1611
+ """
1612
+ Scenario: parse a JPH file, print the SIZ segment
1613
+
1614
+ Expected result: no warnings, the output is verified
1615
+ """
1616
+ path = ir.files('tests.data').joinpath('oj-ht-byte.jph')
1617
+
1618
+ with warnings.catch_warnings():
1619
+ warnings.simplefilter('error')
1620
+ j = Jp2k(path)
1621
+ actual = str(j.codestream.segment[1])
1622
+
1623
+ expected = (
1624
+ ir.files('tests.data')
1625
+ .joinpath('jph_siz.txt')
1626
+ .read_text()
1627
+ .rstrip()
1628
+ )
1629
+ self.assertEqual(actual, expected)
1630
+
1610
1631
 
1611
1632
  class TestJp2dump(fixtures.TestCommon):
1612
1633
  """Tests for verifying how jp2dump console script works."""
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes