All files / extensions/cornerstone/src/services/SegmentationService/backends ISegmentationServiceInternals.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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                                                                                         
import type { Types as csTypes } from '@cornerstonejs/core';
import type { Types as cstTypes } from '@cornerstonejs/tools';
 
/**
 * The narrow slice of SegmentationService that a segmentation backend is allowed to
 * reach (mirrors `IViewportServiceInternals`). The service `implements` this and
 * passes `this` to each backend, so the legacy twin can delegate the viewport
 * (re)creation / data-volume conversion work back to the shared service methods
 * (which touch servicesManager-owned services) without the backends reaching into
 * unrelated internals. Keeping this surface narrow is what stops the legacy path
 * from drifting as the next backend grows.
 *
 * Only the LEGACY twin uses these; the NEXT twin renders in place and needs none of
 * them (it never converts).
 */
export interface ISegmentationServiceInternals {
  /**
   * Recreate the stack viewport as an ORTHOGRAPHIC volume viewport (legacy
   * promotion). Owned by the service because it drives viewportGridService /
   * cornerstoneViewportService. Returns true (converted).
   */
  convertStackToVolumeViewport(viewport: csTypes.IViewport): Promise<boolean>;
 
  /**
   * Promote a stack viewport to volume only when the segmentation's
   * FrameOfReference matches the viewport's. Returns whether it converted.
   */
  attemptStackToVolumeConversion(
    viewport: csTypes.IStackViewport,
    segmentation: cstTypes.Segmentation,
    viewportId: string,
    segmentationId: string
  ): Promise<boolean>;
 
  /**
   * Convert the segmentation DATA to a volume labelmap when its FrameOfReference
   * matches a volume viewport (pure data; no viewport recreation).
   */
  handleVolumeViewport(
    viewport: csTypes.IVolumeViewport,
    segmentation: cstTypes.Segmentation,
    isVolumeSegmentation: boolean
  ): Promise<void>;
}