Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import type { IViewport, IStackViewport, IVolumeViewport } from '../types'; import cache from '../cache'; function getViewportModality(viewport: IViewport, volumeId?: string): string { if ((viewport as IStackViewport).modality) { return (viewport as IStackViewport).modality; } if ((viewport as IVolumeViewport).setVolumes) { volumeId = volumeId ?? viewport.getDefaultActor()?.uid; if (!volumeId) { return; } return cache.getVolume(volumeId)?.metadata.Modality; } throw new Error('Invalid viewport type'); } export { getViewportModality as default, getViewportModality }; |