fix(viewport-sync): remember synced viewports bw stack and volume and RENAME StackImageSync to ImageSliceSync (#3849)

This commit is contained in:
Alireza authored and GitHub committed 2024-01-22 09:44:35 -05:00
1 parent 2460d28afc
commit e4a116b074
15 files changed
+1110 -1031

No files matched your search

@@ -178,7 +178,7 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
}
public storePresentation({ viewportId }) {
const stateSyncService = this.servicesManager.services.stateSyncService;
const { stateSyncService, syncGroupService } = this.servicesManager.services;
let presentation;
try {
presentation = this.getPresentation(viewportId);
@@ -189,7 +189,14 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
if (!presentation || !presentation.presentationIds) {
return;
}
const { lutPresentationStore, positionPresentationStore } = stateSyncService.getState();
const synchronizers = syncGroupService.getSynchronizersForViewport(
viewportId,
this.renderingEngine.id
);
const { lutPresentationStore, positionPresentationStore, synchronizersStore } =
stateSyncService.getState();
const { presentationIds } = presentation;
const { lutPresentationId, positionPresentationId } = presentationIds || {};
const storeState = {};
@@ -205,6 +212,22 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
[positionPresentationId]: presentation,
};
}
if (synchronizers?.length) {
storeState.synchronizersStore = {
...synchronizersStore,
[viewportId]: synchronizers.map(synchronizer => {
const sourceViewports = synchronizer.getSourceViewports();
const targetViewports = synchronizer.getTargetViewports();
return {
id: synchronizer.id,
sourceViewports: [...sourceViewports],
targetViewports: [...targetViewports],
};
}),
};
}
stateSyncService.store(storeState);
}