Skip to content

Extend edit controls to Bdv/Bvv - #334

Merged
tferr merged 3 commits into
mainfrom
edit-rewrite
Oct 12, 2026
Merged

tferr merged 3 commits into
mainfrom
edit-rewrite

Conversation

@tferr

@tferr tferr commented Oct 11, 2026

Copy link
Copy Markdown
Member

This is major refactoring: the node-editing logic of the ImagePlus tracing canvas now lives in a viewer-agnostic class, so the same actions of the ImagePlus contextual menu are available in Bdv & Bvv (context menu, single-key shortcuts, hover-based active node, undo, etc.).

New classes

  • PathNodeEditor: Operations on a single Path (delete, insert, move, lock, radius, tag, re-root, split, connect, undo). Returns a Result that front-ends route with Result#dispatch(). Shared helpers: deleteNodeOrPath(gui), tagNode(path, index, color), replaceTree(), structuralChange()
  • NodeEditCommand / ContextMenuCommand: Host labels, icons, default shortcuts and menu population, shared by the canvas and the viewers
  • BigViewerEditor / BigViewerMenu: Bdv/Bvv interaction layer (hover picking, key bindings, right-click menu) on top of PathNodeEditor

SNT / SNTUI changes:

  • SNT holds the PathNodeEditor (editing path, active node, undo history) shared by canvas, Bdv and Bvv; adds enterEditMode(Path), exitEditMode(), getEditModeBlocker(), notifyActiveNodeChanged() and notifyEditingPathChanged() (throttled)
  • enterEditMode(Path) selects the path first, as all edit operations require the editing path to be selected
  • editModeAllowed() no longer swaps the editing path while already editing; Stream mode restores its tracing state on exit
  • SNTUI fans Edit Mode notifications out to open viewers only (getOpenBigViewers() skips disposed ones) and tracks the most recently activated viewer

Fixes / Behavior changes:

  • Bvv AnnRenderer: screen data and layer ranges are published as one immutable Frame/Source pair, fixing the unsynchronized screenData race (NPE in tests)
  • Bvv#getClickedPosition(null) no longer returns a stale cached position
  • SNT#startSholl() converts calibrated coordinates to pixel indices
  • Sholl at nearest node in viewers: selected paths, else the rendered path nearest to the cursor (same lookup as Grab Nearest Path)
  • Bookmarks added from a viewer in classic mode use the viewer's current timepoint; BookmarkManager moves open viewers and image windows, and reports locations outside the (materialized crop of the) image
  • Radius prompt: tolerate a corrupted saved value, message says "non-negative" (0 is accepted)
  • Deleting a whole path from the canvas now leaves Edit Mode; refusing to delete a junction node opens a dialog
  • Right-clicks no longer trigger tracing clicks in the viewers; M adds a bookmark in classic mode (it was blocked)
  • Removed the "Continue Extending Path" toolbar toggle from Bvv/Bdv (the action remains in the context menu)
  • Misc fixes

tferr added 3 commits October 11, 2026 15:59
This is major refactoring: the node-editing logic of the ImagePlus tracing canvas now lives in a viewer-agnostic class,
so the same actions of the ImagePlus contextual menu are available in Bdv & Bvv (context menu, single-key shortcuts,
hover-based active node, undo, etc.).

New classes
- PathNodeEditor: Operations on a single Path (delete, insert, move,  lock, radius, tag, re-root, split, connect, undo).
  Returns a Result  that front-ends route with Result#dispatch(). Shared helpers: deleteNodeOrPath(gui),
  tagNode(path, index, color), replaceTree(), structuralChange()
- NodeEditCommand / ContextMenuCommand: Host labels, icons, default shortcuts and menu population, shared
  by the canvas and the viewers
- BigViewerEditor / BigViewerMenu: Bdv/Bvv interaction layer (hover picking, key bindings, right-click menu) on top
  of PathNodeEditor

SNT / SNTUI changes:
- SNT holds the PathNodeEditor (editing path, active node, undo history) shared by canvas, Bdv and Bvv; adds
  enterEditMode(Path), exitEditMode(), getEditModeBlocker(), notifyActiveNodeChanged() and
  notifyEditingPathChanged() (throttled)
- enterEditMode(Path) selects the path first, as all edit operations  require the editing path to be selected
- editModeAllowed() no longer swaps the editing path while already editing; Stream mode restores its
  tracing state on exit
- SNTUI fans Edit Mode notifications out to open viewers only  (getOpenBigViewers() skips disposed ones)
  and tracks the most recently activated viewer

Fixes / Behavior changes:
- Bvv AnnRenderer: screen data and layer ranges are published as one  immutable Frame/Source pair,
  fixing the unsynchronized screenData race (NPE in tests)
- Bvv#getClickedPosition(null) no longer returns a stale cached position
- SNT#startSholl() converts calibrated coordinates to pixel indices
- Sholl at nearest node in viewers: selected paths, else the rendered path nearest to the cursor
  (same lookup as Grab Nearest Path)
- Bookmarks added from a viewer in classic mode use the viewer's  current timepoint;
  BookmarkManager moves open viewers and image  windows, and reports locations outside the
  (materialized crop of the) image
- Radius prompt: tolerate a corrupted saved value, message says "non-negative" (0 is accepted)
- Deleting a whole path from the canvas now leaves Edit Mode;  refusing to delete a junction node opens a dialog
- Right-clicks no longer trigger tracing clicks in the viewers; M adds a bookmark in classic mode (it was blocked)
- Removed the "Continue Extending Path" toolbar toggle from Bvv/Bdv
  (the action remains in the context menu)
- Misc fixes
…/Bvv

... while at it:
- improve min-max detection
- Fix NPE
- Improve nearest point detection
- Fix selection in Bdv
@tferr
tferr merged commit 57a870d into main Oct 12, 2026
1 of 2 checks passed
@tferr
tferr deleted the edit-rewrite branch October 12, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant