ENH: Set viewer min-intensity to zero when possible.

Some image dtypes allow negative values, but these are typically not used. If an dtype allows negative values, but no negative values are present in the image, set the minimum value to 0 so that the image doesn't look washed out.
This commit is contained in:
Tony S Yu
2012-09-05 10:12:49 -04:00
parent db5647285f
commit d98a92a603
+2
View File
@@ -144,6 +144,8 @@ class ImageViewer(QMainWindow):
self._img = image
self._image_plot.set_array(image)
clim = dtype_range[image.dtype.type]
if clim[0] < 0 and image.min() >= 0:
clim = (0, clim[1])
self._image_plot.set_clim(clim)
self.redraw()