There was a bug in the code in the ROIs_on method in which the state of the checkbox was always evaulated to False. Specifically, state is returned as an integer (0 for unchecked, 2 for checked). However, the if statement compared state to QtCore.Qt.Checked, which is an enum. Therefore, pressing spacebar or clicking the ROIs_on checkbox always tried to remove the self.color items, generating a warning and preventing the user from toggling ROIs on and off.
I fixed this by processing state through a Qt method that converts it to an enum, allowing successful comparison between the "checked" state with the following line:
if QtCore.Qt.CheckState(state) == QtCore.Qt.Checked:
# rest of function
EDIT: I realized that the same issue shows up in the roi_text and zoom_cell method, so fixed it there too.
Fixes #1028
Minor request:
The conda create statement for developers unnecessarily included the "env" argument and didn't specify the python version. When the most recent python version is downloaded (3.11), then an update to dataclasses prevents the ROI class in detection/stats.py from working properly because a np.ndarray field is not hashable (see their update).
The fix to this issue was identified in this issue (from a different repository - huggingface/datasets#5230).
Main Request:
There was a bug in the code in the
ROIs_on
method in which the state of the checkbox was always evaulated to False. Specifically,state
is returned as an integer (0 for unchecked, 2 for checked). However, the if statement comparedstate
toQtCore.Qt.Checked
, which is an enum. Therefore, pressing spacebar or clicking the ROIs_on checkbox always tried to remove theself.color
items, generating a warning and preventing the user from toggling ROIs on and off.I fixed this by processing
state
through a Qt method that converts it to an enum, allowing successful comparison between the "checked" state with the following line:EDIT: I realized that the same issue shows up in the
roi_text
andzoom_cell
method, so fixed it there too.Fixes #1028
Minor request:
The conda create statement for developers unnecessarily included the "env" argument and didn't specify the python version. When the most recent python version is downloaded (3.11), then an update to dataclasses prevents the ROI class in detection/stats.py from working properly because a np.ndarray field is not hashable (see their update).
The fix to this issue was identified in this issue (from a different repository - huggingface/datasets#5230).