Skip to content

Analysis parameters not cleared after deleting results #285

@PierreRaybaut

Description

@PierreRaybaut

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

  1. Create an image and add it to DataLab
  2. Run an analysis (e.g., Centroid) which creates geometry results
  3. Delete all results using Edit > Delete all results (or delete the specific result)
  4. 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:

  1. In delete_results() when bulk-deleting all results from an object
  2. 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)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions