API change: switch order of image viewer and callback arguments.

This commit is contained in:
Tony S Yu
2012-07-20 14:45:32 -05:00
parent c27119b0cd
commit 1903ed892d
3 changed files with 10 additions and 7 deletions
+6 -5
View File
@@ -27,16 +27,17 @@ class Plugin(QtGui.QDialog):
overlay : array
Image used in measurement/manipulation.
"""
def __init__(self, callback, parent=None, height=100, width=400):
self._viewer = parent
QtGui.QDialog.__init__(self, parent)
def __init__(self, image_viewer, callback=None, height=100, width=400):
self._viewer = image_viewer
QtGui.QDialog.__init__(self, image_viewer)
self.setWindowTitle('Image Plugin')
self.layout = QtGui.QGridLayout(self)
self.resize(width, height)
self.row = 0
self.callback = callback
if callback is not None:
self.callback = callback
self.arguments = [parent.original_image]
self.arguments = [image_viewer.original_image]
self.keyword_arguments= {}
self.overlay = self._viewer.overlay
+2 -2
View File
@@ -4,10 +4,10 @@ from skimage.filter import canny
class CannyPlugin(Plugin):
def __init__(self, parent, *args, **kwargs):
def __init__(self, image_viewer, *args, **kwargs):
height = kwargs.get('height', 100)
width = kwargs.get('width', 400)
super(CannyPlugin, self).__init__(self.callback, parent=parent,
super(CannyPlugin, self).__init__(image_viewer,
width=width, height=height)
self.add_keyword_argument('sigma', 0.005, 0, self.caller)
self.add_keyword_argument('low_threshold', 0.255, 0, self.caller)
+2
View File
@@ -63,6 +63,8 @@ class LinearColormap(LinearSegmentedColormap):
class ClearColormap(LinearColormap):
"""Color map that varies linearly from alpha = 0 to 1
"""
def __init__(self, name, rgb):
r, g, b = rgb
cg_speq = {'blue': [(0.0, b), (1.0, b)],