fix(segmentation): Changes to fix problems with non hydrated/loaded segmentations to be viewable when switching hanging protocols (e.g. MPR) (#5139)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2025-06-27 07:11:46 -04:00
1 parent 9a81f8cef5
commit c2624f116d
24 files changed
+199 -47

No files matched your search

@@ -835,16 +835,19 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
const displaySetModality = displaySet?.Modality;
// filter overlay display sets (e.g. segmentation) since they will get handled below via the segmentation service
const filteredVolumeInputArray = volumeInputArray.filter(volumeInput => {
const displaySet = displaySetService.getDisplaySetByUID(volumeInput.displaySetInstanceUID);
return !displaySet?.isOverlayDisplaySet;
});
const filteredVolumeInputArray = volumeInputArray
.map((volumeInput, index) => {
return { volumeInput, displaySetOptions: displaySetOptions[index] };
})
.filter(({ volumeInput }) => {
const displaySet = displaySetService.getDisplaySetByUID(volumeInput.displaySetInstanceUID);
return !displaySet?.isOverlayDisplaySet;
});
// Todo: use presentations states
const volumesProperties = filteredVolumeInputArray.map((volumeInput, index) => {
const volumesProperties = filteredVolumeInputArray.map(({ volumeInput, displaySetOptions }) => {
const { volumeId } = volumeInput;
const displaySetOption = displaySetOptions[index];
const { voi, voiInverted, colormap, displayPreset } = displaySetOption;
const { voi, voiInverted, colormap, displayPreset } = displaySetOptions;
const properties = {} as ViewportProperties;
if (voi && (voi.windowWidth || voi.windowCenter)) {
@@ -887,14 +890,10 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
if (backgroundDisplaySet.length !== 1) {
throw new Error('Background display set not found');
}
await viewport.setVolumes([
{ volumeId: `${VOLUME_LOADER_SCHEME}:${backgroundDisplaySet[0].displaySetInstanceUID}` },
]);
} else {
await viewport.setVolumes(filteredVolumeInputArray);
}
await viewport.setVolumes(volumeInputArray);
if (addOverlayFn) {
addOverlayFn();
}