用法:
class skimage.viewer.plugins.Plugin(image_filter=None, height=0, width=400, useblit=True, dock='bottom')
基础:
PyQt5.QtWidgets.QDialog
与 ImageViewer 交互的插件的基类
插件将图像过滤器(或其他函数)连接到图像查看器。请注意,插件是在没有图像查看器的情况下初始化的,并在后面的步骤中附加。有关详细信息,请参见下面的示例。
- image_viewer:ImageViewer
包含用于测量/操作的图像的窗口。
- image_filter:函数
调用以在图像查看器中更新图像的函数。例如,如果您有一个从图像中提取信息并且不对其进行操作的插件,则此值可以为 None。或者,可以将此函数定义为 Plugin 子类中的方法。
- height, width:int
插件窗口的大小(以像素为单位)。请注意,Qt 会自动调整窗口大小以适应组件。因此,如果您要添加多行组件,您可以让 height = 0 并让 Qt 确定最终高度。
- useblit:bool
如果为 True,则使用 blitting 来加速动画。仅在某些 Matplotlib 后端可用。如果为 None,则在使用 Agg 后端时设置为 True。仅当您在图像查看器上绘制时,这才有效。
参数:
例子:
>>> from skimage.viewer import ImageViewer >>> from skimage.viewer.widgets import Slider >>> from skimage import data >>> >>> plugin = Plugin(image_filter=lambda img, ... threshold: img > threshold) >>> plugin += Slider('threshold', 0, 255) >>> >>> image = data.coins() >>> viewer = ImageViewer(image) >>> viewer += plugin >>> thresholded = viewer.show()[0][0]
该插件将根据其参数类型自动将参数委托给image_filter,即ptype(所需参数的小部件必须按照它们在函数中出现的顺序添加)。附加到查看器的图像会自动作为第一个参数传递给过滤器函数。
#TODO:添加标志,因此默认情况下图像不会传递给过滤函数。
ptype = ‘kwarg’ 是大多数小部件的默认值,因此这里没有必要。
- image_viewer:ImageViewer
包含测量中使用的图像的窗口。
- name:str
插件的名称。这显示为窗口标题。
- artist:列表
Matplotlib 艺术家和画布工具列表。插件创建的任何艺术家都应添加到此列表中,以便在关闭时对其进行清理。
属性:
相关用法
- Python skimage.viewer.canvastools.RectangleTool用法及代码示例
- Python skimage.viewer.canvastools.PaintTool用法及代码示例
- Python skimage.viewer.ImageViewer用法及代码示例
- Python skimage.feature.graycomatrix用法及代码示例
- Python skimage.color.lab2lch用法及代码示例
- Python skimage.draw.random_shapes用法及代码示例
- Python skimage.feature.blob_doh用法及代码示例
- Python skimage.feature.blob_dog用法及代码示例
- Python skimage.filters.unsharp_mask用法及代码示例
- Python skimage.registration.optical_flow_tvl1用法及代码示例
- Python skimage.filters.rank.noise_filter用法及代码示例
- Python skimage.exposure.histogram用法及代码示例
- Python skimage.filters.gaussian用法及代码示例
- Python skimage.feature.graycoprops用法及代码示例
- Python skimage.segmentation.active_contour用法及代码示例
- Python skimage.feature.corner_orientations用法及代码示例
- Python skimage.exposure.adjust_gamma用法及代码示例
- Python skimage.morphology.h_minima用法及代码示例
- Python skimage.filters.threshold_otsu用法及代码示例
- Python skimage.feature.structure_tensor用法及代码示例
注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.viewer.plugins.Plugin。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。