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

@@ -1355,7 +1355,7 @@ export default class HangingProtocolService extends PubSubService {
const { StudyInstanceUID: activeStudyUID } = this.activeStudy;
viewport.displaySets.forEach(displaySetOptions => {
const { id, matchedDisplaySetsIndex = 0 } = displaySetOptions;
const reuseDisplaySetUID =
const reuseDisplaySetUIDs =
id && displaySetSelectorMap[`${activeStudyUID}:${id}:${matchedDisplaySetsIndex || 0}`];
const viewportDisplaySetMain = this.displaySetMatchDetails.get(id);
@@ -1366,14 +1366,17 @@ export default class HangingProtocolService extends PubSubService {
);
// Use the display set provided instead
if (reuseDisplaySetUID) {
// This display set should have already been validated
const displaySetInfo: HangingProtocol.DisplaySetInfo = {
displaySetInstanceUID: reuseDisplaySetUID,
displaySetOptions,
};
if (reuseDisplaySetUIDs) {
reuseDisplaySetUIDs.forEach(reuseDisplaySetUID => {
// This display set should have already been validated
const displaySetInfo: HangingProtocol.DisplaySetInfo = {
displaySetInstanceUID: reuseDisplaySetUID,
displaySetOptions,
};
displaySetsInfo.push(displaySetInfo);
});
displaySetsInfo.push(displaySetInfo);
return;
}
@@ -1383,7 +1386,7 @@ export default class HangingProtocolService extends PubSubService {
const { displaySetInstanceUID } = viewportDisplaySet;
const displaySetInfo: HangingProtocol.DisplaySetInfo = {
displaySetInstanceUID,
displaySetInstanceUID: displaySetInstanceUID,
displaySetOptions,
};
@@ -1476,14 +1479,16 @@ export default class HangingProtocolService extends PubSubService {
const { displaySetService } = this._servicesManager.services;
const { displaySetSelectorMap } = options;
if (displaySetSelectorMap) {
Object.entries(displaySetSelectorMap).forEach(([key, displaySetInstanceUID]) => {
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
Object.entries(displaySetSelectorMap).forEach(([key, displaySetInstanceUIDs]) => {
displaySetInstanceUIDs.forEach(displaySetInstanceUID => {
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
if (!displaySet) {
throw new Error(
`The displaySetInstanceUID ${displaySetInstanceUID} is not found in the displaySetService`
);
}
if (!displaySet) {
throw new Error(
`The displaySetInstanceUID ${displaySetInstanceUID} is not found in the displaySetService`
);
}
});
});
}
}
+1 -1
View File
@@ -49,7 +49,7 @@ export type SetProtocolOptions = {
* This is normally transparent to the user of this, but in order to specify
* specific instances, they can be added like that.
*/
displaySetSelectorMap?: Record<string, string>;
displaySetSelectorMap?: Record<string, Array<string>>;
/** Used to define the display sets already in view, in order to allow
* filling empty viewports with other instances.