Skip to main content

utilities

Index

References

triggerEvent

Re-exports triggerEvent

Namespaces

boundingBox

boundingBox:

extend2DBoundingBoxInViewAxis

  • Uses the current bounds of the 2D rectangle and extends it in the view axis by numSlices It compares min and max of each IJK to find the view axis (for axial, zMin === zMax) and then calculates the extended range. It will assume the slice is relative to the current slice and will add the given slices to the current max of the boundingBox.


    Parameters

    • boundsIJK: [Point2, Point2, Point2]

      [[iMin, iMax], [jMin, jMax], [kMin, kMax]]

    • numSlicesToProject: number

    Returns [Types.Point2, Types.Point2, Types.Point2]

    extended bounds

getBoundingBoxAroundShape

  • With a given vertices (points) coordinates in IJK, it calculates the minimum and maximum coordinate in each axis, and returns them. If dimensions are provided it also clip the min, max to the provided width, height and depth


    Parameters

    • points: Point3[]

      shape corner points coordinates (IJK)

    • optionaldimensions: Point3

      dimensions of the image

    Returns [Types.Point2, Types.Point2, Types.Point2]

    [[xMin,xMax],[yMin,yMax], [zMin,zMax]]

cine

cine:

Events

Events:

CINE Tool Events

CLIP_STARTED

CLIP_STARTED: CORNERSTONE_CINE_TOOL_STARTED

CLIP_STOPPED

CLIP_STOPPED: CORNERSTONE_CINE_TOOL_STOPPED

addToolState

  • addToolState(element: HTMLDivElement, data: ToolData): void
  • Parameters

    • element: HTMLDivElement
    • data: ToolData

    Returns void

getToolState

  • getToolState(element: HTMLDivElement): CINETypes.ToolData | undefined
  • Parameters

    • element: HTMLDivElement

    Returns CINETypes.ToolData | undefined

playClip

  • playClip(element: HTMLDivElement, playClipOptions: PlayClipOptions): void
  • Starts playing a clip or adjusts the frame rate of an already playing clip. framesPerSecond is optional and defaults to 30 if not specified. A negative framesPerSecond will play the clip in reverse. The element must be a stack of images


    Parameters

    • element: HTMLDivElement

      HTML Element

    • playClipOptions: PlayClipOptions

    Returns void

stopClip

  • stopClip(element: HTMLDivElement): void
  • Stops an already playing clip.


    Parameters

    • element: HTMLDivElement

      HTML Element

    Returns void

drawing

drawing:

getTextBoxCoordsCanvas

  • Determine the coordinates that will place the textbox to the right of the annotation.


    Parameters

    • annotationCanvasPoints: Point2[]

      The canvas points of the annotation’s handles.

    Returns Types.Point2

    • The coordinates for default placement of the textbox.

math

math:

ellipse

ellipse:

getCanvasEllipseCorners

  • getCanvasEllipseCorners(ellipseCanvasPoints: canvasCoordinates): Types.Point2[]
  • It takes the canvas coordinates of the ellipse corners and returns the top left and bottom right corners of it


    Parameters

    • ellipseCanvasPoints: canvasCoordinates

      The coordinates of the ellipse in the canvas.

    Returns Types.Point2[]

    An array of two points.

pointInEllipse

  • pointInEllipse(ellipse: Ellipse, pointLPS: Point3): boolean
  • Given an ellipse and a point, return true if the point is inside the ellipse


    Parameters

    • ellipse: Ellipse

      The ellipse object to check against.

    • pointLPS: Point3

      The point in LPS space to test.

    Returns boolean

    A boolean value.

lineSegment

lineSegment:

distanceToPoint

  • Calculates the distance of a point to a line


    Parameters

    • lineStart: Point2

      x,y coordinates of the start of the line

    • lineEnd: Point2

      x,y coordinates of the end of the line

    • point: Point2

      x,y of the point

    Returns number

    distance

distanceToPointSquared

  • Calculates the distance-squared of a point to a line


    Parameters

    • lineStart: Point2

      x,y coordinates of the start of the line

    • lineEnd: Point2

      x,y coordinates of the end of the line

    • point: Point2

      x,y of the point

    Returns number

    distance-squared

intersectLine

  • Calculates the intersection point between two lines in the 2D plane


    Parameters

    • line1Start: Point2

      x,y coordinates of the start of the first line

    • line1End: Point2

      x,y coordinates of the end of the first line

    • line2Start: Point2

      x,y coordinates of the start of the second line

    • line2End: Point2

      x,y coordinates of the end of the second line

    Returns number[]

    [x,y] - point x,y of the point

point

point:

distanceToPoint

  • Calculates the distance of a point to another point


    Parameters

    Returns number

    distance

polyline

polyline:

addCanvasPointsToArray

  • addCanvasPointsToArray(element: HTMLDivElement, canvasPoints: Point2[], newCanvasPoint: Point2, commonData: PlanarFreehandROICommonData): number
  • Adds one or more points to the array at a resolution defined by the underlying image.


    Parameters

    • element: HTMLDivElement
    • canvasPoints: Point2[]
    • newCanvasPoint: Point2
    • commonData: PlanarFreehandROICommonData

    Returns number

calculateAreaOfPoints

  • calculateAreaOfPoints(points: Point2[]): number
  • Calculates the area of an array of Point2 points using the shoelace algorithm.

    The units of the area are in the same units as the points are in. E.g. if the points are in canvas, then the result is in canvas pixels ^2; If they are in mm, then the result is in mm^2; etc.


    Parameters

    Returns number

getClosestIntersectionWithPolyline

  • getClosestIntersectionWithPolyline(points: Point2[], p1: Point2, q1: Point2, closed?: boolean): { distance: number; segment: Types.Point2 } | undefined
  • Checks whether the line (p1,q1) intersects any of the other lines in the points, and returns the closest value.


    Parameters

    Returns { distance: number; segment: Types.Point2 } | undefined

getFirstIntersectionWithPolyline

  • Checks whether the line (p1,q1) intersects any of the other lines in the points, and returns the first value.


    Parameters

    Returns Types.Point2 | undefined

getSubPixelSpacingAndXYDirections

  • Gets the desired spacing for points in the polyline for the PlanarFreehandROITool in the x and y canvas directions, as well as returning these canvas directions in world space.


    Parameters

    • viewport: default | default

      The Cornerstone3D StackViewport or VolumeViewport.

    • subPixelResolution: number

      The number to divide the image pixel spacing by to get the sub pixel spacing. E.g. 10 will return spacings 10x smaller than the native image spacing.

    Returns { spacing: Point2; xDir: Point3; yDir: Point3 }

    The spacings of the X and Y directions, and the 3D directions of the x and y directions.

pointCanProjectOnLine

  • Returns true if the point p can project onto point (p1, p2), and if this projected point is less than proximity units away.


    Parameters

    Returns boolean

pointsAreWithinCloseContourProximity

  • pointsAreWithinCloseContourProximity(p1: Point2, p2: Point2, closeContourProximity: number): boolean
  • Returns true if points p1 and p2 are within closeContourProximity.


    Parameters

    Returns boolean

rectangle

rectangle:

distanceToPoint

  • distanceToPoint(rect: number[], point: Point2): number
  • Calculates distance of the point to the rectangle. It calculates the minimum distance between the point and each line segment of the rectangle.


    Parameters

    • rect: number[]

      coordinates of the rectangle [left, top, width, height]

    • point: Point2

      [x,y] coordinates of a point

    Returns number

vec2

vec2:

findClosestPoint

  • Find the closest point to the target point


    Parameters

    • sourcePoints: Point2[]

      The potential source points.

    • targetPoint: Point2

      The target point, used to find the closest source.

    Returns Types.Point2

    The closest point in the array of point sources

liangBarksyClip

  • liangBarksyClip(a: any, b: any, box: any, da?: any, db?: any): 0 | 1
  • Parameters

    • a: any
    • b: any
    • box: any

      [xmin, ymin, xmax, ymax]

    • optionalda: any
    • optionaldb: any

    Returns 0 | 1

orientation

orientation:

publicgetOrientationStringLPS

  • getOrientationStringLPS(vector: Point3): string
  • Returns the orientation of the vector in the patient coordinate system.


    Parameters

    Returns string

    The orientation in the patient coordinate system.

publicinvertOrientationStringLPS

  • invertOrientationStringLPS(orientationString: string): string
  • Inverts an orientation string.


    Parameters

    • orientationString: string

      The orientation.

    Returns string

    The inverted orientationString.

planar

planar:

filterAnnotationsForDisplay

  • Given the viewport and the annotations, it filters the annotations array and only return those annotation that should be displayed on the viewport


    Parameters

    Returns Annotations

    A filtered version of the annotations.

filterAnnotationsWithinSlice

  • given some Annotations, and the slice defined by the camera’s normal direction and the spacing in the normal, filter the Annotations which is within the slice.


    Parameters

    • annotations: Annotations

      Annotations

    • camera: ICamera

      The camera

    • spacingInNormalDirection: number

      The spacing in the normal direction

    Returns Annotations

    The filtered Annotations.

getPointInLineOfSightWithCriteria

  • getPointInLineOfSightWithCriteria(viewport: default, worldPos: Point3, targetVolumeId: string, criteriaFunction: (intensity: number, point: Point3) => Point3, stepSize?: number): Types.Point3
  • Returns a point based on some criteria (e.g., minimum or maximum intensity) in the line of sight (on the line between the passed worldPosition and camera position). It iterated over the points with a step size on the line.


    Parameters

    • viewport: default

      Volume viewport

    • worldPos: Point3

      World coordinates of the clicked location

    • targetVolumeId: string

      target Volume ID in the viewport

    • criteriaFunction: (intensity: number, point: Point3) => Point3

      A function that returns the point if it passes a certain written logic, for instance, it can be a maxValue function that keeps the records of all intensity values, and only return the point if its intensity is greater than the maximum intensity of the points passed before.

    • stepSize: number = 0.25

    Returns Types.Point3

    the World pos of the point that passes the criteriaFunction

getWorldWidthAndHeightFromCorners

  • getWorldWidthAndHeightFromCorners(viewPlaneNormal: Point3, viewUp: Point3, topLeftWorld: Point3, bottomRightWorld: Point3): { worldHeight: number; worldWidth: number }
  • Given two world positions and an orthogonal view to an imageVolume defined by a viewPlaneNormal and a viewUp, get the width and height in world coordinates of the rectangle defined by the two points. The implementation works both with orthogonal non-orthogonal rectangles.


    Parameters

    • viewPlaneNormal: Point3

      The normal of the view.

    • viewUp: Point3

      The up direction of the view.

    • topLeftWorld: Point3

      The first world position.

    • bottomRightWorld: Point3

      The second world position.

    Returns { worldHeight: number; worldWidth: number }

    The worldWidth and worldHeight.

    • worldHeight: number
    • worldWidth: number

planarFreehandROITool

planarFreehandROITool:

interpolateAnnotation

  • interpolateAnnotation(enabledElement: IEnabledElement, annotation: PlanarFreehandROIAnnotation, knotsRatioPercentage: number): boolean
  • Interpolates a given annotation from a given enabledElement. It mutates annotation param. The param knotsRatioPercentage defines the percentage of points to be considered as knots on the interpolation process. Interpolation will be skipped in case: annotation is not present in enabledElement (or there is no toolGroup associated with it), related tool is being modified.


    Parameters

    • enabledElement: IEnabledElement
    • annotation: PlanarFreehandROIAnnotation
    • knotsRatioPercentage: number

    Returns boolean

rectangleROITool

rectangleROITool:

getBoundsIJKFromRectangleAnnotations

  • getBoundsIJKFromRectangleAnnotations(annotations: any, referenceVolume: any, options?: Options): any
  • Parameters

    • annotations: any
    • referenceVolume: any
    • options: Options = ...

    Returns any

segmentation

segmentation:

createLabelmapVolumeForViewport

  • createLabelmapVolumeForViewport(input: { options?: { dimensions?: Point3; direction?: Float32Array; metadata?: any; origin?: Point3; scalarData?: Float32Array | Uint8Array; spacing?: Point3; targetBuffer?: { type: Float32Array | Uint8Array }; volumeId?: string }; renderingEngineId: string; segmentationId?: string; viewportId: string }): Promise<string>
  • Create a new 3D segmentation volume from the default imageData presented in the first actor of the viewport. It looks at the metadata of the imageData to determine the volume dimensions and spacing if particular options are not provided.


    Parameters

    • input: { options?: { dimensions?: Point3; direction?: Float32Array; metadata?: any; origin?: Point3; scalarData?: Float32Array | Uint8Array; spacing?: Point3; targetBuffer?: { type: Float32Array | Uint8Array }; volumeId?: string }; renderingEngineId: string; segmentationId?: string; viewportId: string }

    Returns Promise<string>

    A promise that resolves to the Id of the new labelmap volume.

createMergedLabelmapForIndex

  • Given a list of labelmaps (with the possibility of overlapping regions), and a segmentIndex it creates a new labelmap with the same dimensions as the input labelmaps, but merges them into a single labelmap for the segmentIndex. It wipes out all other segment Indices. This is useful for calculating statistics regarding a specific segment when there are overlapping regions between labelmap (e.g. TMTV)


    Parameters

    • labelmaps: IImageVolume[]

      Array of labelmaps

    • segmentIndex: number = 1

      The segment index to merge

    • volumeId: string = 'mergedLabelmap'

    Returns Types.IImageVolume

    Merged labelmap

floodFill

getBrushSizeForToolGroup

  • getBrushSizeForToolGroup(toolGroupId: string): void
  • Parameters

    • toolGroupId: string

    Returns void

getBrushThresholdForToolGroup

  • getBrushThresholdForToolGroup(toolGroupId: string): any
  • Parameters

    • toolGroupId: string

    Returns any

getDefaultRepresentationConfig

  • getDefaultRepresentationConfig(segmentation: Segmentation): LabelmapConfig
  • It returns a configuration object for the given representation type.


    Parameters

    Returns LabelmapConfig

    A representation configuration object.

isValidRepresentationConfig

  • Given a representation type and a configuration, return true if the configuration is valid for that representation type


    Parameters

    • representationType: string

      The type of segmentation representation

    • config: RepresentationConfig

      RepresentationConfig

    Returns boolean

    A boolean value.

rectangleROIThresholdVolumeByRange

  • rectangleROIThresholdVolumeByRange(annotationUIDs: string[], segmentationVolume: IImageVolume, thresholdVolumeInformation: ThresholdInformation[], options: ThresholdOptions): Types.IImageVolume
  • It uses the provided rectangleROI annotations (either RectangleROIThreshold, or RectangleROIStartEndThreshold) to compute an ROI that is the intersection of all the annotations. Then it uses the rectangleROIThreshold utility to threshold the volume.


    Parameters

    • annotationUIDs: string[]

      rectangleROI annotationsUIDs to use for ROI

    • segmentationVolume: IImageVolume

      the segmentation volume

    • thresholdVolumeInformation: ThresholdInformation[]

      object array containing the volume data and range threshold values

    • options: ThresholdOptions

      options for thresholding

    Returns Types.IImageVolume

setBrushSizeForToolGroup

  • setBrushSizeForToolGroup(toolGroupId: string, brushSize: number): void
  • Parameters

    • toolGroupId: string
    • brushSize: number

    Returns void

setBrushThresholdForToolGroup

  • setBrushThresholdForToolGroup(toolGroupId: string, threshold: Point2): void
  • Parameters

    • toolGroupId: string
    • threshold: Point2

    Returns void

thresholdVolumeByRange

  • thresholdVolumeByRange(segmentationVolume: IImageVolume, thresholdVolumeInformation: ThresholdInformation[], options: ThresholdRangeOptions): Types.IImageVolume
  • It thresholds a segmentation volume based on a set of threshold values with respect to a list of volumes and respective threshold ranges.


    Parameters

    • segmentationVolume: IImageVolume

      the segmentation volume to be modified

    • thresholdVolumeInformation: ThresholdInformation[]

      array of objects containing volume data and a range (lower and upper values) to threshold

    • options: ThresholdRangeOptions

      the options for thresholding As there is a chance the volumes might have different dimensions and spacing, could be the case of no 1 to 1 mapping. So we need to work with the idea of voxel overlaps (1 to many mappings). We consider all intersections valid, to avoid thecomplexity to calculate a minimum voxel intersection percentage. This function, given a voxel center and spacing, calculates the overlap of the voxel with another volume and range check the voxels in the overlap. Three situations can occur: all voxels pass the range check, some voxels pass or none voxels pass. The overlapType parameter indicates if the user requires all voxels pass (overlapType = 1) or any voxel pass (overlapType = 0)

    Returns Types.IImageVolume

    segmented volume

triggerSegmentationRender

  • triggerSegmentationRender(toolGroupId: string): void
  • It triggers a render for all the segmentations of the tool group with the given Id.


    Parameters

    • toolGroupId: string

      The Id of the tool group to render.

    Returns void

stackPrefetch

stackPrefetch:

disable

  • disable(element: any): void
  • Parameters

    • element: any

    Returns void

enable

  • enable(element: any): void
  • Parameters

    • element: any

    Returns void

getConfiguration

  • getConfiguration(): { maxImagesToPrefetch: number; preserveExistingPool: boolean }
  • Returns { maxImagesToPrefetch: number; preserveExistingPool: boolean }

    • maxImagesToPrefetch: number
    • preserveExistingPool: boolean

setConfiguration

  • setConfiguration(config: any): void
  • Parameters

    • config: any

    Returns void

touch

touch:

copyPoints

copyPointsList

  • Copies a set of points.


    Parameters

    Returns ITouchPoints[]

    A copy of the points.

getDeltaDistance

  • Returns the distance between multiple IPoints instances.


    Parameters

    • currentPoints: IPoints[]

      The current points.

    • lastPoints: IPoints[]

      The last points, to be subtracted from the currentPoints.

    Returns IDistance

    The distance difference in IDistance format

getDeltaDistanceBetweenIPoints

  • Returns the distance difference between multiple IPoints instances.


    Parameters

    • currentPoints: IPoints[]

      The current points.

    • lastPoints: IPoints[]

      The last points.

    Returns IDistance

    The difference in IPoints format

getDeltaPoints

  • Returns the difference between multiple IPoints instances.


    Parameters

    • currentPoints: IPoints[]

      The current points.

    • lastPoints: IPoints[]

      The last points, to be subtracted from the currentPoints.

    Returns IPoints

    The difference in IPoints format

getDeltaRotation

getMeanPoints

getMeanTouchPoints

viewport

viewport:

jumpToSlice

Re-exports jumpToSlice

isViewportPreScaled

  • isViewportPreScaled(viewport: default | default, targetId: string): boolean

jumpToWorld

  • jumpToWorld(viewport: default, jumpWorld: Point3): true | undefined
  • Uses the viewport’s current camera to jump to a specific world coordinate


    Parameters

    • viewport: default
    • jumpWorld: Point3

      location in the world to jump to

    Returns true | undefined

    True if successful

viewportFilters

viewportFilters:

filterViewportsWithFrameOfReferenceUID

  • Given an array of viewports, returns a list of viewports that are viewing a world space with the given FrameOfReferenceUID.


    Parameters

    • viewports: (default | default)[]

      An array of viewports.

    • FrameOfReferenceUID: string

      The UID defining a particular world space/Frame Of Reference.

    Returns (Types.IStackViewport | Types.IVolumeViewport)[]

    A filtered array of viewports.

filterViewportsWithParallelNormals

  • filterViewportsWithParallelNormals(viewports: any, camera: any, EPS?: number): any
  • It filters the viewports that are looking in the same view as the camera It basically checks if the viewPlaneNormal is parallel to the camera viewPlaneNormal


    Parameters

    • viewports: any

      Array of viewports to filter

    • camera: any

      Camera to compare against

    • EPS: number = 0.999

    Returns any

    • Array of viewports with the same view

filterViewportsWithToolEnabled

  • Given an array of viewports, returns a list of viewports that have the the specified tool enabled.


    Parameters

    • viewports: (default | default)[]

      An array of viewports.

    • toolName: string

      The name of the tool to filter on.

    Returns (Types.IStackViewport | Types.IVolumeViewport)[]

    A filtered array of viewports.

getViewportIdsWithToolToRender

  • getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string, requireParallelNormals?: boolean): string[]
  • Given a cornerstone3D enabled element, and a toolName, find all viewportIds looking at the same Frame Of Reference that have the tool with the given toolName active, passive or enabled.


    Parameters

    • element: HTMLDivElement

      The target cornerstone3D enabled element.

    • toolName: string

      The string toolName.

    • requireParallelNormals: boolean = true

      If true, only return viewports that have parallel normals.

    Returns string[]

    An array of viewportIds.

Functions

calibrateImageSpacing

  • calibrateImageSpacing(imageId: string, renderingEngine: default, rowPixelSpacing: number, columnPixelSpacing: number): void
  • It adds the provided spacing to the Cornerstone internal calibratedPixelSpacing metadata provider, then it invalidates all the tools that have the imageId as their reference imageIds. Finally, it triggers a re-render for invalidated annotations.


    Parameters

    • imageId: string

      ImageId for the calibrated image

    • renderingEngine: default

      Cornerstone RenderingEngine instance

    • rowPixelSpacing: number

      Spacing in row direction

    • columnPixelSpacing: number

      Spacing in column direction

    Returns void

publicclip

  • clip(val: number, low: number, high: number): number
  • Clips a value to an upper and lower bound.


    Parameters

    • val: number

      The value to clip.

    • low: number

      The lower bound.

    • high: number

      The upper bound.

    Returns number

    The clipped value.

debounce

  • debounce(func: Function, wait?: number, options?: { leading: boolean; maxWait: number; trailing: boolean }): Function
  • Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked, or until the next browser frame is drawn. The debounced function comes with a cancel method to cancel delayed func invocations and a flush method to immediately invoke them. Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. The func is invoked with the last arguments provided to the debounced function. Subsequent calls to the debounced function return the result of the last func invocation.

    Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the debounced function is invoked more than once during the wait timeout.

    If wait is 0 and leading is false, func invocation is deferred until the next tick, similar to setTimeout with a timeout of 0.

    If wait is omitted in an environment with requestAnimationFrame, func invocation will be deferred until the next frame is drawn (typically about 16ms).

    See David Corbacho’s article for details over the differences between debounce and throttle.


    Parameters

    • func: Function

      The function to debounce.

    • optionalwait: number

      The number of milliseconds to delay; if omitted, requestAnimationFrame is used (if available).

    • optionaloptions: { leading: boolean; maxWait: number; trailing: boolean }

      The options object.

    Returns Function

    Returns the new debounced function.

deepMerge

  • deepMerge(target?: {}, source?: {}, optionsArgument?: any): any
  • Merge two objects, recursively merging any objects that are arrays


    Parameters

    • optionaltarget: {} = {}

      The target object.

    • optionalsource: {} = {}

      The source object to merge into the target object.

    • optionaloptionsArgument: any = undefined

      The options object.

    Returns any

    The merged object.

getAnnotationNearPoint

  • getAnnotationNearPoint(element: HTMLDivElement, canvasPoint: Point2, proximity?: number): Annotation | null
  • Get the annotation that is close to the provided canvas point, it will return the first annotation that is found.


    Parameters

    • element: HTMLDivElement

      The element to search for an annotation on.

    • canvasPoint: Point2

      The canvasPoint on the page where the user clicked.

    • proximity: number = 5

      The distance from the canvasPoint to the annotation.

    Returns Annotation | null

    The annotation for the element

getAnnotationNearPointOnEnabledElement

  • “Find the annotation near the point on the enabled element.” it will return the first annotation that is found.


    Parameters

    • enabledElement: IEnabledElement

      The element that is currently active.

    • point: Point2

      The point to search near.

    • proximity: number

      The distance from the point that the annotation must be within.

    Returns Annotation | null

    A Annotation object.

isObject

  • isObject(value: any): boolean
  • Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))


    Parameters

    • value: any

      The value to check.

    Returns boolean

    Returns true if value is an object, else false.

jumpToSlice

  • It uses the imageIndex in the Options to scroll to the slice that is intended. It works for both Stack and Volume viewports. In VolumeViewports, the imageIndex should be given with respect to the index in the 3D image in the view direction (i.e. the index of the slice in Axial, Sagittal, Coronal, or Oblique).


    Parameters

    • element: HTMLDivElement

      the HTML Div element scrolling inside

    • options: JumpToSliceOptions = ...

      the options used for jumping to a slice

    Returns Promise<void>

    Promise that resolves to ImageIdIndex

pointInShapeCallback

  • pointInShapeCallback(imageData: vtkImageData | CPUImageData, pointInShapeFn: ShapeFnCriteria, callback: PointInShapeCallback, boundsIJK?: BoundsIJK): void
  • For each point in the image (If boundsIJK is not provided, otherwise, for each point in the provided bounding box), It runs the provided callback IF the point passes the provided criteria to be inside the shape (which is defined by the provided pointInShapeFn)


    Parameters

    • imageData: vtkImageData | CPUImageData

      The image data object.

    • pointInShapeFn: ShapeFnCriteria

      A function that takes a point in LPS space and returns true if the point is in the shape and false if it is not.

    • callback: PointInShapeCallback

      A function that will be called for every point in the shape.

    • optionalboundsIJK: BoundsIJK

      The bounds of the volume in IJK coordinates.

    Returns void

pointInSurroundingSphereCallback

  • pointInSurroundingSphereCallback(imageData: vtkImageData, circlePoints: [Point3, Point3], callback: PointInShapeCallback, viewport?: default): void
  • Given an imageData, and the great circle top and bottom points of a sphere, this function will run the callback for each point of the imageData that is within the sphere defined by the great circle points. If the viewport is provided, region of interest will be an accurate approximation of the sphere (using viewport camera), and the resulting performance will be better.


    Parameters

    • imageData: vtkImageData

      The volume imageData

    • circlePoints: [Point3, Point3]

      bottom and top points of the great circle in world coordinates

    • callback: PointInShapeCallback

      A callback function that will be called for each point in the shape.

    • optionalviewport: default

    Returns void

scroll

  • It scrolls one slice in the Stack or Volume Viewport, it uses the options provided to determine the slice to scroll to. For Stack Viewport, it scrolls in the 1 or -1 direction, for Volume Viewport, it uses the camera and focal point to determine the slice to scroll to based on the spacings.


    Parameters

    • viewport: default | default

      The viewport in which to scroll

    • options: ScrollOptions

      Options to use for scrolling, including direction, invert, and volumeId

    Returns void

throttle

  • throttle(func: Function, wait?: number, options?: { leading: boolean; trailing: boolean }): Function
  • Creates a throttled function that only invokes func at most once per every wait milliseconds (or once per browser frame). The throttled function comes with a cancel method to cancel delayed func invocations and a flush method to immediately invoke them. Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. The func is invoked with the last arguments provided to the throttled function. Subsequent calls to the throttled function return the result of the last func invocation.

    Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the throttled function is invoked more than once during the wait timeout.

    If wait is 0 and leading is false, func invocation is deferred until the next tick, similar to setTimeout with a timeout of 0.

    If wait is omitted in an environment with requestAnimationFrame, func invocation will be deferred until the next frame is drawn (typically about 16ms).

    See David Corbacho’s article for details over the differences between throttle and debounce.


    Parameters

    • func: Function

      The function to throttle.

    • optionalwait: number

      The number of milliseconds to throttle invocations to; if omitted, requestAnimationFrame is used (if available).

    • optionaloptions: { leading: boolean; trailing: boolean }

      The options object.

    Returns Function

    Returns the new throttled function.

triggerAnnotationRender

  • triggerAnnotationRender(element: HTMLDivElement): void
  • It triggers the rendering of the annotations for the given HTML element using the AnnotationRenderingEngine


    Parameters

    • element: HTMLDivElement

      The element to render the annotation on.

    Returns void

triggerAnnotationRenderForViewportIds

  • triggerAnnotationRenderForViewportIds(renderingEngine: default, viewportIdsToRender: string[]): void
  • Parameters

    • renderingEngine: default
    • viewportIdsToRender: string[]

    Returns void