JPEG2000SignatureBox can now has simple constructor call.
This commit is contained in:
parent
461f5568e2
commit
b881e44814
2 changed files with 35 additions and 1 deletions
|
|
@ -59,6 +59,11 @@ class Jp2kBox(object):
|
|||
msg += " @ ({0}, {1})".format(self.offset, self.length)
|
||||
return msg
|
||||
|
||||
def _write(self, f):
|
||||
"""Must be implemented in a subclass.
|
||||
"""
|
||||
raise NotImplementedError("Not supported for this box.")
|
||||
|
||||
def _parse_superbox(self, f):
|
||||
"""Parse a superbox (box consisting of nothing but other boxes.
|
||||
|
||||
|
|
@ -882,8 +887,10 @@ class JPEG2000SignatureBox(Jp2kBox):
|
|||
Four-byte tuple identifying the file as JPEG 2000.
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
Jp2kBox.__init__(self, id='', longname='JPEG 2000 Signature')
|
||||
Jp2kBox.__init__(self, id='jP ', longname='JPEG 2000 Signature')
|
||||
self.__dict__.update(**kwargs)
|
||||
if 'signature' not in kwargs.keys():
|
||||
self.signature = (13, 10, 135, 10)
|
||||
|
||||
def __str__(self):
|
||||
msg = Jp2kBox.__str__(self)
|
||||
|
|
|
|||
27
glymur/test/test_jp2box.py
Normal file
27
glymur/test/test_jp2box.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import unittest
|
||||
|
||||
import numpy as np
|
||||
import pkg_resources
|
||||
|
||||
import glymur
|
||||
|
||||
@unittest.skipIf(glymur.lib.openjp2._OPENJP2 is None,
|
||||
"Missing openjp2 library.")
|
||||
class TestJp2Boxes(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.jp2file = pkg_resources.resource_filename(glymur.__name__,
|
||||
"data/nemo.jp2")
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_default_JPEG2000SignatureBox(self):
|
||||
# Should be able to instantiate a JPEG2000SignatureBox
|
||||
b = glymur.jp2box.JPEG2000SignatureBox()
|
||||
self.assertEqual(b.signature, (13, 10, 135, 10))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue