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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 17594x 17594x 5228x 5228x 5228x 5228x | import type { SegmentationRepresentations } from '../../enums'; import type { SegmentationRepresentation } from '../../types/SegmentationStateTypes'; import { defaultSegmentationStateManager } from './SegmentationStateManager'; /** * Retrieves segmentation representations for a specific segmentation in a given viewport. * * @param viewportId - The ID of the viewport. * @param segmentationId - The ID of the segmentation. * @returns An array of SegmentationRepresentation objects or an empty array if no representations are found. * * @remarks * This method filters the segmentation representations based on the provided specifier. * If no specifier is provided, it returns all segmentation representations for the viewport. * if only the segmentationId is provided, it returns all representations of the segmentation. * if only the type is provided, it returns all representations of the type. * if both the segmentationId and type are provided, it returns all representations of the segmentation with the given type * which will be an array of length 1 */ export function getSegmentationRepresentations( viewportId: string, specifier: { segmentationId?: string; type?: SegmentationRepresentations; } = {} ): SegmentationRepresentation[] | [] { const segmentationStateManager = defaultSegmentationStateManager; return segmentationStateManager.getSegmentationRepresentations( viewportId, specifier ); } /** * Retrieves a specific segmentation representation for a given viewport and specifier. * * @param viewportId - The ID of the viewport. * @param specifier - The specifier object containing segmentationId and type. * @returns A SegmentationRepresentation object if found, or undefined if not found. * */ export function getSegmentationRepresentation( viewportId: string, specifier: { segmentationId: string; type: SegmentationRepresentations; } ): SegmentationRepresentation | undefined { const segmentationStateManager = defaultSegmentationStateManager; Iif (!specifier.segmentationId || !specifier.type) { throw new Error( 'getSegmentationRepresentation: No segmentationId or type provided, you need to provide at least one of them' ); } const representations = segmentationStateManager.getSegmentationRepresentations( viewportId, specifier ); return representations?.[0]; } /** * Retrieves the segmentation representations associated with a given segmentation ID. * * @param segmentationId - The unique identifier for the segmentation. * @returns An array of `SegmentationRepresentation` objects associated with the specified segmentation ID. */ export function getSegmentationRepresentationsBySegmentationId( segmentationId: string ): { viewportId: string; representations: SegmentationRepresentation[] }[] { const segmentationStateManager = defaultSegmentationStateManager; return segmentationStateManager.getSegmentationRepresentationsBySegmentationId( segmentationId ); } |