Skip to content

FlexReg panel: joysticks from the schema, patch outline previewed locally - #5

Open
Jules-GP wants to merge 8 commits into
mainfrom
feat/flexreg
Open

FlexReg panel: joysticks from the schema, patch outline previewed locally#5
Jules-GP wants to merge 8 commits into
mainfrom
feat/flexreg

Conversation

@Jules-GP

Copy link
Copy Markdown
Collaborator

The client half of FlexReg. The patch and the registration move to the server
(sadt-tools#23); what stays here is the preview.

3307 lines removed, 408 added. The old module drove FlexReg_CLI from inside
Slicer and shipped 191 lines of install_pytorch.py to get torch onto a
clinician's laptop - its patch propagation calls .cuda() with no availability
test and no device argument. That is what the server is for.

The preview stays local, and had to

Dragging a pad recomputes the patch outline here, in about 18 ms on a
294,260-point arch. A round trip per gesture is not a preview. It needs nothing
but vtk, numpy and matplotlib, all of which ship with Slicer - no torch anywhere
on this path, verified by loading the module and finding torch absent from
sys.modules.

The server is asked once, on Apply, for the real patch: geodesic propagation on
the mesh rather than a polygon fill, and what the registration runs on. The two
differ, which is the honest reason this is called a preview - 48,796 points in
the local outline against 54,030 in the server's patch, on the same arch.

The five pads come from the schema

run() declares each corner as tuple[float, float] and layout.py gives the
axes their ranges and end labels, so formgen builds the joysticks with no
code in this module
. It only wires them to the preview. That needed the vec2
type, which is sadt-tools#24 and slicer-remote-tool-server#17.

Each corner is one POSITION, not two settings: the knob sits where the point sits
on the arch, 0 at mid-arch and 1 on the tooth. Two number fields state two
numbers and cannot state that.

Two defects fixed on the way

  • The preview was stricter than the run it previewed. It required an array
    named Universal_ID, while the server's engine takes whatever labels the mesh
    carries - so a mesh straight out of Crown_Seg (PredictedID) was refused by
    the panel and accepted by the server. The name travels now.
  • A missing library took the whole panel down. FlexReg.py imported the
    preview at module scope; without numpy the module would not import at all,
    rather than losing the one thing that can be done without. Imported lazily.

Verified

Six tests: the five pads built from the real schema with the right ranges, a
pair reading back in (ratio, adjust) order, and the corner names matching the
ones the preview keys its centroids by - a rename on either side would build a
patch from the wrong four teeth. test_client and test_formgen still pass.

Copilot AI lite review requested due to automatic review settings August 20, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants