Skip to content

feat(cleanup): add a Clean up submenu and find cross-name duplicates - #130

Merged
dustenhubbard merged 4 commits into
mainfrom
feat/data-cleanup-menu
Oct 7, 2026
Merged

dustenhubbard merged 4 commits into
mainfrom
feat/data-cleanup-menu

Conversation

@dustenhubbard

@dustenhubbard dustenhubbard commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Adds a Clean up submenu under Series. Duplicates... finds traces that overlap, whatever their names, one row per structure with a drop-down of its names. Combining keeps the picked name, carries the other tags over, and removes the rest in one undo step. Remove pixel-dust traces... lists tiny closed traces. Remove empty traces... removes degenerate traces. Each list opens with one line and a ? for the full text.

Closes #67
Closes #109

Series > Clean up groups the series-wide data-maintenance operations and adds
two scans plus a crash guard.

- Remove pixel-dust traces: small closed traces at or below a user-chosen area
  threshold (um^2, measured the way the object and trace tables measure it),
  presented in a review list so the user inspects and deselects before anything
  is deleted.
- Remove empty traces: degenerate geometry only (no points, zero-area closed,
  zero-length open), removed after a count-stating confirmation.
- Find duplicates named differently: one shape traced twice under two object
  names, which the existing same-name pass cannot see because it draws both
  traces out of a single section.contours[cname]. Reports only; which of the
  two names is right is a question about the data, not about geometry.
- getOverlapRatio answers 0 for a collapsed combined bounding box instead of
  dividing by zero. Two collinear traces used to raise ZeroDivisionError out of
  overlaps() and end the whole duplicate pass on the first such pair.

Trace.pointsMatch and Trace.ratioIsOverlap are the two halves of overlaps(),
extracted so the new scan can report the ratio it measured and still reach the
same verdict, and so the point-match tolerance has a name. The bounding-box
tests in the scan are slack by that tolerance: two traces can match point for
point while their boxes do not touch, and a strict test drops exactly the pairs
the comparison would have called duplicates.

MalformedContoursDialog gains a column spec, an overridable default sort column
and a subclass button hook, so both review lists reuse its selection,
navigation, deletion and export behavior.

Locked objects are skipped by every scan unless asked for. Removal goes through
deleteMalformedTraces, which re-finds each trace by a color plus rounded-points
signature, so one confirmation removes exactly the reviewed traces and one undo
puts them back.

Closes #67
Closes #109

@quasiTriestino quasiTriestino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how the clean up menu is shaping up. It looks good. For simplicity, let's go ahead and collapse "find duplicates named differently" and "remove duplicates" into a single item under the clean-up called "duplicates" that identifies all duplicates (named the same or otherwise) and allows the user to select which to combine into a single trace. Probably there should be a drop-down menu with all the names of the duplicates that they can chose from.

Also, there is a lot of explainer text at the top of the pop-up window. For text like that, reduce to a very simple explanation and put a question mark hover menu next to it with the full explainer.

Series > Clean up > Duplicates... replaces the two duplicate items. One scan lists each structure traced more than once, under one name or several, with a drop-down of its names; combining keeps one trace under the picked name, adds the tags of the others, and deletes the rest as one undo step.
Each clean-up list now opens with one line, and the full explanation sits in a ? tooltip beside it.
The tests this branch added are removed.
@dustenhubbard

Copy link
Copy Markdown
Member Author

Both changes are in. Duplicates... is now the one item under Clean up. It finds traces that overlap under the same name or under different names, lists one row per structure, and each row has a drop-down of its names. Combine keeps the picked name, moves the other tags onto that trace, and removes the rest in one undo step. Each list now opens with one line and a ? that shows the full explanation on hover. The branch is also brought up to date with main.

@dustenhubbard dustenhubbard added the reviewed A human authorized this merge (vcs-guard Gate 1 evidence) label Oct 7, 2026
@dustenhubbard
dustenhubbard merged commit 9fa9b61 into main Oct 7, 2026
7 checks passed
@dustenhubbard
dustenhubbard deleted the feat/data-cleanup-menu branch October 7, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed A human authorized this merge (vcs-guard Gate 1 evidence)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Identify and remove duplicates that are named differently Clean up menu

2 participants