Skip to content

ImageView.__str__ fails when viewing class labels without image data #27

@tboggs

Description

@tboggs

ImageView.__str__ prints the bands element of the RGB metadata; however, this metadata element is not present if class labels are being viewed without an associated image data array. For example:

>>> v = spy.imshow(classes=gt)
>>> v
/home/thomas/src/spectral/spectral/graphics/spypylab.pyc in __str__(self)
   1117         meta = self.data_rgb_meta
   1118         s = 'ImageView object:\n'
-> 1119         s += '  {0:<20}:  {1}\n'.format("Display bands", meta['bands'])
   1120         if self.interpolation == None:
   1121             interp = "<default>"

KeyError: u'bands'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions