scistag.plotstag.layers.image_layer.ImageLayer¶
- class ImageLayer(image, size_ratio=None, bg_fill='cb')[source]¶
Bases:
PlotLayerVisualizes an image on a plot.
- Parameters
image (Image | np.ndarray) – The image to plot
size_ratio (float | tuple[float, float] | None) –
The size ratio from the image’s or matrix original size to effective pixels. This can be used to plot images in original size rather than being auto-scaled through the plot’s configuration.
1.0 = keep the original size.
0.5 = 50% of the original size
…
bg_fill (str | Color | None) –
Defines the background which shall be used if the image is alpha-transparent. If a color is passed the whole background will be filled with given color.
”cb” (checkerboard) by default.
Methods
Renders a checkerboard as background for transparent images :rtype:
Image:return: The checkerboard graphicPaints the layer's content :type canvas:
Canvas:param canvas: The target canvas into which the content shall be painted.Updates the layout (especially .size) with the size foreseen by the plot :type desired_size: Size2D | None :param desired_size: The proposed size by the plot :type forced_size: Size2D | None :param forced_size: Enforced size i f the size can under no circumstances be influenced by a layer.
Attributes
__dict____doc____module____weakref__list of weak references to the object (if defined)
The image to be plotted
The scaled version of the image to be plotted
Defines if the whole content shall be rendered into a separated clippable canvas
Defines the way the background is filled if he image is alpha- transparent.
- static generate_checkerboard()[source]¶
Renders a checkerboard as background for transparent images :rtype:
Image:return: The checkerboard graphic
- paint(canvas)[source]¶
Paints the layer’s content :type canvas:
Canvas:param canvas: The target canvas into which the content shall bepainted.
- update_layout(desired_size=None, forced_size=None)[source]¶
Updates the layout (especially .size) with the size foreseen by the plot :type desired_size: Size2D | None :param desired_size: The proposed size by the plot :type forced_size: Size2D | None :param forced_size: Enforced size i f the size can under no
circumstances be influenced by a layer.
- _image¶
The image to be plotted
- _scaled_image¶
The scaled version of the image to be plotted
- bg_fill: str | Color | None¶
Defines the way the background is filled if he image is alpha- transparent. Either with a color or a checkerboard (“cb”)
- needs_clipping¶
Defines if the whole content shall be rendered into a separated clippable canvas
- value_range: PlotValueRange2D | PlotValueRange3D¶
The range of the values stored in this layer