def _handlePolygonMask(self, points): _logger.debug("_handlePolygonMask called") if self._eraseMode: value = 0 else: value = self._nRoi x, y, legend, info = self.getCurve(self._selectionCurve)[0:4] x.shape = -1 y.shape = -1 currentMask = self.getSelectionMask() if currentMask is None: currentMask = numpy.zeros(y.shape, dtype=numpy.uint8) if value == 0: return Z = numpy.zeros((y.size, 2), numpy.float64) Z[:, 0] = x Z[:, 1] = y mask = pnpoly(points, Z, 1) mask.shape = currentMask.shape currentMask[mask > 0] = value self.setSelectionMask(currentMask, plot=True) self._emitMaskChangedSignal()
def _handlePolygonMask(self, points): _logger.debug("_handlePolygonMask called") if self._eraseMode: value = 0 else: value = self._nRoi x, y = self.getCurve(self._selectionCurve)[0:2] x.shape = -1 y.shape = -1 currentMask = self.getSelectionMask() if currentMask is None: currentMask = numpy.zeros(y.shape, dtype=numpy.uint8) if value == 0: return Z = numpy.zeros((y.size, 2), numpy.float64) Z[:, 0] = x Z[:, 1] = y mask = pnpoly(points, Z, 1) mask.shape = currentMask.shape currentMask[mask > 0] = value self.setSelectionMask(currentMask, plot=True) self._emitMaskChangedSignal()