OHIF with Cornerstone3D 2.0 (#4347)
This commit is contained in:
1 parent
8981a61b8c
commit
7ce7127d7c
803 files changed
+32760
-15893
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { StateSyncService } from '@ohif/core';
|
||||
import { useViewportsByPositionStore } from './stores/useViewportsByPositionStore';
|
||||
|
||||
/**
|
||||
* This find or create viewport is paired with the reduce results from
|
||||
@@ -69,16 +69,12 @@ export const findOrCreateViewport = (
|
||||
* @returns Set of states that can be applied to the state sync to remember
|
||||
* the current view state.
|
||||
*/
|
||||
const findViewportsByPosition = (
|
||||
state,
|
||||
{ numRows, numCols },
|
||||
syncService: StateSyncService
|
||||
): Record<string, Record<string, unknown>> => {
|
||||
const findViewportsByPosition = (state, { numRows, numCols }) => {
|
||||
const { viewports } = state;
|
||||
const syncState = syncService.getState();
|
||||
const viewportsByPosition = { ...syncState.viewportsByPosition };
|
||||
const { setViewportsByPosition, addInitialInDisplay } = useViewportsByPositionStore.getState();
|
||||
const initialInDisplay = [];
|
||||
|
||||
const viewportsByPosition = {};
|
||||
viewports.forEach(viewport => {
|
||||
if (viewport.positionId) {
|
||||
const storedViewport = {
|
||||
@@ -86,6 +82,7 @@ const findViewportsByPosition = (
|
||||
viewportOptions: { ...viewport.viewportOptions },
|
||||
};
|
||||
viewportsByPosition[viewport.positionId] = storedViewport;
|
||||
setViewportsByPosition(viewport.positionId, storedViewport);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,10 +96,7 @@ const findViewportsByPosition = (
|
||||
}
|
||||
}
|
||||
|
||||
// Store the initially displayed elements
|
||||
viewportsByPosition.initialInDisplay = initialInDisplay;
|
||||
|
||||
return { viewportsByPosition };
|
||||
initialInDisplay.forEach(displaySetInstanceUID => addInitialInDisplay(displaySetInstanceUID));
|
||||
};
|
||||
|
||||
export default findViewportsByPosition;
|
||||
Reference in new issue
Block a user