All files / packages/tools/src/stateManagement/segmentation/polySeg/Surface computeAndAddSurfaceRepresentation.ts

0% Statements 0/3
0% Branches 0/1
0% Functions 0/3
0% Lines 0/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 21 22 23 24 25 26 27                                                     
import { SegmentationRepresentations } from '../../../../enums';
import { PolySegConversionOptions } from '../../../../types';
import { computeAndAddRepresentation } from '../computeAndAddRepresentation';
import { computeSurfaceData } from './surfaceComputationStrategies';
import { updateSurfaceData } from './updateSurfaceData';
 
/**
 * Computes and adds a surface representation for a given segmentation.
 * @param segmentationId - The ID of the segmentation.
 * @param options - Additional options for computing the surface representation.
 * @param options.segmentIndices - The indices of the segments to compute the surface for.
 * @param options.segmentationRepresentationUID - The UID of the segmentation representation to compute the surface for.
 *
 * @returns A promise that resolves when the surface representation is computed and added.
 */
export function computeAndAddSurfaceRepresentation(
  segmentationId: string,
  options: PolySegConversionOptions = {}
) {
  return computeAndAddRepresentation(
    segmentationId,
    SegmentationRepresentations.Surface,
    () => computeSurfaceData(segmentationId, options),
    () => updateSurfaceData(segmentationId)
  );
}