All files / packages/tools/src/utilities/contours/interpolation getInterpolationDataCollection.ts

87.5% Statements 7/8
50% Branches 1/2
100% Functions 2/2
87.5% Lines 7/8

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                                      4x 4x 4x     4x 6x 6x     4x    
import getInterpolationData from './getInterpolationData';
import type { InterpolationViewportData } from '../../../types';
import type { InterpolationROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
import type { FilterParam } from './getInterpolationData';
 
/**
 * getInterpolationDataCollection - Gets the array of annotations which match the
 * filter parameters, mapped by slice index.
 *
 * @param viewportData - the annotation/viewport to start the interpolation from
 * @param filterParams - A selector for annotations for interpolation
 * @param onlyAnnotationImage - boolean, if true include interpolated annotation existing images only.
 * @returns The list of interpolated locations in the stack.
 */
 
export default function getInterpolationDataCollection(
  viewportData: InterpolationViewportData,
  filterParams: FilterParam[]
): InterpolationROIAnnotation[] {
  const imageAnnotations = getInterpolationData(viewportData, filterParams);
  const interpolatedDataCollection = [];
  Iif (!imageAnnotations?.size) {
    return interpolatedDataCollection;
  }
  for (const annotations of imageAnnotations.values()) {
    annotations.forEach((annotation) => {
      interpolatedDataCollection.push(annotation);
    });
  }
  return interpolatedDataCollection;
}