I have an image that contains NaNs (indicates invalid pixels). Imageitem appears to handle the NaN but histogramLUTitem does not.
My view is as follows.
self.img1 = pg.ImageItem(border='w')
self.lut1 = pg.HistogramLUTItem(self.img1)
self.view1.addItem(self.img1)
histogram fails at
File "C:\Anaconda2\Lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py", line 262, in setImage
self.sigImageChanged.emit()
File "C:\Anaconda2\Lib\site-packages\pyqtgraph\graphicsItems\HistogramLUTItem.py", line 189, in imageChanged
h = self.imageItem().getHistogram()
File "C:\Anaconda2\Lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py", line 368, in getHistogram
hist = np.histogram(stepData, **kwds)
File "C:\Anaconda2\Lib\site-packages\numpy\lib\function_base.py", line 507, in histogram
'range parameter must be finite.')
besides fixing numpy histogram in function_base.py to handle NaNs it might make sense to change ImageItem.py line 368 from
hist = np.histogram(stepData, **kwds)
to
ind = np.isfinite(stepData)
hist = np.histogram(stepData[ind], **kwds)