用法:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。