fix(viewport-sync): remember synced viewports bw stack and volume and RENAME StackImageSync to ImageSliceSync (#3849)
This commit is contained in:
1 parent
2460d28afc
commit
e4a116b074
15 files changed
+1110
-1031
No files matched your search
@@ -45,7 +45,7 @@ export default class SyncGroupService {
|
||||
[POSITION]: synchronizers.createCameraPositionSynchronizer,
|
||||
[VOI]: synchronizers.createVOISynchronizer,
|
||||
[ZOOMPAN]: synchronizers.createZoomPanSynchronizer,
|
||||
[STACKIMAGE]: synchronizers.createStackImageSynchronizer,
|
||||
[STACKIMAGE]: synchronizers.createImageSliceSynchronizer,
|
||||
};
|
||||
|
||||
constructor(serviceManager: ServicesManager) {
|
||||
@@ -74,6 +74,10 @@ export default class SyncGroupService {
|
||||
this.synchronizerCreators[type.toLowerCase()] = creator;
|
||||
}
|
||||
|
||||
public getSynchronizer(id: string): Synchronizer | void {
|
||||
return SynchronizerManager.getSynchronizer(id);
|
||||
}
|
||||
|
||||
protected _getOrCreateSynchronizer(
|
||||
type: string,
|
||||
id: string,
|
||||
@@ -121,6 +125,17 @@ export default class SyncGroupService {
|
||||
SynchronizerManager.destroy();
|
||||
}
|
||||
|
||||
public getSynchronizersForViewport(
|
||||
viewportId: string,
|
||||
renderingEngineId: string
|
||||
): Synchronizer[] {
|
||||
return SynchronizerManager.getAllSynchronizers().filter(
|
||||
s =>
|
||||
s.hasSourceViewport(renderingEngineId, viewportId) ||
|
||||
s.hasTargetViewport(renderingEngineId, viewportId)
|
||||
);
|
||||
}
|
||||
|
||||
public removeViewportFromSyncGroup(
|
||||
viewportId: string,
|
||||
renderingEngineId: string,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user