merge branch 'issue316' into devel
This commit is contained in:
commit
1bfb2f5fc8
5 changed files with 19 additions and 19 deletions
|
|
@ -1032,7 +1032,7 @@ class ContiguousCodestreamBox(Jp2kBox):
|
||||||
with open(self._filename, 'rb') as fptr:
|
with open(self._filename, 'rb') as fptr:
|
||||||
fptr.seek(self.main_header_offset)
|
fptr.seek(self.main_header_offset)
|
||||||
codestream = Codestream(fptr, self._length,
|
codestream = Codestream(fptr, self._length,
|
||||||
header_only=header_only)
|
header_only=header_only)
|
||||||
self._codestream = codestream
|
self._codestream = codestream
|
||||||
return self._codestream
|
return self._codestream
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,19 +213,19 @@ class Jp2k(Jp2kBox):
|
||||||
num_components = len(cstr.segment[1].xrsiz)
|
num_components = len(cstr.segment[1].xrsiz)
|
||||||
else:
|
else:
|
||||||
# try to get the image size from the IHDR box
|
# try to get the image size from the IHDR box
|
||||||
jp2h = [box for box in self.box if box.box_id == 'jp2h'][0]
|
jp2h = [box for box in self.box if box.box_id == 'jp2h'][0]
|
||||||
ihdr = [box for box in jp2h.box if box.box_id == 'ihdr'][0]
|
ihdr = [box for box in jp2h.box if box.box_id == 'ihdr'][0]
|
||||||
|
|
||||||
height, width = ihdr.height, ihdr.width
|
height, width = ihdr.height, ihdr.width
|
||||||
num_components = ihdr.num_components
|
num_components = ihdr.num_components
|
||||||
|
|
||||||
if num_components == 1:
|
if num_components == 1:
|
||||||
# but if there is a PCLR box, then we need to check that as
|
# but if there is a PCLR box, then we need to check that as
|
||||||
# well, as that turns a single-channel image into a
|
# well, as that turns a single-channel image into a
|
||||||
# multi-channel image
|
# multi-channel image
|
||||||
pclr = [box for box in jp2h.box if box.box_id == 'pclr']
|
pclr = [box for box in jp2h.box if box.box_id == 'pclr']
|
||||||
if len(pclr) > 0:
|
if len(pclr) > 0:
|
||||||
num_components = len(pclr[0].signed)
|
num_components = len(pclr[0].signed)
|
||||||
|
|
||||||
if num_components == 1:
|
if num_components == 1:
|
||||||
self.shape = (height, width)
|
self.shape = (height, width)
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ elif re.match('1.[0-6]', six.__version__) is not None:
|
||||||
WARNING_INFRASTRUCTURE_ISSUE = True
|
WARNING_INFRASTRUCTURE_ISSUE = True
|
||||||
msg = "Cannot run test with version {0} of python-six"
|
msg = "Cannot run test with version {0} of python-six"
|
||||||
WARNING_INFRASTRUCTURE_MSG = msg.format(six.__version__)
|
WARNING_INFRASTRUCTURE_MSG = msg.format(six.__version__)
|
||||||
elif ((re.match('1.8', six.__version__) is not None) and
|
elif ((re.match('1.8', six.__version__) is not None) and
|
||||||
(sys.platform.startswith('linux')) and
|
(sys.platform.startswith('linux')) and
|
||||||
(platform.linux_distribution() == ('LinuxMint', '17', 'qiana'))):
|
(platform.linux_distribution() == ('LinuxMint', '17', 'qiana'))):
|
||||||
WARNING_INFRASTRUCTURE_ISSUE = True
|
WARNING_INFRASTRUCTURE_ISSUE = True
|
||||||
linux_distribution = platform.linux_distribution()
|
linux_distribution = platform.linux_distribution()
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ from . import fixtures
|
||||||
def docTearDown(doctest_obj):
|
def docTearDown(doctest_obj):
|
||||||
glymur.set_parseoptions(full_codestream=False)
|
glymur.set_parseoptions(full_codestream=False)
|
||||||
|
|
||||||
|
|
||||||
# Doc tests should be run as well.
|
# Doc tests should be run as well.
|
||||||
def load_tests(loader, tests, ignore):
|
def load_tests(loader, tests, ignore):
|
||||||
"""Should run doc tests as well"""
|
"""Should run doc tests as well"""
|
||||||
|
|
@ -1079,9 +1080,6 @@ class TestParsing(unittest.TestCase):
|
||||||
class TestJp2kOpjDataRootWarnings(unittest.TestCase):
|
class TestJp2kOpjDataRootWarnings(unittest.TestCase):
|
||||||
"""These tests should be run by just about all configuration."""
|
"""These tests should be run by just about all configuration."""
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
glymur.set_parseoptions(full_codestream=False)
|
|
||||||
|
|
||||||
def test_undecodeable_box_id(self):
|
def test_undecodeable_box_id(self):
|
||||||
"""Should warn in case of undecodeable box ID but not error out."""
|
"""Should warn in case of undecodeable box ID but not error out."""
|
||||||
filename = opj_data_file('input/nonregression/edf_c2_1013627.jp2')
|
filename = opj_data_file('input/nonregression/edf_c2_1013627.jp2')
|
||||||
|
|
|
||||||
|
|
@ -1065,12 +1065,14 @@ class TestJp2dump(unittest.TestCase):
|
||||||
expected = '\n'.join(expected)
|
expected = '\n'.join(expected)
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
@unittest.skipIf(sys.hexversion < 0x03000000, "assertRegex not in 2.7")
|
|
||||||
def test_jp2_codestream_0(self):
|
def test_jp2_codestream_0(self):
|
||||||
"""Verify dumping with -c 0, supressing all codestream details."""
|
"""Verify dumping with -c 0, supressing all codestream details."""
|
||||||
actual = self.run_jp2dump(['', '-c', '0', self.jp2file])
|
actual = self.run_jp2dump(['', '-c', '0', self.jp2file])
|
||||||
|
|
||||||
expected = fixtures.nemo_dump_no_codestream
|
# shave off the codestream details
|
||||||
|
lines = fixtures.nemo.split('\n')
|
||||||
|
expected = lines[0:105]
|
||||||
|
expected = '\n'.join(expected)
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
def test_jp2_codestream_1(self):
|
def test_jp2_codestream_1(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue