def add_highlight_area(self, mask, label=None, col=0):
        """add a highlighted area -- outline an arbitrarily shape --
        as if drawn from a Lasso event.

        This takes a mask, which should be a boolean array of the
        same shape as the image.
        """
        patch = mask * np.ones(mask.shape) * 0.9
        cmap = self.conf.cmap[col]
        area = self.axes.contour(patch, cmap=cmap, levels=[0, 1])
        self.conf.highlight_areas.append(area)
        col = None
        if hasattr(cmap, '_lut'):
            rgb  = [int(i*240)^255 for i in cmap._lut[0][:3]]
            col  = '#%02x%02x%02x' % (rgb[0], rgb[1], rgb[2])

        if label is not None:
            def fmt(*args, **kws): return label
            self.axes.clabel(area, fontsize=9, fmt=fmt,
                             colors=col, rightside_up=True)

        if col is not None:
            for l in area.collections:
                l.set_color(col)

        self.canvas.draw()
def add_highlight_area ( self , mask , label = None , col = 0 ) : patch = mask * np . ones ( mask . shape ) * 0.9 cmap = self . conf . cmap [ col ] area = self . axes . contour ( patch , cmap = cmap , levels = [ 0 , 1 ] ) self . conf . highlight_areas . append ( area ) col = None if hasattr ( cmap , '_lut' ) : rgb = [ int ( i * 240 ) ^ 255 for i in cmap . _lut [ 0 ] [ : 3 ] ] col = '#%02x%02x%02x' % ( rgb [ 0 ] , rgb [ 1 ] , rgb [ 2 ] ) if label is not None : def fmt ( * args , ** kws ) : return label self . axes . clabel ( area , fontsize = 9 , fmt = fmt , colors = col , rightside_up = True ) if col is not None : for l in area . collections : l . set_color ( col ) self . canvas . draw ( )
add a highlighted area -- outline an arbitrarily shape --
        as if drawn from a Lasso event.

        This takes a mask, which should be a boolean array of the
        same shape as the image.