def __init__(self, parent=None, imageSize=None, roi=None, viewer=None, color=QtCore.Qt.yellow, width=0, alwaysVisible=True): QImageViewerTool.__init__(self, parent) self._painting = False self._alwaysVisible = False self.roi = roi self.color = color self.width = width if viewer: self._viewer = viewer else: self._viewer = parent.viewer if imageSize == None and hasattr(parent, 'image'): imageSize = parent.image.size() self._validRect = imageSize and Rect2D(imageSize) self.setVisible(alwaysVisible) self.connectViewer(self._viewer)
def __init__(self, map, parent = None): QImageViewerTool.__init__(self, parent) self._map = map self._painting = False self._currentLabel = None self._changed = None s = map.imageSize() self._mapArea = s.width * s.height self.connectViewer(parent.viewer)
def __init__(self, map = None, markFlags = SRG_SEED, parent = None): QImageViewerTool.__init__(self, parent) self.seeds = [] self._seedMap = None self.overlay = PointOverlay(self.seeds, QtCore.Qt.cyan, 2) viewer.addOverlay(self.overlay) self.map = map self.markFlags = markFlags self.connectViewer(parent.viewer)
def __init__(self, map, mapEdges, parent = None): QImageViewerTool.__init__(self, parent) self._map = map self._liveWire = None self._loopNodeLabel = None self._startNodeLabel = None self._loop = None self._contour = [] # darts within current (multi-segment) contour self._prevContour = None # last finished _contour self._seeds = [] # all seeds of all contours (for debugging ATM) self._expandTimer = QtCore.QTimer(self) self._mapEdges = mapEdges self.connect(self._expandTimer, QtCore.SIGNAL("timeout()"), self._expandBorder) self.connectViewer(parent.viewer) self._overlay = PointOverlay([], QtCore.Qt.green, 1) self._viewer.addOverlay(self._overlay)
def __init__(self, parent = None, imageSize = None, roi = None, viewer = None, color = QtCore.Qt.yellow, width = 0, alwaysVisible = True): QImageViewerTool.__init__(self, parent) self._painting = False self._alwaysVisible = False self.roi = roi self.color = color self.width = width if viewer: self._viewer = viewer else: self._viewer = parent.viewer if imageSize == None and hasattr(parent, 'image'): imageSize = parent.image.size() self._validRect = imageSize and Rect2D(imageSize) self.setVisible(alwaysVisible) self.connectViewer(self._viewer)
def __init__(self, map, edgeOverlay, classes = (FOREGROUND_FACE, BACKGROUND_FACE, 0), classNames = None, colors = (QtCore.Qt.yellow, QtCore.Qt.cyan), filter = None, parent = None): """Initialize and start the ManualClassifier tool. The edgeOverlay is needed for the internal MapFaces overlays (for efficient implementation), often one simply passes the .edgeOverlay attribute of the MapDisplay. The `classes` can be user-defined flags and default to FOREGROUND_FACE/BACKGROUND_FACE/no flag (see flag_constants module). The `colors` array should have the same size (otherwise it is cropped or padded with None) and is used to initialize corresponding MapFaces overlays for displaying the classes (a class with a color of None will not be displayed). If a `filter` is given, it is called for every face to determine whether its classification may be changed at all. For instance, this can be used to make sure that only objects are classified, and the background region is never assigned to some object class. For display and interaction reasons, the given parent (usually a MapDisplay) *must* have a 'viewer' attribute.""" QImageViewerTool.__init__(self, parent) self.manual = {} self._map = map self._classes = list(classes) if len(colors) != len(classes): colors = list(colors)[:len(classes)] if len(colors) < len(classes): colors += [None] * (len(classes) - len(colors)) self._classMask = 0 for c in classes: self._classMask |= c import mapdisplay # (nb: MapFaces cannot display faces with flags = 0) self._overlays = [ mapdisplay.MapFaces(map, edgeOverlay, color = c, flags = f) for c, f in zip(colors, classes) if c and f] if classNames: for o in self._overlays: i = self._classes.index(o.flags) o.name = classNames[i] self.filter = filter self._enabled = True self._pressed = False self._toggling = False self.connectViewer(parent.viewer) for o in self._overlays: viewer.addOverlay(o)
def __init__(self, map, foreground, parent = None): QImageViewerTool.__init__(self, parent) self._map = map self.foreground = foreground self.manual = {} self.connectViewer(parent.viewer)
def __init__(self, map, display): QImageViewerTool.__init__(self, display) self._map = map self.display = display self.connectViewer(display.viewer)