-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
"Remove all results" fails with AttributeError when ROI was removed
Description
When trying to remove all analysis results via Analysis > Remove results > Remove all results, the operation fails with an AttributeError if the results contain ROI information but the ROI was subsequently removed from the object.
Steps to Reproduce
- Create or open an image/signal in DataLab
- Add a Region of Interest (ROI) to the object
- Run an analysis that uses the ROI (e.g., Centroid for images)
- Remove the ROI from the object
- Select the object and try to delete all results via Analysis > Remove results > Remove all results
Expected Behavior
The results should be deleted successfully, regardless of whether the ROI still exists on the object.
Actual Behavior
An AttributeError is raised because the code attempts to access obj.roi.get_single_roi_title() when obj.roi is None.
Error Traceback
Traceback (most recent call last):
File "C:\Dev\Projets\DataLab\datalab\gui\panel\base.py", line 3258, in delete_results
rdatadict = create_resultdata_dict(objs)
File "C:\Dev\Projets\DataLab\datalab\adapters_metadata\common.py", line 141, in create_resultdata_dict
rdata.append(adapter, obj)
File "C:\Dev\Projets\DataLab\datalab\adapters_metadata\common.py", line 92, in append
roititle = obj.roi.get_single_roi_title(i_roi)
AttributeError: 'NoneType' object has no attribute 'get_single_roi_title'
Root Cause
In datalab/adapters_metadata/common.py, the ResultData.append() method checks if i_roi >= 0 before accessing obj.roi.get_single_roi_title(i_roi), but it doesn't check if obj.roi is None. This can happen when:
- Results were computed with a ROI
- The ROI was later removed from the object
- The user attempts to delete all results
Fix
Add a None check for obj.roi before attempting to call get_single_roi_title():
if i_roi >= 0 and obj.roi is not None:
roititle = obj.roi.get_single_roi_title(i_roi)
ylabel += f"|{roititle}"Affected Versions
- DataLab 1.0.x (and earlier versions)
Labels
- bug
- results
- ROI
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working