All files / tools/src/stateManagement/segmentation getCurrentLabelmapImageIdForViewport.ts

66.66% Statements 4/6
100% Branches 0/0
66.66% Functions 2/3
66.66% Lines 4/6

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                                  754x         754x                               3244x 3244x                                
import { defaultSegmentationStateManager } from './SegmentationStateManager';
 
/**
 * Retrieves the labelmap image IDs for a specific viewport and segmentation representation.
 *
 * @param viewportId - The ID of the viewport.
 * @param segmentationId -  The ID of the segmentation.
 * @returns An array of labelmap image IDs.
 *
 * @deprecated Use getCurrentLabelmapImageIdsForViewport instead. since we
 * have added support for multiple imageIds in the same viewport for the
 * same labelmap representation (overlapping segments usecase)
 */
export function getCurrentLabelmapImageIdForViewport(
  viewportId: string,
  segmentationId: string
) {
  const imageIds = getCurrentLabelmapImageIdsForViewport(
    viewportId,
    segmentationId
  );
 
  return imageIds[0];
}
 
/**
 * Retrieves the labelmap image IDs for a specific viewport and segmentation representation.
 * If the segmentation has multiple imageIds for in the current view of the same segmentation
 * this function will return an array of imageIds.
 *
 * @param viewportId - The ID of the viewport.
 * @param segmentationId -  The ID of the segmentation.
 * @returns An array of labelmap image IDs.
 */
export function getCurrentLabelmapImageIdsForViewport(
  viewportId: string,
  segmentationId: string
) {
  const segmentationStateManager = defaultSegmentationStateManager;
  return segmentationStateManager.getCurrentLabelmapImageIdsForViewport(
    viewportId,
    segmentationId
  );
}
 
export function getLabelmapImageIdsForImageId(
  imageId: string,
  segmentationId: string
) {
  const segmentationStateManager = defaultSegmentationStateManager;
  return segmentationStateManager.getLabelmapImageIdsForImageId(
    imageId,
    segmentationId
  );
}