Module: viewer.utils

ClearColormap

class skimage.viewer.utils.ClearColormap(rgb, max_alpha=1, name='clear_color')

Bases: skimage.viewer.utils.core.LinearColormap

Color map that varies linearly from alpha = 0 to 1

__init__(rgb, max_alpha=1, name='clear_color')

FigureCanvas

class skimage.viewer.utils.FigureCanvas(figure, **kwargs)

Bases: matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg

Canvas for displaying images.

__init__(figure, **kwargs)
resizeEvent(event)

LinearColormap

class skimage.viewer.utils.LinearColormap(name, segmented_data, **kwargs)

Bases: matplotlib.colors.LinearSegmentedColormap

LinearSegmentedColormap in which color varies smoothly.

This class is a simplification of LinearSegmentedColormap, which doesn’t support jumps in color intensities.

Parameters:

name : str

Name of colormap.

segmented_data : dict

Dictionary of ‘red’, ‘green’, ‘blue’, and (optionally) ‘alpha’ values. Each color key contains a list of x, y tuples. x must increase monotonically from 0 to 1 and corresponds to input values for a mappable object (e.g. an image). y corresponds to the color intensity.

__init__(name, segmented_data, **kwargs)

RequiredAttr

class skimage.viewer.utils.RequiredAttr(msg='Required attribute not set', init_val=None)

Bases: object

A class attribute that must be set before use.

__init__(msg='Required attribute not set', init_val=None)
instances = {(<skimage.viewer.utils.core.RequiredAttr object at 0x9559350>, None): None, (<skimage.viewer.utils.core.RequiredAttr object at 0x95567d0>, None): None}
skimage.viewer.utils.figimage(image[, ...]) Return figure and axes with figure tightly surrounding image.
skimage.viewer.utils.init_qtapp() Initialize QAppliction.
skimage.viewer.utils.new_plot([parent, ...]) Return new figure and axes.
skimage.viewer.utils.start_qtapp([app]) Start Qt mainloop
skimage.viewer.utils.update_axes_image(...) Update the image displayed by an image plot.

figimage

skimage.viewer.utils.figimage(image, scale=1, dpi=None, **kwargs)

Return figure and axes with figure tightly surrounding image.

Unlike pyplot.figimage, this actually plots onto an axes object, which fills the figure. Plotting the image onto an axes allows for subsequent overlays of axes artists.

Parameters:

image : array

image to plot

scale : float

If scale is 1, the figure and axes have the same dimension as the image. Smaller values of scale will shrink the figure.

dpi : int

Dots per inch for figure. If None, use the default rcParam.

init_qtapp

skimage.viewer.utils.init_qtapp()

Initialize QAppliction.

The QApplication needs to be initialized before creating any QWidgets

new_plot

skimage.viewer.utils.new_plot(parent=None, subplot_kw=None, **fig_kw)

Return new figure and axes.

Parameters:

parent : QtWidget

Qt widget that displays the plot objects. If None, you must manually call canvas.setParent and pass the parent widget.

subplot_kw : dict

Keyword arguments passed matplotlib.figure.Figure.add_subplot.

fig_kw : dict

Keyword arguments passed matplotlib.figure.Figure.

start_qtapp

skimage.viewer.utils.start_qtapp(app=None)

Start Qt mainloop

update_axes_image

skimage.viewer.utils.update_axes_image(image_axes, image)

Update the image displayed by an image plot.

This sets the image plot’s array and updates its shape appropriately

Parameters:

image_axes : matplotlib.image.AxesImage

Image axes to update.

image : array

Image array.