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

@@ -28,7 +28,8 @@ function PanelStudyBrowser({
const { servicesManager, commandsManager, extensionManager } = useSystem();
const { displaySetService, customizationService } = servicesManager.services;
const navigate = useNavigate();
const studyMode = (customizationService.getCustomization('studyBrowser.studyMode') as string) || 'all';
const studyMode =
(customizationService.getCustomization('studyBrowser.studyMode') as string) || 'all';
const internalImageViewer = useImageViewer();
const StudyInstanceUIDs = internalImageViewer.StudyInstanceUIDs;
@@ -384,7 +385,11 @@ function PanelStudyBrowser({
const displaySetInstanceUID = jumpToDisplaySet;
// It is possible to navigate to a study not currently in view
const thumbnailLocation = _findTabAndStudyOfDisplaySet(displaySetInstanceUID, tabs, activeTabName);
const thumbnailLocation = _findTabAndStudyOfDisplaySet(
displaySetInstanceUID,
tabs,
activeTabName
);
if (!thumbnailLocation) {
return;
}
@@ -489,7 +494,7 @@ function _mapDisplaySets(displaySets, displaySetLoadingState, thumbnailImageSrcM
seriesNumber: ds.SeriesNumber,
modality: ds.Modality,
seriesDate: formatDate(ds.SeriesDate),
numInstances: ds.numImageFrames,
numInstances: ds.numImageFrames ?? ds.instances?.length,
loadingProgress,
countIcon: ds.countIcon,
messages: ds.messages,
@@ -538,11 +543,13 @@ function _findTabAndStudyOfDisplaySet(
tabs: TabsProps,
currentTabName: string
) {
const current = tabs.find(tab => tab.name===currentTabName) || tabs[0];
const current = tabs.find(tab => tab.name === currentTabName) || tabs[0];
const biasedTabs = [current, ...tabs];
for (let t = 0; t < biasedTabs.length; t++) {
const study = biasedTabs[t].studies.find(study => study.displaySets.find(ds => ds.displaySetInstanceUID ===displaySetInstanceUID));
const study = biasedTabs[t].studies.find(study =>
study.displaySets.find(ds => ds.displaySetInstanceUID === displaySetInstanceUID)
);
if (study) {
return {
tabName: biasedTabs[t].name,
@@ -1,12 +1,39 @@
import PROMPT_RESPONSES from '../utils/_shared/PROMPT_RESPONSES';
/**
* Creates and shows a report dialog prompt.
* The input for this is:
* - `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 response is:
* - `value`, the default name of the object/series being created
* - `dataSourceName`, where to store the object to
* - `series`, is the series to store do, as referenced by a predecessorImageId value.
* - `priorSeriesNumber` is the previously lowest series number at least minSeriesNumber
* of all the seris of the given modality type.
*
* This should be provided to the DICOM encoder, which will get the predecessor
* sequence from the metaData provider so that the saved series will replace
* the existing instance in the same series.
* This will be falsy for a new series.
*/
export default function CreateReportDialogPrompt({
title = 'Create Report',
modality = 'SR',
minSeriesNumber = 0,
predecessorImageId,
extensionManager,
servicesManager,
}): Promise<{
value: string;
dataSourceName: string;
priorSeriesNumber?: number;
series: string;
action: (typeof PROMPT_RESPONSES)[keyof typeof PROMPT_RESPONSES];
}> {
@@ -16,18 +43,33 @@ export default function CreateReportDialogPrompt({
const allowMultipleDataSources = window.config.allowMultiSelectExport;
return new Promise(function (resolve, reject) {
minSeriesNumber ||=
(modality === 'SR' && 3000) ||
(modality === 'SEG' && 3100) ||
(modality === 'RTSTRUCT' && 3200) ||
4000;
return new Promise(function (resolve) {
uiDialogService.show({
id: 'report-dialog',
title,
content: ReportDialog,
contentProps: {
dataSources: allowMultipleDataSources ? dataSources : undefined,
onSave: async ({ reportName, dataSource: selectedDataSource, series }) => {
predecessorImageId,
minSeriesNumber,
modality,
onSave: async ({
reportName,
dataSource: selectedDataSource,
series,
priorSeriesNumber,
}) => {
resolve({
value: reportName,
dataSourceName: selectedDataSource,
series,
priorSeriesNumber,
action: PROMPT_RESPONSES.CREATE_REPORT,
});
},