Added defaults for ContiguousCodestreamBox and JP2HeaderBox.
This commit is contained in:
parent
d3fe2c3df2
commit
c03f0caedf
2 changed files with 21 additions and 8 deletions
|
|
@ -543,9 +543,10 @@ class ContiguousCodestreamBox(Jp2kBox):
|
||||||
List of segments in the codestream header.
|
List of segments in the codestream header.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, main_header=[], **kwargs):
|
||||||
Jp2kBox.__init__(self, id='jp2c', longname='Contiguous Codestream')
|
Jp2kBox.__init__(self, id='jp2c', longname='Contiguous Codestream')
|
||||||
self.__dict__.update(**kwargs)
|
self.__dict__.update(**kwargs)
|
||||||
|
self.main_header = main_header
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
msg = Jp2kBox.__str__(self)
|
msg = Jp2kBox.__str__(self)
|
||||||
|
|
@ -701,9 +702,10 @@ class ImageHeaderBox(Jp2kBox):
|
||||||
compression : int
|
compression : int
|
||||||
The compression type, should be 7 if JP2.
|
The compression type, should be 7 if JP2.
|
||||||
colorspace_unknown : bool
|
colorspace_unknown : bool
|
||||||
false if the color space is known and correctly specified.
|
False if the color space is known and correctly specified.
|
||||||
ip_provided : bool
|
ip_provided : bool
|
||||||
false if the file does not contain intellectual propery rights information.
|
False if the file does not contain intellectual propery rights
|
||||||
|
information.
|
||||||
"""
|
"""
|
||||||
def __init__(self, height, width, num_components=1, signed=False,
|
def __init__(self, height, width, num_components=1, signed=False,
|
||||||
bits_per_component=8, compression=7, colorspace_unknown=False,
|
bits_per_component=8, compression=7, colorspace_unknown=False,
|
||||||
|
|
@ -861,7 +863,7 @@ class JP2HeaderBox(Jp2kBox):
|
||||||
List of boxes contained in this superbox.
|
List of boxes contained in this superbox.
|
||||||
"""
|
"""
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
Jp2kBox.__init__(self, id='', longname='JP2 Header')
|
Jp2kBox.__init__(self, id='jp2h', longname='JP2 Header')
|
||||||
self.__dict__.update(**kwargs)
|
self.__dict__.update(**kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,15 @@ import numpy as np
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
import glymur
|
import glymur
|
||||||
|
from glymur.jp2box import *
|
||||||
|
|
||||||
|
|
||||||
# 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):
|
||||||
tests.addTests(doctest.DocTestSuite('glymur.jp2box'))
|
tests.addTests(doctest.DocTestSuite('glymur.jp2box'))
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(glymur.lib.openjp2._OPENJP2 is None,
|
@unittest.skipIf(glymur.lib.openjp2._OPENJP2 is None,
|
||||||
"Missing openjp2 library.")
|
"Missing openjp2 library.")
|
||||||
class TestJp2Boxes(unittest.TestCase):
|
class TestJp2Boxes(unittest.TestCase):
|
||||||
|
|
@ -72,7 +75,15 @@ class TestJp2Boxes(unittest.TestCase):
|
||||||
with self.assertRaises(IOError):
|
with self.assertRaises(IOError):
|
||||||
b = glymur.jp2box.ColourSpecificationBox(colorspace, approximation)
|
b = glymur.jp2box.ColourSpecificationBox(colorspace, approximation)
|
||||||
|
|
||||||
|
def test_default_JP2HeaderBox(self):
|
||||||
|
b1 = JP2HeaderBox()
|
||||||
|
b1.box = [ImageHeaderBox(height=512, width=256),
|
||||||
|
ColourSpecificationBox(colorspace=glymur.core.GREYSCALE)]
|
||||||
|
|
||||||
|
def test_default_ContiguousCodestreamBox(self):
|
||||||
|
b = ContiguousCodestreamBox()
|
||||||
|
self.assertEqual(b.id, 'jp2c')
|
||||||
|
self.assertEqual(b.main_header, [])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue