diff --git a/CHANGELOG b/CHANGELOG index dcc21eb5..15ce1536 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -48,6 +48,11 @@ pyqtgraph-0.9.9 [unreleased] - PlotCurveItem ignores clip-to-view when auto range is enabled - FillBetweenItem now forces PlotCurveItem to generate path - Fixed import errors and py3 issues in MultiPlotWidget + - Isosurface works for arrays with shapes > 255 + - Fixed ImageItem exception building histogram when image has only one value + - Fixed MeshData exception caused when vertexes have no matching faces + - Fixed GLViewWidget exception handler + pyqtgraph-0.9.8 2013-11-24 diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py index db01b6b9..99c45606 100644 --- a/pyqtgraph/functions.py +++ b/pyqtgraph/functions.py @@ -1790,7 +1790,7 @@ def isosurface(data, level): [1, 1, 0, 2], [0, 1, 0, 2], #[9, 9, 9, 9] ## fake - ], dtype=np.ubyte) + ], dtype=np.uint16) # don't use ubyte here! This value gets added to cell index later; will need the extra precision. nTableFaces = np.array([len(f)/3 for f in triTable], dtype=np.ubyte) faceShiftTables = [None] for i in range(1,6): @@ -1889,7 +1889,6 @@ def isosurface(data, level): #profiler() if cells.shape[0] == 0: continue - #cellInds = index[(cells*ins[np.newaxis,:]).sum(axis=1)] cellInds = index[cells[:,0], cells[:,1], cells[:,2]] ## index values of cells to process for this round #profiler() @@ -1901,9 +1900,7 @@ def isosurface(data, level): #profiler() ### expensive: - #print verts.shape verts = (verts * cs[np.newaxis, np.newaxis, :]).sum(axis=2) - #vertInds = cutEdges[verts[...,0], verts[...,1], verts[...,2], verts[...,3]] ## and these are the vertex indexes we want. vertInds = cutEdges[verts] #profiler() nv = vertInds.shape[0] diff --git a/pyqtgraph/graphicsItems/ImageItem.py b/pyqtgraph/graphicsItems/ImageItem.py index 7c80859d..6da8aedc 100644 --- a/pyqtgraph/graphicsItems/ImageItem.py +++ b/pyqtgraph/graphicsItems/ImageItem.py @@ -322,6 +322,8 @@ class ImageItem(GraphicsObject): mx = stepData.max() step = np.ceil((mx-mn) / 500.) bins = np.arange(mn, mx+1.01*step, step, dtype=np.int) + if len(bins) == 0: + bins = [mn, mx] else: bins = 500 diff --git a/pyqtgraph/opengl/GLViewWidget.py b/pyqtgraph/opengl/GLViewWidget.py index d74a13ce..0516bf08 100644 --- a/pyqtgraph/opengl/GLViewWidget.py +++ b/pyqtgraph/opengl/GLViewWidget.py @@ -180,7 +180,7 @@ class GLViewWidget(QtOpenGL.QGLWidget): i.paint() except: from .. import debug - pyqtgraph.debug.printExc() + debug.printExc() msg = "Error while drawing item %s." % str(item) ver = glGetString(GL_VERSION) if ver is not None: diff --git a/pyqtgraph/opengl/MeshData.py b/pyqtgraph/opengl/MeshData.py index 3046459d..e6888c16 100644 --- a/pyqtgraph/opengl/MeshData.py +++ b/pyqtgraph/opengl/MeshData.py @@ -266,7 +266,11 @@ class MeshData(object): vertFaces = self.vertexFaces() self._vertexNormals = np.empty(self._vertexes.shape, dtype=float) for vindex in xrange(self._vertexes.shape[0]): - norms = faceNorms[vertFaces[vindex]] ## get all face normals + faces = vertFaces[vindex] + if len(faces) == 0: + self._vertexNormals[vindex] = (0,0,0) + continue + norms = faceNorms[faces] ## get all face normals norm = norms.sum(axis=0) ## sum normals norm /= (norm**2).sum()**0.5 ## and re-normalize self._vertexNormals[vindex] = norm @@ -403,12 +407,10 @@ class MeshData(object): Return list mapping each vertex index to a list of face indexes that use the vertex. """ if self._vertexFaces is None: - self._vertexFaces = [None] * len(self.vertexes()) + self._vertexFaces = [[] for i in xrange(len(self.vertexes()))] for i in xrange(self._faces.shape[0]): face = self._faces[i] for ind in face: - if self._vertexFaces[ind] is None: - self._vertexFaces[ind] = [] ## need a unique/empty list to fill self._vertexFaces[ind].append(i) return self._vertexFaces