UNPKG

@cornerstonejs/core

Version:
23 lines (22 loc) 756 B
import { cloneVolume3DCamera } from './volume3DProjectionCamera.js'; function isWrappedVolume3DPresentation(presentation) { return Object.prototype.hasOwnProperty.call(presentation, 'camera'); } function getCameraPatch(presentation) { if (isWrappedVolume3DPresentation(presentation)) { return presentation.camera ?? {}; } return presentation; } export function getVolume3DProjectionPresentation(snapshot) { return { ...snapshot.presentation, camera: cloneVolume3DCamera(snapshot.presentation.camera), }; } export function withVolume3DProjectionPresentation(snapshot, presentation) { return cloneVolume3DCamera({ ...snapshot.presentation.camera, ...getCameraPatch(presentation), }); }