silx-kit / silx

silx toolkit
http://www.silx.org/doc/silx/latest/
MIT License
134 stars 73 forks source link

[mask] Problem to set mask with different sizes #2286

Open vallsv opened 5 years ago

vallsv commented 5 years ago

The problem is yet i dont have an image, but i want to custom the mask.

But maybe it's the same problem if we changes the image size.

ERROR:pyFAI-calib2.UNCAUGHT:operands could not be broadcast together with shapes (1065,1030) (0,0) 
Traceback (most recent call last):
  File "/workspace/valls/pyfai.git/build/lib.linux-x86_64-3.5/pyFAI/gui/calibration/MaskTask.py", line 264, in __widgetShow
    self.__updateWidgetFromModel()
  File "/workspace/valls/pyfai.git/build/lib.linux-x86_64-3.5/pyFAI/gui/calibration/MaskTask.py", line 285, in __updateWidgetFromModel
    self.__maskPanel.setSelectionMask(mask)
  File "/home/valls/.local/lib/python3.5/site-packages/silx/gui/plot/MaskToolsWidget.py", line 316, in setSelectionMask
    self._mask.commit()
  File "/home/valls/.local/lib/python3.5/site-packages/silx/gui/plot/_BaseMaskToolsWidget.py", line 144, in commit
    not numpy.all(numpy.equal(self._mask, self._history[-1]))):
ValueError: operands could not be broadcast together with shapes (1065,1030) (0,0) 
t20100 commented 5 years ago

As far as I remember, as it is, it does not support setting a mask while there is no image.... but it should not raise an exception (or at least a more explicit one). When there is a change of image size, the mask is clipped or expanded.