Glymur 0.13.5__tar.gz → 0.13.7__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.5 → glymur-0.13.7}/CHANGES.txt +11 -0
  2. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/PKG-INFO +4 -3
  3. {glymur-0.13.5 → glymur-0.13.7}/PKG-INFO +4 -3
  4. {glymur-0.13.5 → glymur-0.13.7}/glymur/jp2box.py +4 -4
  5. {glymur-0.13.5 → glymur-0.13.7}/glymur/jp2kr.py +3 -3
  6. {glymur-0.13.5 → glymur-0.13.7}/glymur/tiff.py +1 -1
  7. {glymur-0.13.5 → glymur-0.13.7}/glymur/version.py +1 -1
  8. {glymur-0.13.5 → glymur-0.13.7}/setup.cfg +3 -2
  9. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2box_xml.py +41 -30
  10. {glymur-0.13.5 → glymur-0.13.7}/tests/test_printing.py +2 -1
  11. {glymur-0.13.5 → glymur-0.13.7}/tests/test_tiff2jp2.py +50 -26
  12. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/SOURCES.txt +0 -0
  13. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/dependency_links.txt +0 -0
  14. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/entry_points.txt +0 -0
  15. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/not-zip-safe +0 -0
  16. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/requires.txt +0 -0
  17. {glymur-0.13.5 → glymur-0.13.7}/Glymur.egg-info/top_level.txt +0 -0
  18. {glymur-0.13.5 → glymur-0.13.7}/LICENSE.txt +0 -0
  19. {glymur-0.13.5 → glymur-0.13.7}/MANIFEST.in +0 -0
  20. {glymur-0.13.5 → glymur-0.13.7}/README.md +0 -0
  21. {glymur-0.13.5 → glymur-0.13.7}/glymur/__init__.py +0 -0
  22. {glymur-0.13.5 → glymur-0.13.7}/glymur/_iccprofile.py +0 -0
  23. {glymur-0.13.5 → glymur-0.13.7}/glymur/codestream.py +0 -0
  24. {glymur-0.13.5 → glymur-0.13.7}/glymur/command_line.py +0 -0
  25. {glymur-0.13.5 → glymur-0.13.7}/glymur/config.py +0 -0
  26. {glymur-0.13.5 → glymur-0.13.7}/glymur/core.py +0 -0
  27. {glymur-0.13.5 → glymur-0.13.7}/glymur/data/__init__.py +0 -0
  28. {glymur-0.13.5 → glymur-0.13.7}/glymur/data/goodstuff.j2k +0 -0
  29. {glymur-0.13.5 → glymur-0.13.7}/glymur/data/heliov.jpx +0 -0
  30. {glymur-0.13.5 → glymur-0.13.7}/glymur/data/nemo.jp2 +0 -0
  31. {glymur-0.13.5 → glymur-0.13.7}/glymur/jp2k.py +0 -0
  32. {glymur-0.13.5 → glymur-0.13.7}/glymur/lib/__init__.py +0 -0
  33. {glymur-0.13.5 → glymur-0.13.7}/glymur/lib/openjp2.py +0 -0
  34. {glymur-0.13.5 → glymur-0.13.7}/glymur/lib/tiff.py +0 -0
  35. {glymur-0.13.5 → glymur-0.13.7}/glymur/options.py +0 -0
  36. {glymur-0.13.5 → glymur-0.13.7}/pyproject.toml +0 -0
  37. {glymur-0.13.5 → glymur-0.13.7}/tests/test_callbacks.py +0 -0
  38. {glymur-0.13.5 → glymur-0.13.7}/tests/test_cinema.py +0 -0
  39. {glymur-0.13.5 → glymur-0.13.7}/tests/test_codestream.py +0 -0
  40. {glymur-0.13.5 → glymur-0.13.7}/tests/test_colour_specification_box.py +0 -0
  41. {glymur-0.13.5 → glymur-0.13.7}/tests/test_config.py +0 -0
  42. {glymur-0.13.5 → glymur-0.13.7}/tests/test_geo.py +0 -0
  43. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2box.py +0 -0
  44. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2box_jpx.py +0 -0
  45. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2box_uuid.py +0 -0
  46. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2k.py +0 -0
  47. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2k_writes.py +0 -0
  48. {glymur-0.13.5 → glymur-0.13.7}/tests/test_jp2kr.py +0 -0
  49. {glymur-0.13.5 → glymur-0.13.7}/tests/test_libtiff.py +0 -0
  50. {glymur-0.13.5 → glymur-0.13.7}/tests/test_openjp2.py +0 -0
  51. {glymur-0.13.5 → glymur-0.13.7}/tests/test_set_decoded_components.py +0 -0
  52. {glymur-0.13.5 → glymur-0.13.7}/tests/test_slicing.py +0 -0
  53. {glymur-0.13.5 → glymur-0.13.7}/tests/test_threading.py +0 -0
  54. {glymur-0.13.5 → glymur-0.13.7}/tests/test_warnings.py +0 -0
@@ -1,3 +1,14 @@
1
+ Jan 15, 2025 - v0.13.7
2
+ Qualify on python 3.13
3
+ Fix test warnings due to scikit-image deprecation.
4
+ Update CI test matrix, tighten 3rd party library requirements.
5
+ Add ability to construct XML box from file-like object.
6
+ Add circle-ci CI.
7
+ Fix test suite for numpy 2.x printing (thanks to Arne Keller).
8
+
9
+ Aug 19, 2024 - v0.13.6
10
+ Fix tiff2jp2 when tile coverage not square.
11
+
1
12
  July 26, 2024 - v0.13.5
2
13
  Add support for parsing the CAP segment.
3
14
  End official support for OpenJPEG 2.3.x.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: Glymur
3
- Version: 0.13.5
3
+ Version: 0.13.7
4
4
  Home-page: https://github.com/quintusdias/glymur
5
5
  Author: 'John Evans'
6
6
  Author-email: "John Evans" <jevans667cc@proton.me>
@@ -9,12 +9,13 @@ Classifier: Programming Language :: Python
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
12
13
  Classifier: Programming Language :: Python :: Implementation :: CPython
13
14
  Classifier: License :: OSI Approved :: MIT License
14
15
  Classifier: Intended Audience :: Science/Research
15
16
  Classifier: Operating System :: OS Independent
16
17
  Classifier: Topic :: Scientific/Engineering
17
- Requires-Python: >=3.8
18
+ Requires-Python: >=3.9
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
20
21
  Requires-Dist: numpy
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: Glymur
3
- Version: 0.13.5
3
+ Version: 0.13.7
4
4
  Home-page: https://github.com/quintusdias/glymur
5
5
  Author: 'John Evans'
6
6
  Author-email: "John Evans" <jevans667cc@proton.me>
@@ -9,12 +9,13 @@ Classifier: Programming Language :: Python
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
12
13
  Classifier: Programming Language :: Python :: Implementation :: CPython
13
14
  Classifier: License :: OSI Approved :: MIT License
14
15
  Classifier: Intended Audience :: Science/Research
15
16
  Classifier: Operating System :: OS Independent
16
17
  Classifier: Topic :: Scientific/Engineering
17
- Requires-Python: >=3.8
18
+ Requires-Python: >=3.9
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
20
21
  Requires-Dist: numpy
@@ -2969,9 +2969,9 @@ class XMLBox(Jp2kBox):
2969
2969
  ----------
2970
2970
  xml : ElementTree
2971
2971
  An ElementTree object already existing in python.
2972
- filename : str or path
2973
- File from which to read XML. If filename is not None, then the xml
2974
- keyword argument must be None.
2972
+ filename : file, str, or pathlib.Path
2973
+ File to read. If filename is not None, then the xml keyword
2974
+ argument must be None.
2975
2975
  """
2976
2976
  super().__init__()
2977
2977
  if filename is not None and xml is not None:
@@ -2981,7 +2981,7 @@ class XMLBox(Jp2kBox):
2981
2981
  )
2982
2982
  raise RuntimeError(msg)
2983
2983
  if filename is not None:
2984
- self.xml = ET.parse(str(filename))
2984
+ self.xml = ET.parse(filename)
2985
2985
  else:
2986
2986
  self.xml = xml
2987
2987
  self.length = length
@@ -886,9 +886,9 @@ class Jp2kr(Jp2kBox):
886
886
  def get_codestream(self, header_only=True):
887
887
  """Retrieve codestream.
888
888
 
889
- This differs from the codestream property in that segment
890
- metadata that lies past the end of the codestream header
891
- can be retrieved.
889
+ This differs from the codestream property in that segment
890
+ metadata that lies past the end of the codestream header
891
+ can be retrieved.
892
892
 
893
893
  Parameters
894
894
  ----------
@@ -862,7 +862,7 @@ class Tiff2Jp2k(object):
862
862
  partial_jp2_tile_rows = (self.imageheight / jth) != (self.imageheight // jth) # noqa : E501
863
863
  partial_jp2_tile_cols = (self.imagewidth / jtw) != (self.imagewidth // jtw) # noqa : E501
864
864
 
865
- num_jp2k_tile_rows = int(np.ceil(self.imagewidth / jtw))
865
+ num_jp2k_tile_rows = int(np.ceil(self.imageheight / jth))
866
866
  num_jp2k_tile_cols = int(np.ceil(self.imagewidth / jtw))
867
867
 
868
868
  jp2k_tile_row = int(np.ceil(jp2k_tile_num // num_jp2k_tile_cols))
@@ -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.5"
23
+ version = "0.13.7"
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.5
3
+ version = 0.13.7
4
4
  author = 'John Evans'
5
5
  author_email = "John Evans" <jevans667cc@proton.me>
6
6
  license = 'MIT'
@@ -14,6 +14,7 @@ classifiers =
14
14
  Programming Language :: Python :: 3.10
15
15
  Programming Language :: Python :: 3.11
16
16
  Programming Language :: Python :: 3.12
17
+ Programming Language :: Python :: 3.13
17
18
  Programming Language :: Python :: Implementation :: CPython
18
19
  License :: OSI Approved :: MIT License
19
20
  Intended Audience :: Science/Research
@@ -26,7 +27,7 @@ install_requires =
26
27
  numpy
27
28
  lxml
28
29
  packaging
29
- python_requires = >=3.8
30
+ python_requires = >=3.9
30
31
  include_package_data = True
31
32
  zip_safe = False
32
33
 
@@ -4,8 +4,9 @@ Test suite specifically targeting the JP2 XML box layout.
4
4
  """
5
5
  # Standard library imports
6
6
  import importlib.resources as ir
7
- from io import BytesIO
7
+ from io import BytesIO, StringIO
8
8
  import pathlib
9
+ import shutil
9
10
  import struct
10
11
  import warnings
11
12
 
@@ -30,35 +31,11 @@ class TestXML(fixtures.TestCommon):
30
31
  def setUp(self):
31
32
  super().setUp()
32
33
 
33
- raw_xml = b"""<?xml version="1.0"?>
34
- <data>
35
- <country name="Liechtenstein">
36
- <rank>1</rank>
37
- <year>2008</year>
38
- <gdppc>141100</gdppc>
39
- <neighbor name="Austria" direction="E"/>
40
- <neighbor name="Switzerland" direction="W"/>
41
- </country>
42
- <country name="Singapore">
43
- <rank>4</rank>
44
- <year>2011</year>
45
- <gdppc>59900</gdppc>
46
- <neighbor name="Malaysia" direction="N"/>
47
- </country>
48
- <country name="Panama">
49
- <rank>68</rank>
50
- <year>2011</year>
51
- <gdppc>13600</gdppc>
52
- <neighbor name="Costa Rica" direction="W"/>
53
- <neighbor name="Colombia" direction="E"/>
54
- </country>
55
- </data>"""
56
- path = self.test_dir_path / 'data.xml'
57
- with path.open(mode='wb') as tfile:
58
- tfile.write(raw_xml)
59
- tfile.flush()
60
- self.xmlfile_path = path
61
- self.xmlfile = str(path)
34
+ p = ir.files('tests.data').joinpath('countries.xml')
35
+ dest_path = self.test_dir_path / 'data.xml'
36
+ shutil.copyfile(p, dest_path)
37
+ self.xmlfile_path = dest_path
38
+ self.xmlfile = str(dest_path)
62
39
 
63
40
  j2k = Jp2k(self.j2kfile)
64
41
  codestream = j2k.get_codestream()
@@ -134,6 +111,40 @@ class TestXML(fixtures.TestCommon):
134
111
  self.assertEqual(neighbor.attrib['name'], 'Malaysia')
135
112
  self.assertEqual(neighbor.attrib['direction'], 'N')
136
113
 
114
+ def test_xml_from_bytesio_object(self):
115
+ """
116
+ SCENARIO: Create an xml box by pointing at a file-like BytesIO object
117
+
118
+ EXPECTED RESULT: The xml box is validated.
119
+ """
120
+ btext = self.xmlfile_path.read_bytes()
121
+ b = BytesIO(btext)
122
+ box = glymur.jp2box.XMLBox(filename=b)
123
+
124
+ elts = box.xml.findall('country')
125
+ self.assertEqual(len(elts), 3)
126
+
127
+ neighbor = elts[1].find('neighbor')
128
+ self.assertEqual(neighbor.attrib['name'], 'Malaysia')
129
+ self.assertEqual(neighbor.attrib['direction'], 'N')
130
+
131
+ def test_xml_from_stringio_object(self):
132
+ """
133
+ SCENARIO: Create an xml box by pointing at a file-like StringIO object
134
+
135
+ EXPECTED RESULT: The xml box is validated.
136
+ """
137
+ text = self.xmlfile_path.read_text()
138
+ sio = StringIO(text)
139
+ box = glymur.jp2box.XMLBox(filename=sio)
140
+
141
+ elts = box.xml.findall('country')
142
+ self.assertEqual(len(elts), 3)
143
+
144
+ neighbor = elts[1].find('neighbor')
145
+ self.assertEqual(neighbor.attrib['name'], 'Malaysia')
146
+ self.assertEqual(neighbor.attrib['direction'], 'N')
147
+
137
148
  def test_utf8_xml_from_xml_file(self):
138
149
  """
139
150
  XMLBox from an XML file with encoding declaration.
@@ -1074,7 +1074,8 @@ class TestPrinting(fixtures.TestCommon):
1074
1074
  "array([ 0, 10, 20, ..., 70, 80, 90], dtype=uint32)),\n"
1075
1075
  " ('ExifTag', OrderedDict([('Make', 'HTC')]))])" # noqa : E501
1076
1076
  )
1077
- self.assertEqual(actual, expected)
1077
+ # Numpy 2.x adds shape to string representation
1078
+ self.assertEqual(actual.replace("shape=(10,), ", ""), expected)
1078
1079
 
1079
1080
  def test_crg(self):
1080
1081
  """verify printing of CRG segment"""
@@ -12,6 +12,7 @@ from uuid import UUID
12
12
  import warnings
13
13
 
14
14
  # 3rd party library imports
15
+ from PIL import Image
15
16
  import numpy as np
16
17
  import skimage
17
18
 
@@ -43,6 +44,7 @@ class TestSuite(fixtures.TestCommon):
43
44
  cls.ycbcr_bg = root.joinpath('ycbcr_bg.tif')
44
45
  cls.ycbcr_stripped = root.joinpath('ycbcr_stripped.tif')
45
46
  cls.stripped = root.joinpath('stripped.tif')
47
+ cls.moon63 = root.joinpath('moon63.tif')
46
48
 
47
49
  test_tiff_dir = tempfile.mkdtemp()
48
50
  cls.test_tiff_path = pathlib.Path(test_tiff_dir)
@@ -192,6 +194,17 @@ class TestSuite(fixtures.TestCommon):
192
194
 
193
195
  cls.exif = path
194
196
 
197
+ def _imread(self, path, mode=None):
198
+
199
+ with Image.open(path) as img:
200
+
201
+ if mode is not None:
202
+ img = img.convert(mode)
203
+
204
+ imagedata = np.array(img)
205
+
206
+ return imagedata
207
+
195
208
  def test_smoke(self):
196
209
  """
197
210
  SCENARIO: Convert TIFF file to JP2
@@ -354,7 +367,7 @@ class TestSuite(fixtures.TestCommon):
354
367
  j.layer = layer
355
368
  d[layer] = j[:]
356
369
 
357
- truth = skimage.io.imread(self.moon)
370
+ truth = self._imread(self.moon)
358
371
 
359
372
  with warnings.catch_warnings():
360
373
  # MSE is zero for that first image, resulting in a divide-by-zero
@@ -393,7 +406,7 @@ class TestSuite(fixtures.TestCommon):
393
406
  j.layer = layer
394
407
  d[layer] = j[:]
395
408
 
396
- truth = skimage.io.imread(self.moon)
409
+ truth = self._imread(self.moon)
397
410
 
398
411
  with warnings.catch_warnings():
399
412
  # MSE is zero for that first image, resulting in a divide-by-zero
@@ -631,9 +644,7 @@ class TestSuite(fixtures.TestCommon):
631
644
 
632
645
  jp2 = Jp2k(self.temp_jp2_filename)
633
646
  actual = jp2[:]
634
- expected = skimage.io.imread(
635
- self.moon3_partial_last_strip, plugin='pil'
636
- )
647
+ expected = self._imread(self.moon3_partial_last_strip)
637
648
  np.testing.assert_array_equal(actual, expected)
638
649
 
639
650
  c = jp2.get_codestream()
@@ -659,9 +670,8 @@ class TestSuite(fixtures.TestCommon):
659
670
  jp2 = Jp2k(self.temp_jp2_filename)
660
671
  actual = jp2[:]
661
672
 
662
- expected = skimage.io.imread(
663
- self.moon3_partial_last_strip, plugin='pil'
664
- )
673
+ expected = self._imread(self.moon3_partial_last_strip)
674
+
665
675
  np.testing.assert_array_equal(actual, expected)
666
676
 
667
677
  c = jp2.get_codestream()
@@ -812,7 +822,7 @@ class TestSuite(fixtures.TestCommon):
812
822
 
813
823
  jp2 = Jp2k(self.temp_jp2_filename)
814
824
  actual = jp2[:]
815
- expected = skimage.io.imread(self.ycbcr_stripped, plugin='pil')
825
+ expected = self._imread(self.ycbcr_stripped)
816
826
  np.testing.assert_array_equal(actual, expected)
817
827
 
818
828
  c = jp2.get_codestream()
@@ -835,7 +845,7 @@ class TestSuite(fixtures.TestCommon):
835
845
 
836
846
  jp2 = Jp2k(self.temp_jp2_filename)
837
847
  actual = jp2[:]
838
- expected = skimage.io.imread(self.ycbcr_bg, plugin='pil')
848
+ expected = self._imread(self.ycbcr_bg)
839
849
  np.testing.assert_array_equal(actual, expected)
840
850
 
841
851
  c = jp2.get_codestream()
@@ -882,9 +892,8 @@ class TestSuite(fixtures.TestCommon):
882
892
 
883
893
  jp2 = Jp2k(self.temp_jp2_filename)
884
894
  actual = jp2[:]
885
- expected = skimage.io.imread(
886
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
887
- )
895
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
896
+
888
897
  np.testing.assert_array_equal(actual, expected)
889
898
 
890
899
  c = jp2.get_codestream()
@@ -908,9 +917,7 @@ class TestSuite(fixtures.TestCommon):
908
917
 
909
918
  jp2 = Jp2k(self.temp_jp2_filename)
910
919
  actual = jp2[:]
911
- expected = skimage.io.imread(
912
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
913
- )
920
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
914
921
  np.testing.assert_array_equal(actual, expected)
915
922
 
916
923
  c = jp2.get_codestream()
@@ -933,9 +940,7 @@ class TestSuite(fixtures.TestCommon):
933
940
 
934
941
  jp2 = Jp2k(self.temp_jp2_filename)
935
942
  actual = jp2[:]
936
- expected = skimage.io.imread(
937
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
938
- )
943
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
939
944
  np.testing.assert_array_equal(actual, expected)
940
945
 
941
946
  c = jp2.get_codestream()
@@ -1835,9 +1840,7 @@ class TestSuite(fixtures.TestCommon):
1835
1840
  # Read in the image (as expected on little-endian), flip it
1836
1841
  # around, prepend an alpha layer, then get rid of the last layer
1837
1842
  # to simulate what would have happened on big-endian.
1838
- expected = skimage.io.imread(
1839
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
1840
- )
1843
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
1841
1844
  h, w, _ = expected.shape
1842
1845
  expected = np.flip(expected, axis=2)
1843
1846
  A = np.ones((h, w, 1), dtype=np.uint8) * 255
@@ -1873,9 +1876,7 @@ class TestSuite(fixtures.TestCommon):
1873
1876
  # Read in the image (as expected on little-endian), flip it
1874
1877
  # around, prepend an alpha layer, then get rid of the last layer
1875
1878
  # to simulate what would have happened on big-endian.
1876
- expected = skimage.io.imread(
1877
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
1878
- )
1879
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
1879
1880
  h, w, _ = expected.shape
1880
1881
  expected = np.flip(expected, axis=2)
1881
1882
  A = np.ones((h, w, 1), dtype=np.uint8) * 255
@@ -1911,7 +1912,7 @@ class TestSuite(fixtures.TestCommon):
1911
1912
  # Read in the image (as expected on little-endian), flip it
1912
1913
  # around, prepend an alpha layer, then get rid of the last layer
1913
1914
  # to simulate what would have happened on big-endian.
1914
- expected = skimage.io.imread(self.ycbcr_stripped, plugin='pil')
1915
+ expected = self._imread(self.ycbcr_stripped)
1915
1916
  h, w, _ = expected.shape
1916
1917
  expected = np.flip(expected, axis=2)
1917
1918
  A = np.ones((h, w, 1), dtype=np.uint8) * 255
@@ -1919,3 +1920,26 @@ class TestSuite(fixtures.TestCommon):
1919
1920
  expected = expected[:, :, :3]
1920
1921
 
1921
1922
  np.testing.assert_array_equal(actual, expected)
1923
+
1924
+ def test_unevenly_tiled(self):
1925
+ """
1926
+ SCENARIO: Convert monochromatic TIFF file to JP2. The TIFF is tiled
1927
+ 2x3, and the 2nd row of tiles consists of partial tiles.
1928
+
1929
+ EXPECTED RESULT: The JP2 file validates
1930
+ """
1931
+ with Tiff2Jp2k(
1932
+ self.moon63, self.temp_jp2_filename, tilesize=(32, 32)
1933
+ ) as j:
1934
+ j.run()
1935
+
1936
+ jp2 = Jp2k(self.temp_jp2_filename)
1937
+ actual = jp2[:]
1938
+ expected = self._imread(self.moon63)
1939
+ np.testing.assert_array_equal(actual, expected)
1940
+
1941
+ c = jp2.get_codestream()
1942
+ self.assertEqual(c.segment[1].xsiz, 96)
1943
+ self.assertEqual(c.segment[1].ysiz, 63)
1944
+ self.assertEqual(c.segment[1].xtsiz, 32)
1945
+ self.assertEqual(c.segment[1].ytsiz, 32)
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
File without changes