Brush stroke falling completely outside constraint-allowed area causes a crash
- Run in debug mode.
- Open a segmented photo.
- Select "Brush" tool.
- Choose the "Abdomen" label from the tree.
- Click "Set constraint" next to Abdomen.
- Try to draw a brush stroke that is completely inside the darkened part of the photo (e.g., outside the specimen or completely inside thorax). When the mouse button is released, the program crashes:
Traceback (most recent call last):
File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\layers\mouse_event_layer.py", line 67, in mouseReleaseEvent
layer.mouse_release(event)
File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\layers\label_layer.py", line 385, in mouse_release
cmd, bbox = self.current_tool.left_release(None, event.pos().toPoint(),
File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\tools\brush.py", line 146, in left_release
return self.get_command(ctx.label_img), QRect() #CommandEntry(lab_changes, update_canvas=False), QRect()
File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\tools\brush.py", line 162, in get_command
top, left, bottom, right = np.min(yy), np.min(xx), np.max(yy), np.max(xx)
File "<__array_function__ internals>", line 5, in amin
File "C:\Users\Karel\miniconda3\envs\arth2\lib\site-packages\numpy\core\fromnumeric.py", line 2830, in amin
return _wrapreduction(a, np.minimum, 'min', axis, None, out,
File "C:\Users\Karel\miniconda3\envs\arth2\lib\site-packages\numpy\core\fromnumeric.py", line 87, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation minimum which has no identity
Process finished with exit code 1
(This happens even if the selected label is "nothing" and the brush stroke would involve only pixels that are already "nothing". Seems to happen only with the Brush tool.)