All files / tools/src/utilities/spatial types.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 46 47 48 49 50 51                                                                                                     
import type { Types } from '@cornerstonejs/core';
 
/**
 * A 4x4 matrix in column-major order (gl-matrix layout), used for
 * inter-frame-of-reference registration transforms.
 */
export type Mat4 = number[] | Float32Array;
 
/**
 * An infinite plane in world (patient) space, defined in point-normal form.
 */
export type Plane = {
  /** Unit-length plane normal. */
  normal: Types.Point3;
  /** Any point on the plane. */
  point: Types.Point3;
};
 
/**
 * An infinite line in world (patient) space.
 */
export type WorldLine = {
  /** A point on the line. */
  point: Types.Point3;
  /** Unit-length direction of the line. */
  direction: Types.Point3;
};
 
/**
 * How two viewports are decided to be spatially linked, i.e. whether it is
 * meaningful to draw spatial overlays (reference points, plane intersection
 * lines) from one viewport into the other.
 */
export type SpatialLinkPolicy = 'toolGroup' | 'frameOfReferenceUID' | 'explicit';
 
export type SpatialLinkOptions = {
  policy: SpatialLinkPolicy;
  /** Explicitly configured viewport links, used when policy is 'explicit'. */
  explicitLinks?: Array<{
    sourceViewportId: string;
    targetViewportId: string;
  }>;
  /**
   * Registration transforms between frames of reference, keyed by
   * `${sourceFrameOfReferenceUID}:${targetFrameOfReferenceUID}`. The presence
   * of a transform for a pair of frames of reference links them even when the
   * UIDs differ.
   */
  registrationTransforms?: Map<string, Mat4>;
};