merge branch 'issue299' of https://github.com/quintusdias/glymur into issue299
This commit is contained in:
commit
9691311633
2 changed files with 69 additions and 70 deletions
|
|
@ -74,6 +74,7 @@ class SliceProtocolBase(unittest.TestCase):
|
||||||
self.j2k_data = self.j2k[:]
|
self.j2k_data = self.j2k[:]
|
||||||
|
|
||||||
self.j2k_data_r1 = self.j2k[::2, ::2]
|
self.j2k_data_r1 = self.j2k[::2, ::2]
|
||||||
|
self.j2k_data_r5 = self.j2k[::32, ::32]
|
||||||
|
|
||||||
@unittest.skipIf(os.name == "nt", fixtures.WINDOWS_TMP_FILE_MSG)
|
@unittest.skipIf(os.name == "nt", fixtures.WINDOWS_TMP_FILE_MSG)
|
||||||
class TestSliceProtocolBaseWrite(SliceProtocolBase):
|
class TestSliceProtocolBaseWrite(SliceProtocolBase):
|
||||||
|
|
@ -313,7 +314,7 @@ class TestSliceProtocolRead(SliceProtocolBase):
|
||||||
|
|
||||||
def test_region_rlevel5(self):
|
def test_region_rlevel5(self):
|
||||||
actual = self.j2k[5:533:32, 27:423:32]
|
actual = self.j2k[5:533:32, 27:423:32]
|
||||||
expected = self.j2k.read(area=(5, 27, 533, 423), rlevel=5)
|
expected = self.j2k_data_r5[1:17, 1:14]
|
||||||
np.testing.assert_array_equal(actual, expected)
|
np.testing.assert_array_equal(actual, expected)
|
||||||
|
|
||||||
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
||||||
|
|
@ -480,7 +481,7 @@ class TestJp2k(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
||||||
def test_warn_if_using_read_method(self):
|
def test_warn_if_using_read_method(self):
|
||||||
"""Should warn if read method is called"""
|
"""Should warn if deprecated read method is called"""
|
||||||
with self.assertWarns(DeprecationWarning):
|
with self.assertWarns(DeprecationWarning):
|
||||||
Jp2k(self.jp2file).read()
|
Jp2k(self.jp2file).read()
|
||||||
|
|
||||||
|
|
@ -575,7 +576,7 @@ class TestJp2k(unittest.TestCase):
|
||||||
"""Verify that rlevel=-1 gets us the lowest resolution image"""
|
"""Verify that rlevel=-1 gets us the lowest resolution image"""
|
||||||
j = Jp2k(self.j2kfile)
|
j = Jp2k(self.j2kfile)
|
||||||
thumbnail1 = j.read(rlevel=-1)
|
thumbnail1 = j.read(rlevel=-1)
|
||||||
thumbnail2 = j.read(rlevel=5)
|
thumbnail2 = j[::32, ::32]
|
||||||
np.testing.assert_array_equal(thumbnail1, thumbnail2)
|
np.testing.assert_array_equal(thumbnail1, thumbnail2)
|
||||||
self.assertEqual(thumbnail1.shape, (25, 15, 3))
|
self.assertEqual(thumbnail1.shape, (25, 15, 3))
|
||||||
|
|
||||||
|
|
@ -734,7 +735,7 @@ class TestJp2k(unittest.TestCase):
|
||||||
"""Just a very basic test that reading a JP2 file does not error out.
|
"""Just a very basic test that reading a JP2 file does not error out.
|
||||||
"""
|
"""
|
||||||
j2k = Jp2k(self.jp2file)
|
j2k = Jp2k(self.jp2file)
|
||||||
j2k.read(rlevel=1)
|
j2k[::2, ::2]
|
||||||
|
|
||||||
def test_basic_j2k(self):
|
def test_basic_j2k(self):
|
||||||
"""This test is only useful when openjp2 is not available
|
"""This test is only useful when openjp2 is not available
|
||||||
|
|
@ -742,7 +743,7 @@ class TestJp2k(unittest.TestCase):
|
||||||
working J2K test.
|
working J2K test.
|
||||||
"""
|
"""
|
||||||
j2k = Jp2k(self.j2kfile)
|
j2k = Jp2k(self.j2kfile)
|
||||||
j2k.read()
|
j2k[:]
|
||||||
|
|
||||||
def test_empty_box_with_j2k(self):
|
def test_empty_box_with_j2k(self):
|
||||||
"""Verify that the list of boxes in a J2C/J2K file is present, but
|
"""Verify that the list of boxes in a J2C/J2K file is present, but
|
||||||
|
|
@ -867,7 +868,7 @@ class TestJp2k(unittest.TestCase):
|
||||||
"""Read JPX codestream when jp2-compatible."""
|
"""Read JPX codestream when jp2-compatible."""
|
||||||
# The file in question has multiple codestreams.
|
# The file in question has multiple codestreams.
|
||||||
jpx = Jp2k(self.jpxfile)
|
jpx = Jp2k(self.jpxfile)
|
||||||
data = jpx.read()
|
data = jpx[:]
|
||||||
self.assertEqual(data.shape, (1024, 1024, 3))
|
self.assertEqual(data.shape, (1024, 1024, 3))
|
||||||
|
|
||||||
def test_read_bands_without_openjp2(self):
|
def test_read_bands_without_openjp2(self):
|
||||||
|
|
@ -1021,21 +1022,21 @@ class TestJp2k_write(unittest.TestCase):
|
||||||
def test_write_with_jp2_in_caps(self):
|
def test_write_with_jp2_in_caps(self):
|
||||||
"""should be able to write with JP2 suffix."""
|
"""should be able to write with JP2 suffix."""
|
||||||
j2k = Jp2k(self.j2kfile)
|
j2k = Jp2k(self.j2kfile)
|
||||||
expdata = j2k.read()
|
expdata = j2k[:]
|
||||||
with tempfile.NamedTemporaryFile(suffix='.JP2') as tfile:
|
with tempfile.NamedTemporaryFile(suffix='.JP2') as tfile:
|
||||||
ofile = Jp2k(tfile.name, 'wb')
|
ofile = Jp2k(tfile.name, 'wb')
|
||||||
ofile.write(expdata)
|
ofile[:] = expdata
|
||||||
actdata = ofile.read()
|
actdata = ofile[:]
|
||||||
np.testing.assert_array_equal(actdata, expdata)
|
np.testing.assert_array_equal(actdata, expdata)
|
||||||
|
|
||||||
def test_write_srgb_without_mct(self):
|
def test_write_srgb_without_mct(self):
|
||||||
"""should be able to write RGB without specifying mct"""
|
"""should be able to write RGB without specifying mct"""
|
||||||
j2k = Jp2k(self.j2kfile)
|
j2k = Jp2k(self.j2kfile)
|
||||||
expdata = j2k.read()
|
expdata = j2k[:]
|
||||||
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
||||||
ofile = Jp2k(tfile.name, 'wb')
|
ofile = Jp2k(tfile.name, 'wb')
|
||||||
ofile.write(expdata, mct=False)
|
ofile.write(expdata, mct=False)
|
||||||
actdata = ofile.read()
|
actdata = ofile[:]
|
||||||
np.testing.assert_array_equal(actdata, expdata)
|
np.testing.assert_array_equal(actdata, expdata)
|
||||||
|
|
||||||
codestream = ofile.get_codestream()
|
codestream = ofile.get_codestream()
|
||||||
|
|
@ -1044,7 +1045,7 @@ class TestJp2k_write(unittest.TestCase):
|
||||||
def test_write_grayscale_with_mct(self):
|
def test_write_grayscale_with_mct(self):
|
||||||
"""MCT usage makes no sense for grayscale images."""
|
"""MCT usage makes no sense for grayscale images."""
|
||||||
j2k = Jp2k(self.j2kfile)
|
j2k = Jp2k(self.j2kfile)
|
||||||
expdata = j2k.read()
|
expdata = j2k[:]
|
||||||
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
||||||
ofile = Jp2k(tfile.name, 'wb')
|
ofile = Jp2k(tfile.name, 'wb')
|
||||||
with self.assertRaises(IOError):
|
with self.assertRaises(IOError):
|
||||||
|
|
@ -1054,11 +1055,11 @@ class TestJp2k_write(unittest.TestCase):
|
||||||
"""Must be able to write a CPRL progression order file"""
|
"""Must be able to write a CPRL progression order file"""
|
||||||
# Issue 17
|
# Issue 17
|
||||||
j = Jp2k(self.jp2file)
|
j = Jp2k(self.jp2file)
|
||||||
expdata = j.read(rlevel=1)
|
expdata = j[::2, ::2]
|
||||||
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
||||||
ofile = Jp2k(tfile.name, 'wb')
|
ofile = Jp2k(tfile.name, 'wb')
|
||||||
ofile.write(expdata, prog='CPRL')
|
ofile.write(expdata, prog='CPRL')
|
||||||
actdata = ofile.read()
|
actdata = ofile[:]
|
||||||
np.testing.assert_array_equal(actdata, expdata)
|
np.testing.assert_array_equal(actdata, expdata)
|
||||||
|
|
||||||
codestream = ofile.get_codestream()
|
codestream = ofile.get_codestream()
|
||||||
|
|
@ -1145,7 +1146,7 @@ class TestJp2k_2_0(unittest.TestCase):
|
||||||
"""Test asoc and label box"""
|
"""Test asoc and label box"""
|
||||||
# Construct a fake file with an asoc and a label box, as
|
# Construct a fake file with an asoc and a label box, as
|
||||||
# OpenJPEG doesn't have such a file.
|
# OpenJPEG doesn't have such a file.
|
||||||
data = Jp2k(self.jp2file).read(rlevel=1)
|
data = Jp2k(self.jp2file)[::2, ::2]
|
||||||
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
||||||
j = Jp2k(tfile.name, 'wb')
|
j = Jp2k(tfile.name, 'wb')
|
||||||
j.write(data)
|
j.write(data)
|
||||||
|
|
@ -1246,11 +1247,9 @@ class TestJp2k_2_1(unittest.TestCase):
|
||||||
tfile.write(data[offset+53:offset+55])
|
tfile.write(data[offset+53:offset+55])
|
||||||
tfile.write(b'\x00')
|
tfile.write(b'\x00')
|
||||||
tfile.write(data[offset+57:offset+59])
|
tfile.write(data[offset+57:offset+59])
|
||||||
#tfile.write(data[3184:3186])
|
|
||||||
tfile.write(b'\x00')
|
tfile.write(b'\x00')
|
||||||
|
|
||||||
tfile.write(data[offset+59:])
|
tfile.write(data[offset+59:])
|
||||||
#tfile.write(data[3186:])
|
|
||||||
tfile.flush()
|
tfile.flush()
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter('ignore')
|
warnings.simplefilter('ignore')
|
||||||
|
|
@ -1260,10 +1259,10 @@ class TestJp2k_2_1(unittest.TestCase):
|
||||||
:\sdx=1\sdy=0''', re.VERBOSE)
|
:\sdx=1\sdy=0''', re.VERBOSE)
|
||||||
if sys.hexversion < 0x03020000:
|
if sys.hexversion < 0x03020000:
|
||||||
with self.assertRaisesRegexp((IOError, OSError), regexp):
|
with self.assertRaisesRegexp((IOError, OSError), regexp):
|
||||||
j.read(rlevel=1)
|
j[::2, ::2]
|
||||||
else:
|
else:
|
||||||
with self.assertRaisesRegex((IOError, OSError), regexp):
|
with self.assertRaisesRegex((IOError, OSError), regexp):
|
||||||
j.read(rlevel=1)
|
j[::2, ::2]
|
||||||
|
|
||||||
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
||||||
"OPJ_DATA_ROOT environment variable not set")
|
"OPJ_DATA_ROOT environment variable not set")
|
||||||
|
|
@ -1364,7 +1363,7 @@ class TestJp2kOpjDataRoot(unittest.TestCase):
|
||||||
self.assertEqual(codestream.segment[2].spcod[8],
|
self.assertEqual(codestream.segment[2].spcod[8],
|
||||||
glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE)
|
glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE)
|
||||||
|
|
||||||
actdata = j.read()
|
actdata = j[:]
|
||||||
self.assertTrue(fixtures.mse(actdata, expdata) < 250)
|
self.assertTrue(fixtures.mse(actdata, expdata) < 250)
|
||||||
|
|
||||||
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
||||||
|
|
@ -1372,9 +1371,9 @@ class TestJp2kOpjDataRoot(unittest.TestCase):
|
||||||
"""Indices for pclr jpxfile if no color transform"""
|
"""Indices for pclr jpxfile if no color transform"""
|
||||||
filename = opj_data_file('input/conformance/file9.jp2')
|
filename = opj_data_file('input/conformance/file9.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
j = Jp2k(filename)
|
jp2 = Jp2k(filename)
|
||||||
rgb = j.read()
|
rgb = jp2[:]
|
||||||
idx = j.read(ignore_pclr_cmap_cdef=True)
|
idx = jp2.read(ignore_pclr_cmap_cdef=True)
|
||||||
self.assertEqual(rgb.shape, (512, 768, 3))
|
self.assertEqual(rgb.shape, (512, 768, 3))
|
||||||
self.assertEqual(idx.shape, (512, 768))
|
self.assertEqual(idx.shape, (512, 768))
|
||||||
|
|
||||||
|
|
@ -1396,7 +1395,7 @@ class TestJp2kOpjDataRoot(unittest.TestCase):
|
||||||
filename = opj_data_file('input/conformance/p0_05.j2k')
|
filename = opj_data_file('input/conformance/p0_05.j2k')
|
||||||
j = Jp2k(filename)
|
j = Jp2k(filename)
|
||||||
with self.assertRaises(RuntimeError):
|
with self.assertRaises(RuntimeError):
|
||||||
j.read()
|
j[:]
|
||||||
|
|
||||||
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
||||||
def test_no_cxform_cmap(self):
|
def test_no_cxform_cmap(self):
|
||||||
|
|
@ -1407,7 +1406,7 @@ class TestJp2kOpjDataRoot(unittest.TestCase):
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
# The file has a bad compatibility list entry. Not important here.
|
# The file has a bad compatibility list entry. Not important here.
|
||||||
j = Jp2k(filename)
|
j = Jp2k(filename)
|
||||||
ycbcr = j.read()
|
ycbcr = j[:]
|
||||||
crcby = j.read(ignore_pclr_cmap_cdef=True)
|
crcby = j.read(ignore_pclr_cmap_cdef=True)
|
||||||
|
|
||||||
expected = np.zeros(ycbcr.shape, ycbcr.dtype)
|
expected = np.zeros(ycbcr.shape, ycbcr.dtype)
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_01_j2k(self):
|
def test_ETS_C1P0_p0_01_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_01.j2k')
|
jfile = opj_data_file('input/conformance/p0_01.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_01_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_01_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -67,7 +67,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_03_j2k(self):
|
def test_ETS_C1P0_p0_03_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_03.j2k')
|
jfile = opj_data_file('input/conformance/p0_03.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_03_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_03_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -77,7 +77,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_04_j2k(self):
|
def test_ETS_C1P0_p0_04_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_04.j2k')
|
jfile = opj_data_file('input/conformance/p0_04.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_04_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_04_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -97,7 +97,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_08_j2k(self):
|
def test_ETS_C1P0_p0_08_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_08.j2k')
|
jfile = opj_data_file('input/conformance/p0_08.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=1)
|
jpdata = jp2k[::2, ::2]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_08_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_08_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -114,7 +114,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_09_j2k(self):
|
def test_ETS_C1P0_p0_09_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_09.j2k')
|
jfile = opj_data_file('input/conformance/p0_09.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_09_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_09_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -123,7 +123,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_11_j2k(self):
|
def test_ETS_C1P0_p0_11_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_11.j2k')
|
jfile = opj_data_file('input/conformance/p0_11.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_11_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_11_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -132,7 +132,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_14_j2k(self):
|
def test_ETS_C1P0_p0_14_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_14.j2k')
|
jfile = opj_data_file('input/conformance/p0_14.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_14_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_14_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -149,7 +149,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_15_j2k(self):
|
def test_ETS_C1P0_p0_15_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_15.j2k')
|
jfile = opj_data_file('input/conformance/p0_15.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_15_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_15_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -158,7 +158,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_16_j2k(self):
|
def test_ETS_C1P0_p0_16_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_16.j2k')
|
jfile = opj_data_file('input/conformance/p0_16.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_16_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_16_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -167,7 +167,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P1_p1_01_j2k(self):
|
def test_ETS_C1P1_p1_01_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p1_01.j2k')
|
jfile = opj_data_file('input/conformance/p1_01.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p1_01_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p1_01_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -176,7 +176,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P1_p1_02_j2k(self):
|
def test_ETS_C1P1_p1_02_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p1_02.j2k')
|
jfile = opj_data_file('input/conformance/p1_02.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p1_02_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p1_02_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -196,7 +196,7 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_ETS_C1P1_p1_04_j2k(self):
|
def test_ETS_C1P1_p1_04_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p1_04.j2k')
|
jfile = opj_data_file('input/conformance/p1_04.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p1_04_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p1_04_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -206,95 +206,95 @@ class TestSuite(unittest.TestCase):
|
||||||
def test_NR_DEC_Bretagne2_j2k_1_decode(self):
|
def test_NR_DEC_Bretagne2_j2k_1_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/Bretagne2.j2k')
|
jfile = opj_data_file('input/nonregression/Bretagne2.j2k')
|
||||||
jp2 = Jp2k(jfile)
|
jp2 = Jp2k(jfile)
|
||||||
jp2.read()
|
jp2[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC__00042_j2k_2_decode(self):
|
def test_NR_DEC__00042_j2k_2_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/_00042.j2k')
|
jfile = opj_data_file('input/nonregression/_00042.j2k')
|
||||||
jp2 = Jp2k(jfile)
|
jp2 = Jp2k(jfile)
|
||||||
jp2.read()
|
jp2[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_buxI_j2k_9_decode(self):
|
def test_NR_DEC_buxI_j2k_9_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/buxI.j2k')
|
jfile = opj_data_file('input/nonregression/buxI.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_buxR_j2k_10_decode(self):
|
def test_NR_DEC_buxR_j2k_10_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/buxR.j2k')
|
jfile = opj_data_file('input/nonregression/buxR.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_Cannotreaddatawithnosizeknown_j2k_11_decode(self):
|
def test_NR_DEC_Cannotreaddatawithnosizeknown_j2k_11_decode(self):
|
||||||
relpath = 'input/nonregression/Cannotreaddatawithnosizeknown.j2k'
|
relpath = 'input/nonregression/Cannotreaddatawithnosizeknown.j2k'
|
||||||
jfile = opj_data_file(relpath)
|
jfile = opj_data_file(relpath)
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_cthead1_j2k_12_decode(self):
|
def test_NR_DEC_cthead1_j2k_12_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/cthead1.j2k')
|
jfile = opj_data_file('input/nonregression/cthead1.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_CT_Phillips_JPEG2K_Decompr_Problem_j2k_13_decode(self):
|
def test_NR_DEC_CT_Phillips_JPEG2K_Decompr_Problem_j2k_13_decode(self):
|
||||||
relpath = 'input/nonregression/CT_Phillips_JPEG2K_Decompr_Problem.j2k'
|
relpath = 'input/nonregression/CT_Phillips_JPEG2K_Decompr_Problem.j2k'
|
||||||
jfile = opj_data_file(relpath)
|
jfile = opj_data_file(relpath)
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_j2k32_j2k_15_decode(self):
|
def test_NR_DEC_j2k32_j2k_15_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/j2k32.j2k')
|
jfile = opj_data_file('input/nonregression/j2k32.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_MarkerIsNotCompliant_j2k_17_decode(self):
|
def test_NR_DEC_MarkerIsNotCompliant_j2k_17_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/MarkerIsNotCompliant.j2k')
|
jfile = opj_data_file('input/nonregression/MarkerIsNotCompliant.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_Marrin_jp2_18_decode(self):
|
def test_NR_DEC_Marrin_jp2_18_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/Marrin.jp2')
|
jfile = opj_data_file('input/nonregression/Marrin.jp2')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_movie_00000_j2k_20_decode(self):
|
def test_NR_DEC_movie_00000_j2k_20_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/movie_00000.j2k')
|
jfile = opj_data_file('input/nonregression/movie_00000.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_movie_00001_j2k_21_decode(self):
|
def test_NR_DEC_movie_00001_j2k_21_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/movie_00001.j2k')
|
jfile = opj_data_file('input/nonregression/movie_00001.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_movie_00002_j2k_22_decode(self):
|
def test_NR_DEC_movie_00002_j2k_22_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/movie_00002.j2k')
|
jfile = opj_data_file('input/nonregression/movie_00002.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_orb_blue_lin_j2k_j2k_23_decode(self):
|
def test_NR_DEC_orb_blue_lin_j2k_j2k_23_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/orb-blue10-lin-j2k.j2k')
|
jfile = opj_data_file('input/nonregression/orb-blue10-lin-j2k.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_orb_blue_win_j2k_j2k_24_decode(self):
|
def test_NR_DEC_orb_blue_win_j2k_j2k_24_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/orb-blue10-win-j2k.j2k')
|
jfile = opj_data_file('input/nonregression/orb-blue10-win-j2k.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_relax_jp2_27_decode(self):
|
def test_NR_DEC_relax_jp2_27_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/relax.jp2')
|
jfile = opj_data_file('input/nonregression/relax.jp2')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_test_lossless_j2k_28_decode(self):
|
def test_NR_DEC_test_lossless_j2k_28_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/test_lossless.j2k')
|
jfile = opj_data_file('input/nonregression/test_lossless.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_pacs_ge_j2k_30_decode(self):
|
def test_NR_DEC_pacs_ge_j2k_30_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/pacs.ge.j2k')
|
jfile = opj_data_file('input/nonregression/pacs.ge.j2k')
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -317,14 +317,14 @@ class TestSuiteWarns(MetadataBase):
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
# Bad compatibility list item.
|
# Bad compatibility list item.
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (512, 768, 3))
|
self.assertEqual(jpdata.shape, (512, 768, 3))
|
||||||
|
|
||||||
def test_ETS_JP2_file2(self):
|
def test_ETS_JP2_file2(self):
|
||||||
jfile = opj_data_file('input/conformance/file2.jp2')
|
jfile = opj_data_file('input/conformance/file2.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (640, 480, 3))
|
self.assertEqual(jpdata.shape, (640, 480, 3))
|
||||||
|
|
||||||
@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] < 2,
|
@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] < 2,
|
||||||
|
|
@ -342,7 +342,7 @@ class TestSuiteWarns(MetadataBase):
|
||||||
jfile = opj_data_file('input/conformance/file4.jp2')
|
jfile = opj_data_file('input/conformance/file4.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (512, 768))
|
self.assertEqual(jpdata.shape, (512, 768))
|
||||||
|
|
||||||
def test_ETS_JP2_file5(self):
|
def test_ETS_JP2_file5(self):
|
||||||
|
|
@ -351,35 +351,35 @@ class TestSuiteWarns(MetadataBase):
|
||||||
# There's a warning for an unknown compatibility entry.
|
# There's a warning for an unknown compatibility entry.
|
||||||
# Ignore it here.
|
# Ignore it here.
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (512, 768, 3))
|
self.assertEqual(jpdata.shape, (512, 768, 3))
|
||||||
|
|
||||||
def test_ETS_JP2_file6(self):
|
def test_ETS_JP2_file6(self):
|
||||||
jfile = opj_data_file('input/conformance/file6.jp2')
|
jfile = opj_data_file('input/conformance/file6.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (512, 768))
|
self.assertEqual(jpdata.shape, (512, 768))
|
||||||
|
|
||||||
def test_ETS_JP2_file7(self):
|
def test_ETS_JP2_file7(self):
|
||||||
jfile = opj_data_file('input/conformance/file7.jp2')
|
jfile = opj_data_file('input/conformance/file7.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (640, 480, 3))
|
self.assertEqual(jpdata.shape, (640, 480, 3))
|
||||||
|
|
||||||
def test_ETS_JP2_file8(self):
|
def test_ETS_JP2_file8(self):
|
||||||
jfile = opj_data_file('input/conformance/file8.jp2')
|
jfile = opj_data_file('input/conformance/file8.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (400, 700))
|
self.assertEqual(jpdata.shape, (400, 700))
|
||||||
|
|
||||||
def test_ETS_JP2_file9(self):
|
def test_ETS_JP2_file9(self):
|
||||||
jfile = opj_data_file('input/conformance/file9.jp2')
|
jfile = opj_data_file('input/conformance/file9.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
jpdata = jp2k[:]
|
||||||
self.assertEqual(jpdata.shape, (512, 768, 3))
|
self.assertEqual(jpdata.shape, (512, 768, 3))
|
||||||
|
|
||||||
def test_NR_broken_jp2_dump(self):
|
def test_NR_broken_jp2_dump(self):
|
||||||
|
|
@ -469,13 +469,13 @@ class TestSuiteWarns(MetadataBase):
|
||||||
jfile = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2')
|
jfile = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
# This file has an invalid ICC profile
|
# This file has an invalid ICC profile
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
def test_NR_DEC_orb_blue_win_jp2_26_decode(self):
|
def test_NR_DEC_orb_blue_win_jp2_26_decode(self):
|
||||||
jfile = opj_data_file('input/nonregression/orb-blue10-win-jp2.jp2')
|
jfile = opj_data_file('input/nonregression/orb-blue10-win-jp2.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -590,7 +590,7 @@ class TestSuite2point0(unittest.TestCase):
|
||||||
def test_ETS_C1P0_p0_10_j2k(self):
|
def test_ETS_C1P0_p0_10_j2k(self):
|
||||||
jfile = opj_data_file('input/conformance/p0_10.j2k')
|
jfile = opj_data_file('input/conformance/p0_10.j2k')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read(rlevel=0)
|
jpdata = jp2k[:]
|
||||||
|
|
||||||
pgxfile = opj_data_file('baseline/conformance/c1p0_10_0.pgx')
|
pgxfile = opj_data_file('baseline/conformance/c1p0_10_0.pgx')
|
||||||
pgxdata = read_pgx(pgxfile)
|
pgxdata = read_pgx(pgxfile)
|
||||||
|
|
@ -611,7 +611,7 @@ class TestSuite2point0(unittest.TestCase):
|
||||||
with self.assertRaises(IOError):
|
with self.assertRaises(IOError):
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
# Invalid marker ID.
|
# Invalid marker ID.
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
||||||
|
|
@ -620,7 +620,7 @@ class TestSuite2point0(unittest.TestCase):
|
||||||
with self.assertRaises(IOError):
|
with self.assertRaises(IOError):
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
# invalid number of subbands, bad marker ID
|
# invalid number of subbands, bad marker ID
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
||||||
|
|
@ -632,9 +632,9 @@ class TestSuite2point0(unittest.TestCase):
|
||||||
if glymur.version.openjpeg_version_tuple[0] < 2:
|
if glymur.version.openjpeg_version_tuple[0] < 2:
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
# Incorrect warning issued about tile parts.
|
# Incorrect warning issued about tile parts.
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
else:
|
else:
|
||||||
Jp2k(jfile).read()
|
Jp2k(jfile)[:]
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue