Analysis parameters not cleared after deleting results
Summary
When analysis results are deleted via "Delete all results" or by deleting individual result items, the stored analysis parameters in object metadata are not cleared. This causes auto_recompute_analysis() to attempt recomputing deleted analyses when ROI changes, which may lead to unexpected behavior or confusion.
Steps to Reproduce
- Create an image and add it to DataLab
- Run an analysis (e.g., Centroid) which creates geometry results
- Delete all results using Edit > Delete all results (or delete the specific result)
- Add or modify a ROI on the image
Expected Behavior
After deleting analysis results, modifying the ROI should not trigger any auto-recompute of the deleted analysis.
Actual Behavior
After deleting analysis results, the __analysis_parameters metadata option remains in the object, causing:
auto_recompute_analysis() to be triggered when ROI changes
- The deleted analysis to be recomputed unexpectedly
Root Cause
The delete_results() method in panel/base.py and _delete_single_result() in actionhandler.py remove the analysis result data from metadata but do not clear the __analysis_parameters option that stores the function name and parameters for auto-recompute.
Solution
Added clear_analysis_parameters() function in datalab/gui/processor/base.py and called it:
- In
delete_results() when bulk-deleting all results from an object
- In
_delete_single_result() when the deleted result's function name matches the stored analysis parameters
Files Changed
datalab/gui/processor/base.py: Added clear_analysis_parameters() function
datalab/gui/panel/base.py: Updated delete_results() to clear analysis params
datalab/gui/actionhandler.py: Updated _delete_single_result() to conditionally clear analysis params
datalab/tests/features/common/result_deletion_unit_test.py: Added regression test
Testing
- New test
test_delete_results_clears_analysis_parameters() verifies the fix
- All existing tests pass (110+ common feature tests, ROI manipulation tests)
Analysis parameters not cleared after deleting results
Summary
When analysis results are deleted via "Delete all results" or by deleting individual result items, the stored analysis parameters in object metadata are not cleared. This causes
auto_recompute_analysis()to attempt recomputing deleted analyses when ROI changes, which may lead to unexpected behavior or confusion.Steps to Reproduce
Expected Behavior
After deleting analysis results, modifying the ROI should not trigger any auto-recompute of the deleted analysis.
Actual Behavior
After deleting analysis results, the
__analysis_parametersmetadata option remains in the object, causing:auto_recompute_analysis()to be triggered when ROI changesRoot Cause
The
delete_results()method inpanel/base.pyand_delete_single_result()inactionhandler.pyremove the analysis result data from metadata but do not clear the__analysis_parametersoption that stores the function name and parameters for auto-recompute.Solution
Added
clear_analysis_parameters()function indatalab/gui/processor/base.pyand called it:delete_results()when bulk-deleting all results from an object_delete_single_result()when the deleted result's function name matches the stored analysis parametersFiles Changed
datalab/gui/processor/base.py: Addedclear_analysis_parameters()functiondatalab/gui/panel/base.py: Updateddelete_results()to clear analysis paramsdatalab/gui/actionhandler.py: Updated_delete_single_result()to conditionally clear analysis paramsdatalab/tests/features/common/result_deletion_unit_test.py: Added regression testTesting
test_delete_results_clears_analysis_parameters()verifies the fix