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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 4x 4x 8x 8x 4x 8x 4x 4x 4x 4x 4x | import type { SegmentationRepresentations } from '../../enums'; import type { Segmentation, SegmentationRepresentation } from '../../types'; import { getSegmentation } from './getSegmentation'; import { defaultSegmentationStateManager } from './SegmentationStateManager'; /** * Retrieves the segmentations for a given viewport and type. * @param viewportId - The ID of the viewport. * @param type - The type of the segmentation representation. * @returns An array of segmentations for the given viewport and type. */ export function getViewportSegmentations( viewportId: string, type?: SegmentationRepresentations ): Segmentation[] { const viewportRepresentations = getViewportSegmentationRepresentations(viewportId); const segmentations = viewportRepresentations.map((representation) => { Iif (type && representation.type === type) { return getSegmentation(representation.segmentationId); } return getSegmentation(representation.segmentationId); }); const filteredSegmentations = segmentations.filter( (segmentation) => segmentation !== undefined ); return filteredSegmentations; } export function getViewportSegmentationRepresentations( viewportId: string ): SegmentationRepresentation[] { const segmentationStateManager = defaultSegmentationStateManager; const state = segmentationStateManager.getState(); const viewportRepresentations = state.viewportSegRepresentations[viewportId]; return viewportRepresentations; } |