All files / packages/tools/src/utilities/contours getContourHolesDataWorld.ts

66.66% Statements 2/3
100% Branches 2/2
50% Functions 1/2
66.66% Lines 2/3

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                          1x   1x        
import type { Types } from '@cornerstonejs/core';
import type { Annotation, ContourAnnotation } from '../../types';
import { getAnnotation } from '../../stateManagement';
 
/**
 * Get child polylines data in world space for contour annotations that represent the holes
 * @param annotation - Annotation
 * @param viewport - Viewport used to convert the points from world to canvas space
 * @returns An array that contains all child polylines (holes) in world space
 */
export default function getContourHolesDataWorld(
  annotation: Annotation
): Types.Point3[][] {
  const childAnnotationUIDs = annotation.childAnnotationUIDs ?? [];
 
  return childAnnotationUIDs.map(
    (uid) => (getAnnotation(uid) as ContourAnnotation).data.contour.polyline
  );
}