Problem
The current SEG autosave uses a delete-before-replace pattern: it deletes the old DICOM SEG instance from Orthanc, then uploads the new edited version. Because Orthanc has OverwriteInstances=false, this is the only way to store a new version with the same SOP UID.
However, if the upload fails (network error, browser crash, tab close), the old SEG is permanently lost with no recovery path. This has already caused data loss in production (missing Calcium SEG).
Solution
Before deleting the old SEG, create an archived copy using Orthanc's /instances/{id}/modify endpoint. The archived copy has [archived] appended to its SeriesDescription so the viewer ignores it.
New save flow:
- Generate new SEG buffer (existing logic)
- Archive old instance via Orthanc modify (creates copy with
[archived] in SeriesDescription)
- Delete original instance
- Upload new SEG buffer
- Refresh cached Orthanc ID
Safety property:
At no point is data irrecoverably lost — the archived copy exists before the original is deleted.
Files to change
extensions/octiocor/src/getCommandsModule.ts — add archive step in saveSegmentationEdit
extensions/octiocor/src/panels/SegmentationListPanel.tsx — filter out [archived] SEGs
Problem
The current SEG autosave uses a delete-before-replace pattern: it deletes the old DICOM SEG instance from Orthanc, then uploads the new edited version. Because Orthanc has
OverwriteInstances=false, this is the only way to store a new version with the same SOP UID.However, if the upload fails (network error, browser crash, tab close), the old SEG is permanently lost with no recovery path. This has already caused data loss in production (missing Calcium SEG).
Solution
Before deleting the old SEG, create an archived copy using Orthanc's
/instances/{id}/modifyendpoint. The archived copy has[archived]appended to its SeriesDescription so the viewer ignores it.New save flow:
[archived]in SeriesDescription)Safety property:
At no point is data irrecoverably lost — the archived copy exists before the original is deleted.
Files to change
extensions/octiocor/src/getCommandsModule.ts— add archive step insaveSegmentationEditextensions/octiocor/src/panels/SegmentationListPanel.tsx— filter out[archived]SEGs