From dad5d8f733f09942c703daf9a6e102803e3dbfc6 Mon Sep 17 00:00:00 2001 From: Pietro Zambelli Date: Tue, 4 Mar 2014 16:56:56 +0000 Subject: [PATCH] Detect range of the image using bottleneck if available --- pyqtgraph/imageview/ImageView.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/imageview/ImageView.py b/pyqtgraph/imageview/ImageView.py index bf415bb3..c7c3206e 100644 --- a/pyqtgraph/imageview/ImageView.py +++ b/pyqtgraph/imageview/ImageView.py @@ -33,6 +33,11 @@ from .. import debug as debug from ..SignalProxy import SignalProxy +try: + from bottleneck import nanmin, nanmax +except ImportError: + from numpy import nanmin, nanmax + #try: #from .. import metaarray as metaarray #HAVE_METAARRAY = True @@ -526,7 +531,7 @@ class ImageView(QtGui.QWidget): sl = [slice(None)] * data.ndim sl[ax] = slice(None, None, 2) data = data[sl] - return data.min(), data.max() + return nanmin(data), nanmax(data) def normalize(self, image): """