merge branch 'issue316' into devel

This commit is contained in:
John Evans 2015-01-08 12:08:16 -05:00
commit 1bfb2f5fc8
5 changed files with 19 additions and 19 deletions

View file

@ -1032,7 +1032,7 @@ class ContiguousCodestreamBox(Jp2kBox):
with open(self._filename, 'rb') as fptr:
fptr.seek(self.main_header_offset)
codestream = Codestream(fptr, self._length,
header_only=header_only)
header_only=header_only)
self._codestream = codestream
return self._codestream

View file

@ -213,19 +213,19 @@ class Jp2k(Jp2kBox):
num_components = len(cstr.segment[1].xrsiz)
else:
# try to get the image size from the IHDR box
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]
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]
height, width = ihdr.height, ihdr.width
num_components = ihdr.num_components
height, width = ihdr.height, ihdr.width
num_components = ihdr.num_components
if num_components == 1:
# but if there is a PCLR box, then we need to check that as
# well, as that turns a single-channel image into a
# multi-channel image
pclr = [box for box in jp2h.box if box.box_id == 'pclr']
if len(pclr) > 0:
num_components = len(pclr[0].signed)
if num_components == 1:
# but if there is a PCLR box, then we need to check that as
# well, as that turns a single-channel image into a
# multi-channel image
pclr = [box for box in jp2h.box if box.box_id == 'pclr']
if len(pclr) > 0:
num_components = len(pclr[0].signed)
if num_components == 1:
self.shape = (height, width)

View file

@ -34,8 +34,8 @@ elif re.match('1.[0-6]', six.__version__) is not None:
WARNING_INFRASTRUCTURE_ISSUE = True
msg = "Cannot run test with version {0} of python-six"
WARNING_INFRASTRUCTURE_MSG = msg.format(six.__version__)
elif ((re.match('1.8', six.__version__) is not None) and
(sys.platform.startswith('linux')) and
elif ((re.match('1.8', six.__version__) is not None) and
(sys.platform.startswith('linux')) and
(platform.linux_distribution() == ('LinuxMint', '17', 'qiana'))):
WARNING_INFRASTRUCTURE_ISSUE = True
linux_distribution = platform.linux_distribution()

View file

@ -39,6 +39,7 @@ from . import fixtures
def docTearDown(doctest_obj):
glymur.set_parseoptions(full_codestream=False)
# Doc tests should be run as well.
def load_tests(loader, tests, ignore):
"""Should run doc tests as well"""
@ -1079,9 +1080,6 @@ class TestParsing(unittest.TestCase):
class TestJp2kOpjDataRootWarnings(unittest.TestCase):
"""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):
"""Should warn in case of undecodeable box ID but not error out."""
filename = opj_data_file('input/nonregression/edf_c2_1013627.jp2')

View file

@ -1065,12 +1065,14 @@ class TestJp2dump(unittest.TestCase):
expected = '\n'.join(expected)
self.assertEqual(actual, expected)
@unittest.skipIf(sys.hexversion < 0x03000000, "assertRegex not in 2.7")
def test_jp2_codestream_0(self):
"""Verify dumping with -c 0, supressing all codestream details."""
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)
def test_jp2_codestream_1(self):