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.
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
def __init__(self, main_header=[], **kwargs):
|
||||
Jp2kBox.__init__(self, id='jp2c', longname='Contiguous Codestream')
|
||||
self.__dict__.update(**kwargs)
|
||||
self.main_header = main_header
|
||||
|
||||
def __str__(self):
|
||||
msg = Jp2kBox.__str__(self)
|
||||
|
|
@ -701,12 +702,13 @@ class ImageHeaderBox(Jp2kBox):
|
|||
compression : int
|
||||
The compression type, should be 7 if JP2.
|
||||
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
|
||||
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,
|
||||
bits_per_component=8, compression=7, colorspace_unknown=False,
|
||||
bits_per_component=8, compression=7, colorspace_unknown=False,
|
||||
ip_provided=False, **kwargs):
|
||||
"""
|
||||
Examples
|
||||
|
|
@ -861,7 +863,7 @@ class JP2HeaderBox(Jp2kBox):
|
|||
List of boxes contained in this superbox.
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
Jp2kBox.__init__(self, id='', longname='JP2 Header')
|
||||
Jp2kBox.__init__(self, id='jp2h', longname='JP2 Header')
|
||||
self.__dict__.update(**kwargs)
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
|
|
@ -5,12 +5,15 @@ import numpy as np
|
|||
import pkg_resources
|
||||
|
||||
import glymur
|
||||
from glymur.jp2box import *
|
||||
|
||||
|
||||
# Doc tests should be run as well.
|
||||
def load_tests(loader, tests, ignore):
|
||||
tests.addTests(doctest.DocTestSuite('glymur.jp2box'))
|
||||
return tests
|
||||
|
||||
|
||||
@unittest.skipIf(glymur.lib.openjp2._OPENJP2 is None,
|
||||
"Missing openjp2 library.")
|
||||
class TestJp2Boxes(unittest.TestCase):
|
||||
|
|
@ -23,12 +26,12 @@ class TestJp2Boxes(unittest.TestCase):
|
|||
pass
|
||||
|
||||
def test_default_JPEG2000SignatureBox(self):
|
||||
# Should be able to instantiate a JPEG2000SignatureBox
|
||||
# Should be able to instantiate a JPEG2000SignatureBox
|
||||
b = glymur.jp2box.JPEG2000SignatureBox()
|
||||
self.assertEqual(b.signature, (13, 10, 135, 10))
|
||||
|
||||
def test_default_FileTypeBox(self):
|
||||
# Should be able to instantiate a FileTypeBox
|
||||
# Should be able to instantiate a FileTypeBox
|
||||
b = glymur.jp2box.FileTypeBox()
|
||||
self.assertEqual(b.brand, 'jp2 ')
|
||||
self.assertEqual(b.minor_version, 0)
|
||||
|
|
@ -72,7 +75,15 @@ class TestJp2Boxes(unittest.TestCase):
|
|||
with self.assertRaises(IOError):
|
||||
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__":
|
||||
unittest.main()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue