Refactor ChannelDefinitionBox __str__ method
This commit is contained in:
parent
fdbbf999ca
commit
256ebbf9ec
1 changed files with 12 additions and 5 deletions
|
|
@ -630,19 +630,26 @@ class ChannelDefinitionBox(Jp2kBox):
|
||||||
self._dispatch_validation_error(msg, writing=writing)
|
self._dispatch_validation_error(msg, writing=writing)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
msg = Jp2kBox.__str__(self)
|
title = Jp2kBox.__str__(self)
|
||||||
if _printoptions['short'] is True:
|
if _printoptions['short'] is True:
|
||||||
return msg
|
return title
|
||||||
|
|
||||||
|
lst = []
|
||||||
for j in range(len(self.association)):
|
for j in range(len(self.association)):
|
||||||
color_type_string = _COLOR_TYPE_MAP_DISPLAY[self.channel_type[j]]
|
color_type_string = _COLOR_TYPE_MAP_DISPLAY[self.channel_type[j]]
|
||||||
if self.association[j] == 0:
|
if self.association[j] == 0:
|
||||||
assn = 'whole image'
|
assn = 'whole image'
|
||||||
else:
|
else:
|
||||||
assn = str(self.association[j])
|
assn = str(self.association[j])
|
||||||
msg += '\n Channel {0} ({1}) ==> ({2})'
|
text = 'Channel {0} ({1}) ==> ({2})'.format(self.index[j],
|
||||||
msg = msg.format(self.index[j], color_type_string, assn)
|
color_type_string,
|
||||||
return msg
|
assn)
|
||||||
|
lst.append(text)
|
||||||
|
|
||||||
|
text = '\n'.join(lst)
|
||||||
|
text = self._indent(text)
|
||||||
|
text = '\n'.join([title, text])
|
||||||
|
return text
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
msg = "glymur.jp2box.ChannelDefinitionBox("
|
msg = "glymur.jp2box.ChannelDefinitionBox("
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue