Skip to content

Allow accepting a different refinement iteration per component#46

Merged
hemanthkapa merged 7 commits into
mainfrom
feat/refinement-per-component-accept
Jul 6, 2026
Merged

Allow accepting a different refinement iteration per component#46
hemanthkapa merged 7 commits into
mainfrom
feat/refinement-per-component-accept

Conversation

@hemanthkapa

Copy link
Copy Markdown
Member

IMM and OMM converge differently, so a single global "iteration to accept" forced the same choice on both. Replace the single spinbox with one step spinbox per component, discovered from the *_refined_iter{N} surfaces on disk, and dispatch one accept_refinement --component X <step> call per component. accept_refinement's cleanup is scoped to each basename, so accepting one component never deletes another's iterations.

hemanthkapa and others added 7 commits July 2, 2026 13:04
IMM and OMM converge differently, so a single global "iteration to
accept" forced the same choice on both. Replace the single spinbox with
one step spinbox per component, discovered from the *_refined_iter{N}
surfaces on disk, and dispatch one `accept_refinement --component X <step>`
call per component. accept_refinement's cleanup is scoped to each
basename, so accepting one component never deletes another's iterations.

- Per-component rows rebuilt on config load, after a run, and via a new
  Refresh button; default to the final (converged) iteration, range spans
  available iterations, prior selections preserved across refreshes.
- Accept validates each choice exists, confirms all choices, and reports
  per-component failures; disabled when no refined surfaces exist.
- Tests for discovery/ranges/defaults, selection preservation, empty-state
  disable, and one --component CLI call per component.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a "Preview Iterations" button to the refinement tab's Accept
section that loads each *_refined_iter{N}.surface.vtp (plus iter0, the
original) as napari surface layers. The existing per-component accept
spinbox doubles as the scrubber: changing it toggles which iteration's
layer is visible, so the shown mesh is exactly what Accept promotes.

- main.py builds MeshViewer before RefinementWidget and passes it in;
  mesh_viewer=None (headless/tests) hides the preview buttons.
- Reuses mesh_viewer._load_mesh_file for VTK loading + 3D switch.
- _refresh_accept_components clears stale preview layers first, since
  accept deletes all but the chosen iteration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Refined *.surface.vtp files carry a noisy per-vertex scalar array; the
Mesh Viewer auto-colored previews by it (speckled viridis), which is
useless for judging shape. Add a flat=True mode to _load_mesh_file that
skips scalar auto-coloring (marks the layer initialized, omits
source_vtp_path) and shows a matte gray surface — ambient occlusion still
gives depth. Preview layers now load flat.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Different tomograms can now pick different iterations; accept calls pass --tomogram and --component, and the UI lists one spinbox per surface basename.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid parsing every iteration for every surface up front; cache meshes for scrubbing and use single-surface mode when surface count exceeds the threshold.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resume now syncs experiment UI from config and discovery uses the config
work_dir so Accept Iteration surfaces appear when refinement files exist.

Co-authored-by: Cursor <cursoragent@cursor.com>
Scan config work_dir (including relative results/), exp_dir, and results/;
handle work_dir field pointing at the experiment folder; log scanned paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hemanthkapa

Copy link
Copy Markdown
Member Author

Summary

Mesh Refinement tab: accept and preview iterations per tomogram×surface (not one pick per component globally). Lazy napari preview for large datasets. Fixes surface discovery after experiment resume.

Changes

-One accept spinbox per surface (TE1_IMM, TE2_OMM, …); scoped accept_refinement calls
-Lazy preview: load current iteration only; scrub via layer data + cache; dropdown when >8 surfaces
-Resume: honor config work_dir, scan exp_dir / results/, sync UI on load
-Scrollable accept list

@hemanthkapa
hemanthkapa merged commit 2b48a83 into main Jul 6, 2026
3 checks passed
@hemanthkapa
hemanthkapa deleted the feat/refinement-per-component-accept branch July 6, 2026 20:57
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