diff --git a/glymur/jp2k.py b/glymur/jp2k.py index 155f7ee..56f2db2 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -763,14 +763,17 @@ class Jp2k(Jp2kBox): """ Slicing protocol. """ + if re.match("1.", version.openjpeg_version): + msg = "Not implemented for version 1.x of OpenJPEG. Use the read " + msg += "method instead." + raise NotImplementedError(msg) + codestream = self.get_codestream(header_only=True) if isinstance(pargs, int): # Not a very good use of this protocol, but technically legal. # This retrieves a single row. row = pargs area = (row, 0, row + 1, codestream.segment[1].xsiz) - - # Take out the singleton row dimension. return self.read(area=area).squeeze() if isinstance(pargs, slice): diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index f1e9971..20dc3bc 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -52,6 +52,8 @@ def load_tests(loader, tests, ignore): return tests +@unittest.skipIf(glymur.version.openjpeg_version[0] == '1', + "Slice protocol not supported in version 1.x") class TestSliceProtocol(unittest.TestCase): """ Test slice protocol, i.e. when using [ ] to read image data.