Save State
Current State
Save Plan exports a Surgical Plan JSON file (schemaVersion / algorithmVersion = 1).
It does not embed voxel data or the DICOM series. On load, the matching scan is restored from an immutable baseline snapshot, then saved operations are replayed in order using the same applicators as live Plan edits.
What Is Saved
| Area | Saved |
|---|---|
| Cut types | Spherical (Regular), plane-guided spherical, and Contour/path cuts |
| Crop | Committed permanent single-plane crop only (origin, normal, removeSide) |
| Cut History | id, label, notes, cutSource, geometry params; plane-guided viewContext when present |
| Surgical Pathway | Included cut IDs, order mode, custom order, per-cut colors/notes, volume appearance |
| Source binding | Study/Series/FoR UIDs (when available), modality, volume geometry |
| Ordering | Yes — operations[] chronological order is preserved and is the replay order; Cut History and pathway order are also preserved |
Cut Types
Spherical / Regular
Saved as:
sphereCut
with:
cutSource: "sphere"
Plane-Guided
Saved as:
sphereCut
with:
cutSource: "planeGuided"
An optional Cut History viewContext is also saved when present.
Contour / Path
Saved as:
contourCut
The saved information includes:
- Control points
widthMmdepthMmoverlapMm
Dense spline samples are not stored.
Crop
Only accepted permanent single-plane crops are written as permanentCrop operations.
The saved crop information includes:
originnormalremoveSide
The following are not saved:
- Interactive crop preview
- Uncommitted clip planes
- Other crop/scoop tools
How Load / Replay Works
- Open the matching DICOM series using UID and geometry checks.
- Parse and validate the Plan JSON.
- Snapshot the current state for rollback.
- Restore the immutable source scalars.
- Replay
operationsin saved order:sphereCut→ sphere maskpermanentCrop→ destructive single-plane cropcontourCut→ continuous cut along curve
- Commit operations, Cut History, and Surgical Pathway state.
- All restored cuts are set to
visible: true. - Clear undo/redo history.
- Mark the Plan as saved.
- If replay fails, roll back the changes and report which operation failed.
Excluded From Plan
The following state is currently not persisted:
- Uncommitted / preview crop UI
- Box crop
- Scoop
- Flashlight
- Diamond
- Other non-Stage-1 Plan tools
- Measurements
- Markers
- Pen/paint annotations
- Camera state
- Iso state
- Window/level state
- Tool/panel UI state
- Undo/redo stacks
- Raw scalar buffers
- Scan/DICOM files
- Cut visibility flags
The exception for UI-related state is planar cut viewContext metadata.
All hidden cuts must be shown before saving because cut visibility is not stored.
Known Replay Limitations
- The correct series and a valid baseline snapshot are required.
- Incorrect geometry or UIDs are rejected.
- Replay stops on the first failed operation, including a zero-voxel-change operation.
- A failed replay does not partially commit operations.
- Contour cuts are reconstructed from control points using the current algorithm rather than stored dense samples.
- Contour reconstruction behavior is locked by
algorithmVersion. - Already-saved Plans cannot be re-downloaded until the content changes because of dirty tracking.
- The filename is derived from the scan display name or retained from the last loaded/saved file.
- There is currently no in-app UI for renaming the Plan file.
Next Steps
Potential future refinements:
- Add an option to download the scan itself.
- Allow users to rename Plan save files.
- Save measurements and annotations as part of the Plan.
- Decide whether measurements, annotations, or other state created in View should also persist.