Skip to content

Commit

Permalink
Merge pull request #3530 from t20100/imageview-setimage-size0
Browse files Browse the repository at this point in the history
`silx.gui.plot.ImageView`: Added empty array support to `setImage`
  • Loading branch information
vallsv authored Sep 20, 2021
2 parents b485983 + 055a12c commit a382650
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/silx/gui/plot/ImageView.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,10 @@ def setImage(self, image, origin=(0, 0), scale=(1., 1.),
return

data = numpy.array(image, order='C', copy=copy)
assert data.size != 0
if data.size == 0:
self.remove(self._imageLegend, kind='image')
return

assert data.ndim == 2 or (data.ndim == 3 and data.shape[2] in (3, 4))

self.addImage(data,
Expand Down

0 comments on commit a382650

Please sign in to comment.