Fix contour annotations RTSS saving (#5545)

* [WIP] Fix contour annotations RTSS saving

* fix: Export image sop image reference provider

* Fixes for download with filename

* Updates to fix metadata issues with CS3D

* Updates to save menu

* Fixing some additional re-save metadata

* Add support for saving with predecessor image sequence

* PR comment fixes

* fix: Load RTSS after save

* fix segmentation save

* fix load of mixed seg/rt studies

* Use frame module to get information on the frame shown

* Fix study browser to use instances.length when numImageFrames not present

* fix: Load of display set split from multiple non-FOR referenes

* Fix RT and SEG applying to wrong series because of using
referenced series sequence without checkout sop instances

* Fix save seg

* Update to released CS3D versions

* test: Add revokeObjectURL to test download blob

* Add hard dependency on mode-basic to fix build order issues

* fix: build

* Try to fix build segmentation

* PR comments

* PR comment update
This commit is contained in:
Bill Wallace authored and GitHub committed 2025-11-21 13:07:26 -05:00
1 parent 9c5043ca2c
commit 57205703bb
68 files changed
+962 -648

No files matched your search

@@ -24,3 +24,45 @@ Using the class text size with the ui-button is inconsistent as to whether
it will apply or not. Instead, create a new size value to assign the desired size.
To support this, a new size enum is created, smallTall, which is used in the worklist
for an over-ride.
## `createReportDialogPrompt`
The create report dialog prompt (which is MOSTLY an internal component) has
change the API a bit. The input is now:
- `title` shown in the dialog
- `modality` being stored, used to query existing series
- `minSeriesNumber` is the start of new series of this modality type.
Will get set to 4000 if not determined by the modality
- predecessorImageId is the image id that this series was currently loaded
from. That allows defaulting the dialog to show the specified series instead
of always creating a new series.
The minSeries and predecessor are both optional, so the input doesn't have to be
updated.
The output has been enhanced with:
- `series`, is the series to store do, as referenced by a predecessorImageId value.
This allows exactly specifying which item to replace, which allows selecting it in the
menu by default instead of just guessing what value is being replaced.
- `priorSeriesNumber` is the previously lowest series number at least minSeriesNumber
of all the seris of the given modality type. This allows adding an instance to the
`next` series number by adding 1 to this value.
The priorSeriesNumber will default to 4000 for an unknown modality type, or
3000 for sr, 3100 for seg and 3200 for rtstruct.
## metadataProvider and formatted metadata
The metadata provider has been formatting some fields, which causes inconsistency
between different metadata providers and use of the instance object. The
specific fields that have changed are:
- `patientName`
- `studyDate`, `studyTime`
- `seriesDate`, `seriesTime`
If these fields need formatted versions, it is recommended to add a secondary/computed
metadata provider which simply gets the base metadata module and adds the
formatting. That way different metadata providers are all handled identically.
@@ -39,6 +39,31 @@ return {
}
```
## Replacing Instances in Series
Series such as segmentations and annotations often have the concept of replacing
an earlier instance with a newer one. The official way to do this is using the
`predecessor document sequence` to reference the old object in the new one.
It isn't that the old one is deleted (never delete data), but rather that the new
one is used in preference to the old one. This results in code that looks like:
```
utils.sortStudyInstances(instances);
// Choose the LAST instance in the list as the most recently created one.
const instance = instances[instances.length - 1];
...
const displaySet = {
...
predecessorImageId: instance.imageId,
numImageFrames: instances.length,
}
```
so that the last/latest SOP instance is used by default, and that it is
recorded what imageId was used to load that instance. This then allows saving
new instances in the same series by using a new predecessor sequence.
## Example SOP Class Handler Module
```js