Module: viewer.utils
| Return figure and axes with figure tightly surrounding image. |
Initialize QAppliction. | |
| Return new figure and axes. |
Start Qt mainloop | |
Update the image displayed by an image plot. | |
| Color map that varies linearly from alpha = 0 to 1 |
| Canvas for displaying images. |
| LinearSegmentedColormap in which color varies smoothly. |
| A class attribute that must be set before use. |
| |
| |
|
figimage
-
skimage.viewer.utils.figimage(image, scale=1, dpi=None, **kwargs)
[source] -
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
-
-
imagearray
-
image to plot
-
scalefloat
-
If scale is 1, the figure and axes have the same dimension as the image. Smaller values of
scale
will shrink the figure. -
dpiint
-
Dots per inch for figure. If None, use the default rcParam.
-
init_qtapp
-
skimage.viewer.utils.init_qtapp()
[source] -
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)
[source] -
Return new figure and axes.
- Parameters
-
-
parentQtWidget
-
Qt widget that displays the plot objects. If None, you must manually call
canvas.setParent
and pass the parent widget. -
subplot_kwdict
-
Keyword arguments passed
matplotlib.figure.Figure.add_subplot
. -
fig_kwdict
-
Keyword arguments passed
matplotlib.figure.Figure
.
-
start_qtapp
-
skimage.viewer.utils.start_qtapp(app=None)
[source] -
Start Qt mainloop
update_axes_image
-
skimage.viewer.utils.update_axes_image(image_axes, image)
[source] -
Update the image displayed by an image plot.
This sets the image plot’s array and updates its shape appropriately
- Parameters
-
-
image_axesmatplotlib.image.AxesImage
-
Image axes to update.
-
imagearray
-
Image array.
-
ClearColormap
-
class skimage.viewer.utils.ClearColormap(rgb, max_alpha=1, name='clear_color')
[source] -
Bases:
skimage.viewer.utils.core.LinearColormap
Color map that varies linearly from alpha = 0 to 1
-
__init__(rgb, max_alpha=1, name='clear_color')
[source] -
Create color map from linear mapping segments
segmentdata argument is a dictionary with a red, green and blue entries. Each entry should be a list of x, y0, y1 tuples, forming rows in a table. Entries for alpha are optional.
Example: suppose you want red to increase from 0 to 1 over the bottom half, green to do the same over the middle half, and blue over the top half. Then you would use:
cdict = {'red': [(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 1.0, 1.0)], 'green': [(0.0, 0.0, 0.0), (0.25, 0.0, 0.0), (0.75, 1.0, 1.0), (1.0, 1.0, 1.0)], 'blue': [(0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (1.0, 1.0, 1.0)]}
Each row in the table for a given color is a sequence of x, y0, y1 tuples. In each sequence, x must increase monotonically from 0 to 1. For any input value z falling between x[i] and x[i+1], the output value of a given color will be linearly interpolated between y1[i] and y0[i+1]:
row i: x y0 y1 / / row i+1: x y0 y1
Hence y0 in the first row and y1 in the last row are never used.
See also
-
LinearSegmentedColormap.from_list
-
Static method; factory function for generating a smoothly-varying LinearSegmentedColormap.
-
makeMappingArray
-
For information about making a mapping array.
-
-
FigureCanvas
-
class skimage.viewer.utils.FigureCanvas(figure, **kwargs)
[source] -
Bases:
object
Canvas for displaying images.
-
__init__(figure, **kwargs)
[source] -
Initialize self. See help(type(self)) for accurate signature.
-
resizeEvent(event)
[source]
-
LinearColormap
-
class skimage.viewer.utils.LinearColormap(name, segmented_data, **kwargs)
[source] -
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
-
-
namestr
-
Name of colormap.
-
segmented_datadict
-
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)
[source] -
Create color map from linear mapping segments
segmentdata argument is a dictionary with a red, green and blue entries. Each entry should be a list of x, y0, y1 tuples, forming rows in a table. Entries for alpha are optional.
Example: suppose you want red to increase from 0 to 1 over the bottom half, green to do the same over the middle half, and blue over the top half. Then you would use:
cdict = {'red': [(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 1.0, 1.0)], 'green': [(0.0, 0.0, 0.0), (0.25, 0.0, 0.0), (0.75, 1.0, 1.0), (1.0, 1.0, 1.0)], 'blue': [(0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (1.0, 1.0, 1.0)]}
Each row in the table for a given color is a sequence of x, y0, y1 tuples. In each sequence, x must increase monotonically from 0 to 1. For any input value z falling between x[i] and x[i+1], the output value of a given color will be linearly interpolated between y1[i] and y0[i+1]:
row i: x y0 y1 / / row i+1: x y0 y1
Hence y0 in the first row and y1 in the last row are never used.
See also
-
LinearSegmentedColormap.from_list
-
Static method; factory function for generating a smoothly-varying LinearSegmentedColormap.
-
makeMappingArray
-
For information about making a mapping array.
-
RequiredAttr
-
class skimage.viewer.utils.RequiredAttr(init_val=None)
[source] -
Bases:
object
A class attribute that must be set before use.
-
__init__(init_val=None)
[source] -
Initialize self. See help(type(self)) for accurate signature.
-
instances = {(<skimage.viewer.utils.core.RequiredAttr object>, None): 'Widget is not attached to a Plugin.', (<skimage.viewer.utils.core.RequiredAttr object>, None): 'Plugin is not attached to ImageViewer'}
-
© 2019 the scikit-image team
Licensed under the BSD 3-clause License.
https://scikit-image.org/docs/0.18.x/api/skimage.viewer.utils.html