Now printing fuam, dcm, standard masks. #163

Improves visual decoding of the reader requirements box.
This commit is contained in:
John Evans 2014-02-10 09:38:15 -05:00
commit 29dbf594a5
4 changed files with 29 additions and 20 deletions

View file

@ -2,12 +2,12 @@ Feb 09, 2014 - Removed support for Python 2.6. Added write support for JP2
UUID, DataEntryURL, Palette and Component Mapping boxes, JPX
Association, NumberList and DataReference boxes. Added read
support for JPX free, number list, data reference, fragment
table, and fragment list boxes. Added get_printoptions,
set_printoptions functions. Palette box now a 2D numpy array
instead of a list of 1D arrays. JP2 super box constructors now
take optional box list argument. Fixed bug where JPX files
with more than one codestream but advertising jp2 compatibility
were not being read.
table, and fragment list boxes. Improved JPX Reader Requirements box
support. Added get_printoptions, set_printoptions functions.
Palette box now a 2D numpy array instead of a list of 1D arrays.
JP2 super box constructors now take optional box list argument.
Fixed bug where JPX files with more than one codestream but
advertising jp2 compatibility were not being read.
Jan 28, 2014 - v0.5.10 Fixed bad warning when reader requirements box mask
length is unsupported.

View file

@ -1861,6 +1861,14 @@ class ReaderRequirementsBox(Jp2kBox):
if _printoptions['short'] == True:
return msg
msg += '\n Fully Understands Aspect Mask: {0}'.format(self.fuam)
msg += '\n Display Completely Mask: {0}'.format(self.dcm)
msg += '\n Standard Features and Masks:'
for j in range(len(self.standard_flag)):
sfl = self.standard_flag[j]
mask = self.standard_mask[j]
msg += '\n Feature {0:03d}: {1}'.format(sfl, mask)
msg += '\n Standard Features:'
for j in range(len(self.standard_flag)):

View file

@ -682,3 +682,17 @@ JP2 Header Box (jp2h) @ (32, 45)
UUID Box (uuid) @ (77, 3146)
UUID: be7acfcb-97a9-42e8-9c71-999491e3afac (XMP)
Contiguous Codestream Box (jp2c) @ (3223, 1132296)"""
# Output of reader requirement printing for file7.jp2
file7_rreq = r"""Reader Requirements Box (rreq) @ (44, 24)
Fully Understands Aspect Mask: 160
Display Completely Mask: 192
Standard Features and Masks:
Feature 005: 128
Feature 060: 96
Feature 043: 64
Standard Features:
Feature 005: Unrestricted JPEG 2000 Part 1 codestream, ITU-T Rec. T.800 | ISO/IEC 15444-1
Feature 060: e-sRGB enumerated colorspace
Feature 043: (Deprecated) compositing layer uses restricted ICC profile
Vendor Features:"""

View file

@ -738,20 +738,7 @@ class TestPrinting(unittest.TestCase):
with patch('sys.stdout', new=StringIO()) as fake_out:
print(j.box[2])
actual = fake_out.getvalue().strip()
lines = ['Reader Requirements Box (rreq) @ (44, 24)',
' Standard Features:',
' Feature 005: '
+ 'Unrestricted JPEG 2000 Part 1 codestream, '
+ 'ITU-T Rec. T.800 | ISO/IEC 15444-1',
' Feature 060: e-sRGB enumerated colorspace',
' Feature 043: '
+ '(Deprecated) '
+ 'compositing layer uses restricted ICC profile',
' Vendor Features:']
expected = '\n'.join(lines)
self.assertEqual(actual, expected)
self.assertEqual(actual, fixtures.file7_rreq)
@unittest.skipIf(OPJ_DATA_ROOT is None,
"OPJ_DATA_ROOT environment variable not set")