Skip to content

GUI design

The HemiSpec GUI is a compact customtkinter launcher over the same bilateral workflow exposed by the Python API and hemispec workflow CLI command. It is not a separate analysis implementation.

Design goals

  • expose only decisions required for routine ANS/RNS generation;
  • keep advanced model, threshold, suffix, and validation parameters in the CLI/API;
  • show the equivalent CLI command for reproducibility;
  • report runtime/model readiness before a long run;
  • keep logs, cancellation, and output-folder access visible.

User-visible workflow

The window has two areas: a configuration panel on the left and a run area on the right.

Configuration panel — three numbered sections, plus a summary line at the bottom that names the primary output:

  1. 01 Input GM maps — a directory or glob resolving to preprocessed *_GM_masked.nii.gz files, with a live count of matching files.
  2. 02 Output folder — the destination for voxel maps, tables, validation results, and optional intermediates.
  3. 03 Optional analysis — four switches: ROI table export (which reveals the atlas NIfTI and label-table paths), hemisphere-classifier validation, test–retest reliability (TRT), and intermediate-file retention.

Run area — three blocks:

  1. Environment — shallow checks for the DGN models (both directions), optional atlas files, the optional classifier bundle, and PyTorch. Details appear only for items that are partial or missing.
  2. Run — run/stop controls, the current stage with percent complete and elapsed time, and a flow diagram of the five workflow stages: L→R and R→L drawn as two branches that join at Merge, followed by ROI and Summary.
  3. Log / Equivalent CLI — two tabs: the streamed log, and the CLI command equivalent to the current settings, with copy, clear, and open-output actions.

Below a window width of 1060 px the two areas stack into a single scrolling column.

Hemisphere-classifier validation remains opt-in. Enabling it also enables ROI export because the classifier consumes ROI features.

Encapsulated defaults

The GUI intentionally hides:

  • DGN checkpoint paths and direction-specific bundle names;
  • device selection;
  • GM and inference thresholds;
  • reconstruction clipping and suffix rules;
  • classifier mode and model path;
  • TRT session regexes and mask parameters.

These values are defined in the GUI state-to-config adapter and remain available through the CLI/API for advanced or study-specific use.

Shared execution path

GUI state
  -> make_workflow_config(...)
  -> BilateralWorkflowConfig
  -> run_bilateral_workflow(...)
  -> voxel_maps/ + tables/ + optional validation/

The generated CLI preview is derived from the same workflow configuration. Contract tests under tests/test_gui_contract.py protect this alignment.

Runtime behavior

The GUI performs only shallow setup checks before execution; it does not load large checkpoints during status refresh. A background worker runs the workflow so the interface can stream logs and accept cancellation. Cancellation is cooperative and checked between major workflow stages.

Maintenance rules

  • Keep visible fields synchronized with WORKFLOW_VISIBLE_FIELDS.
  • Keep hidden defaults synchronized with CLI defaults and contract tests.
  • Do not add a GUI-only computation path.
  • Treat new advanced parameters as CLI/API options unless routine users must decide them.
  • Update the GUI user guide and screenshots whenever visible sections, blocks, or labels change.

ANS/RNS and the cross-hemispheric DGN framework originate from Wang et al. (2024); see Citation.