minor edits

This commit is contained in:
Luke Campagnola 2016-09-06 17:46:52 -07:00
parent c17f03ea46
commit 748a8433b9
2 changed files with 9 additions and 27 deletions

View File

@ -1727,7 +1727,7 @@ def isosurface(data, level):
See Paul Bourke, "Polygonising a Scalar Field" See Paul Bourke, "Polygonising a Scalar Field"
(http://paulbourke.net/geometry/polygonise/) (http://paulbourke.net/geometry/polygonise/)
*data* 3D numpy array of scalar values *data* 3D numpy array of scalar values. Must be contiguous.
*level* The level at which to generate an isosurface *level* The level at which to generate an isosurface
Returns an array of vertex coordinates (Nv, 3) and an array of Returns an array of vertex coordinates (Nv, 3) and an array of
@ -2079,7 +2079,10 @@ def isosurface(data, level):
else: else:
faceShiftTables, edgeShifts, edgeTable, nTableFaces = IsosurfaceDataCache faceShiftTables, edgeShifts, edgeTable, nTableFaces = IsosurfaceDataCache
# We use strides below, which means we need contiguous array input.
# Ideally we can fix this just by removing the dependency on strides.
if not data.flags['C_CONTIGUOUS']:
raise TypeError("isosurface input data must be c-contiguous.")
## mark everything below the isosurface level ## mark everything below the isosurface level
mask = data < level mask = data < level

View File

@ -502,21 +502,6 @@ class ImageItem(GraphicsObject):
self.qimage = None self.qimage = None
self.update() self.update()
#def mousePressEvent(self, ev):
#if self.drawKernel is not None and ev.button() == QtCore.Qt.LeftButton:
#self.drawAt(ev.pos(), ev)
#ev.accept()
#else:
#ev.ignore()
#def mouseMoveEvent(self, ev):
##print "mouse move", ev.pos()
#if self.drawKernel is not None:
#self.drawAt(ev.pos(), ev)
#def mouseReleaseEvent(self, ev):
#pass
def mouseDragEvent(self, ev): def mouseDragEvent(self, ev):
if ev.button() != QtCore.Qt.LeftButton: if ev.button() != QtCore.Qt.LeftButton:
ev.ignore() ev.ignore()
@ -553,24 +538,18 @@ class ImageItem(GraphicsObject):
self.menu.remAct = remAct self.menu.remAct = remAct
return self.menu return self.menu
def hoverEvent(self, ev): def hoverEvent(self, ev):
if not ev.isExit() and self.drawKernel is not None and ev.acceptDrags(QtCore.Qt.LeftButton): if not ev.isExit() and self.drawKernel is not None and ev.acceptDrags(QtCore.Qt.LeftButton):
ev.acceptClicks(QtCore.Qt.LeftButton) ## we don't use the click, but we also don't want anyone else to use it. ev.acceptClicks(QtCore.Qt.LeftButton) ## we don't use the click, but we also don't want anyone else to use it.
ev.acceptClicks(QtCore.Qt.RightButton) ev.acceptClicks(QtCore.Qt.RightButton)
#self.box.setBrush(fn.mkBrush('w'))
elif not ev.isExit() and self.removable: elif not ev.isExit() and self.removable:
ev.acceptClicks(QtCore.Qt.RightButton) ## accept context menu clicks ev.acceptClicks(QtCore.Qt.RightButton) ## accept context menu clicks
#else:
#self.box.setBrush(self.brush)
#self.update()
def tabletEvent(self, ev): def tabletEvent(self, ev):
print(ev.device()) pass
print(ev.pointerType()) #print(ev.device())
print(ev.pressure()) #print(ev.pointerType())
#print(ev.pressure())
def drawAt(self, pos, ev=None): def drawAt(self, pos, ev=None):
pos = [int(pos.x()), int(pos.y())] pos = [int(pos.x()), int(pos.y())]