Skip to content

Archive SEG before replacing during autosave #5934

@mikeOctiocor

Description

@mikeOctiocor

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:

  1. Generate new SEG buffer (existing logic)
  2. Archive old instance via Orthanc modify (creates copy with [archived] in SeriesDescription)
  3. Delete original instance
  4. Upload new SEG buffer
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions