def _create_icon(self, color_map_name, image, values):
        """"
        :type color_map_name: str
        :type image: QImage
        :type values: np.ndarray
        """

        color_map = ScalarMappable(cmap=color_map_name)
        rgba = color_map.to_rgba(values, bytes=True)

        color_table = [qRgb(c[0], c[1], c[2]) for c in rgba]
        image.setColorTable(color_table)

        return QPixmap.fromImage(image).scaledToWidth(128)
def _create_icon ( self , color_map_name , image , values ) : color_map = ScalarMappable ( cmap = color_map_name ) rgba = color_map . to_rgba ( values , bytes = True ) color_table = [ qRgb ( c [ 0 ] , c [ 1 ] , c [ 2 ] ) for c in rgba ] image . setColorTable ( color_table ) return QPixmap . fromImage ( image ) . scaledToWidth ( 128 )
:type color_map_name: str
        :type image: QImage
        :type values: np.ndarray