Skip to main content

Types

Index

Namespaces

EventTypes

EventTypes:

CameraModifiedEvent

CameraModifiedEvent: CustomEventType<CameraModifiedEventDetail>

CameraModified Event type

CameraModifiedEventDetail

CameraModifiedEventDetail: { camera: ICamera; element: HTMLDivElement; previousCamera: ICamera; renderingEngineId: string; rotation?: number; viewportId: string }

CAMERA_MODIFIED Event’s data


Type declaration

  • camera: ICamera

    Current camera properties

  • element: HTMLDivElement

    Viewport HTML element in the DOM

  • previousCamera: ICamera

    Previous camera properties

  • renderingEngineId: string

    Unique ID for the renderingEngine

  • optionalrotation?: number

    Rotation Optional

  • viewportId: string

    Viewport Unique ID in the renderingEngine

ElementDisabledEvent

ElementDisabledEvent: CustomEventType<ElementDisabledEventDetail>

ELEMENT_DISABLED Event type

ElementDisabledEventDetail

ElementDisabledEventDetail: { element: HTMLDivElement; renderingEngineId: string; viewportId: string }

ELEMENT_DISABLED Event’s data


Type declaration

  • element: HTMLDivElement

    Viewport HTML element in the DOM

  • renderingEngineId: string

    Unique ID for the renderingEngine

  • viewportId: string

    Viewport Unique ID in the renderingEngine

ElementEnabledEvent

ElementEnabledEvent: CustomEventType<ElementEnabledEventDetail>

ELEMENT_ENABLED Event type

ElementEnabledEventDetail

ElementEnabledEventDetail: { element: HTMLDivElement; renderingEngineId: string; viewportId: string }

ELEMENT_Enabled Event’s data


Type declaration

  • element: HTMLDivElement

    Viewport HTML element in the DOM

  • renderingEngineId: string

    Unique ID for the renderingEngine

  • viewportId: string

    Viewport Unique ID in the renderingEngine

ImageCacheImageAddedEvent

ImageCacheImageAddedEvent: CustomEventType<ImageCacheImageAddedEventDetail>

IMAGE_CACHE_IMAGE_ADDED Event type

ImageCacheImageAddedEventDetail

ImageCacheImageAddedEventDetail: { image: ICachedImage }

IMAGE_CACHE_IMAGE_ADDED Event’s data


Type declaration

ImageCacheImageRemovedEvent

ImageCacheImageRemovedEvent: CustomEventType<ImageCacheImageRemovedEventDetail>

IMAGE_CACHE_IMAGE_REMOVED Event type

ImageCacheImageRemovedEventDetail

ImageCacheImageRemovedEventDetail: { imageId: string }

IMAGE_CACHE_IMAGE_REMOVED Event’s data


Type declaration

  • imageId: string

    the removed image id

ImageLoadProgressEvent

ImageLoadProgressEvent: CustomEventType<ImageLoadProgressEventDetail>

IMAGE_LOAD_PROGRESS

ImageLoadProgressEventDetail

ImageLoadProgressEventDetail: { imageId: string; loaded: number; percent: number; total: number; url: string }

IMAGE_LOAD_PROGRESS Event’s data. Note this is only for one image load and NOT volume load.


Type declaration

  • imageId: string

    loading image image id

  • loaded: number

    the bytes browser receive

  • percent: number

    loaded divided by total * 100 - shows the percentage of the image loaded

  • total: number

    the total bytes settled by the header

  • url: string

    url we are loading from

ImageLoadedEvent

ImageLoadedEvent: CustomEventType<ImageLoadedEventDetail>

IMAGE_LOADED Event type

ImageLoadedEventDetail

ImageLoadedEventDetail: { image: IImage }

IMAGE_LOADED Event’s data


Type declaration

ImageLoadedFailedEvent

ImageLoadedFailedEvent: CustomEventType<ImageLoadedFailedEventDetail>

IMAGE_LOADED_FAILED Event type

ImageLoadedFailedEventDetail

ImageLoadedFailedEventDetail: { error: unknown; imageId: string }

IMAGE_LOADED_FAILED Event’s data


Type declaration

  • error: unknown
  • imageId: string

    the imageId for the image

ImageRenderedEvent

ImageRenderedEvent: CustomEventType<ElementEnabledEventDetail>

IMAGE_RENDERED Event type

ImageRenderedEventDetail

ImageRenderedEventDetail: { element: HTMLDivElement; renderingEngineId: string; suppressEvents?: boolean; viewportId: string }

IMAGE_RENDERED Event’s data


Type declaration

  • element: HTMLDivElement

    Viewport HTML element in the DOM

  • renderingEngineId: string

    Unique ID for the renderingEngine

  • optionalsuppressEvents?: boolean

    Whether to suppress the event

  • viewportId: string

    Viewport Unique ID in the renderingEngine

ImageSpacingCalibratedEvent

ImageSpacingCalibratedEvent: CustomEventType<ImageSpacingCalibratedEventDetail>

IMAGE_SPACING_CALIBRATED

ImageSpacingCalibratedEventDetail

ImageSpacingCalibratedEventDetail: { columnScale: number; element: HTMLDivElement; imageData: vtkImageData; imageId: string; renderingEngineId: string; rowScale: number; viewportId: string; worldToIndex: mat4 }

IMAGE_SPACING_CALIBRATED Event’s data


Type declaration

  • columnScale: number
  • element: HTMLDivElement
  • imageData: vtkImageData
  • imageId: string
  • renderingEngineId: string
  • rowScale: number
  • viewportId: string
  • worldToIndex: mat4

ImageVolumeModifiedEvent

ImageVolumeModifiedEvent: CustomEventType<ImageVolumeModifiedEventDetail>

IMAGE_VOLUME_MODIFIED Event type

ImageVolumeModifiedEventDetail

ImageVolumeModifiedEventDetail: { FrameOfReferenceUID: string; imageVolume: IImageVolume }

IMAGE_VOLUME_MODIFIED Event’s data


Type declaration

  • FrameOfReferenceUID: string

    FrameOfReferenceUID where the volume belongs to

  • imageVolume: IImageVolume

    the modified volume

PreStackNewImageEvent

PreStackNewImageEvent: CustomEventType<PreStackNewImageEventDetail>

START_NEW_IMAGE

PreStackNewImageEventDetail

PreStackNewImageEventDetail: { imageId: string; imageIdIndex: number; renderingEngineId: string; viewportId: string }

PRE_STACK_NEW_IMAGE Event’s data


Type declaration

  • imageId: string

    the image imageId

  • imageIdIndex: number

    the index of imageId in the stack

  • renderingEngineId: string

    unique id for the renderingEngine

  • viewportId: string

    unique id for the viewport

StackNewImageEvent

StackNewImageEvent: CustomEventType<StackNewImageEventDetail>

START_NEW_IMAGE

StackNewImageEventDetail

StackNewImageEventDetail: { image: IImage; imageId: string; imageIdIndex: number; renderingEngineId: string; viewportId: string }

STACK_NEW_IMAGE Event’s data


Type declaration

  • image: IImage

    the new image set on the stack viewport

  • imageId: string

    the image imageId

  • imageIdIndex: number

    the index of imageId in the stack

  • renderingEngineId: string

    unique id for the renderingEngine

  • viewportId: string

    unique id for the viewport

StackViewportNewStackEvent

StackViewportNewStackEvent: CustomEventType<StackViewportNewStackEventDetail>

STACK_VIEWPORT_NEW_STACK

StackViewportNewStackEventDetail

StackViewportNewStackEventDetail: { currentImageIdIndex: number; element: HTMLDivElement; imageIds: string[]; viewportId: string }

The STACK_VIEWPORT_NEW_STACK event’s data, when a new stack is set on a StackViewport


Type declaration

  • currentImageIdIndex: number
  • element: HTMLDivElement
  • imageIds: string[]
  • viewportId: string

StackViewportScrollEvent

StackViewportScrollEvent: CustomEventType<StackViewportScrollEventDetail>

StackViewportScrollEventDetail

StackViewportScrollEventDetail: { direction: number; imageId: string; newImageIdIndex: number }

Stack Scroll event detail


Type declaration

  • direction: number

    direction of the scroll

  • imageId: string

    the new imageId in the stack that we just scroll to

  • newImageIdIndex: number

    the new imageId index in the stack that we just scroll to

VoiModifiedEvent

VoiModifiedEvent: CustomEventType<VoiModifiedEventDetail>

VOI_MODIFIED Event type

VoiModifiedEventDetail

VoiModifiedEventDetail: { range: VOIRange; viewportId: string; volumeId?: string }

VOI_MODIFIED Event’s data


Type declaration

  • range: VOIRange

    new VOI range

  • viewportId: string

    Viewport Unique ID in the renderingEngine

  • optionalvolumeId?: string

    Unique ID for the volume in the cache

VolumeCacheVolumeAddedEvent

VolumeCacheVolumeAddedEvent: CustomEventType<VolumeCacheVolumeAddedEventDetail>

VOLUME_CACHE_VOLUME_ADDED Event type

VolumeCacheVolumeAddedEventDetail

VolumeCacheVolumeAddedEventDetail: { volume: ICachedVolume }

VOLUME_CACHE_VOLUME_ADDED Event’s data


Type declaration

VolumeCacheVolumeRemovedEvent

VolumeCacheVolumeRemovedEvent: CustomEventType<VolumeCacheVolumeRemovedEventDetail>

VOLUME_CACHE_VOLUME_REMOVED Event type

VolumeCacheVolumeRemovedEventDetail

VolumeCacheVolumeRemovedEventDetail: { volumeId: string }

VOLUME_CACHE_VOLUME_REMOVED Event’s data


Type declaration

  • volumeId: string

    the removed volume id

VolumeLoadedEvent

VolumeLoadedEvent: CustomEventType<VolumeLoadedEventDetail>

VOLUME_LOADED Event type

VolumeLoadedEventDetail

VolumeLoadedEventDetail: { volume: IImageVolume }

VOLUME_LOADED Event’s data


Type declaration

VolumeLoadedFailedEvent

VolumeLoadedFailedEvent: CustomEventType<VolumeLoadedFailedEventDetail>

VOLUME_LOADED_FAILED Event type

VolumeLoadedFailedEventDetail

VolumeLoadedFailedEventDetail: { error: unknown; volumeId: string }

VOLUME_LOADED_FAILED Event’s data


Type declaration

  • error: unknown
  • volumeId: string

    the volumeId for the volume

VolumeNewImageEvent

VolumeNewImageEvent: CustomEventType<VolumeNewImageEventDetail>

VOLUME_NEW_IMAGE

VolumeNewImageEventDetail

VolumeNewImageEventDetail: { imageIndex: number; numberOfSlices: number; renderingEngineId: string; viewportId: string }

VOLUME_NEW_IMAGE Event’s data


Type declaration

  • imageIndex: number

    image index

  • numberOfSlices: number

    number of slices

  • renderingEngineId: string

    unique id for the renderingEngine

  • viewportId: string

    unique id for the viewport

Interfaces

CPUFallbackColormap

CPUFallbackColormap:

addColor

addColor: (rgba: Point4) => void

Type declaration

buildLookupTable

buildLookupTable: (lut: CPUFallbackLookupTable) => void

Type declaration

clearColors

clearColors: () => void

Type declaration

    • (): void
    • Returns void

createLookupTable

createLookupTable: () => CPUFallbackLookupTable

getColor

getColor: (index: number) => Point4

Type declaration

    • Parameters

      • index: number

      Returns Point4

getColorRepeating

getColorRepeating: (index: number) => Point4

Type declaration

    • Parameters

      • index: number

      Returns Point4

getColorSchemeName

getColorSchemeName: () => string

Type declaration

    • (): string
    • Returns string

getId

getId: () => string

Type declaration

    • (): string
    • Get id of colormap


      Returns string

getNumberOfColors

getNumberOfColors: () => number

Type declaration

    • (): number
    • Returns number

insertColor

insertColor: (index: number, rgba: Point4) => void

Type declaration

    • (index: number, rgba: Point4): void
    • Parameters

      Returns void

isValidIndex

isValidIndex: (index: number) => boolean

Type declaration

    • (index: number): boolean
    • Parameters

      • index: number

      Returns boolean

removeColor

removeColor: (index: number) => void

Type declaration

    • (index: number): void
    • Parameters

      • index: number

      Returns void

setColor

setColor: (index: number, rgba: Point4) => void

Type declaration

    • (index: number, rgba: Point4): void
    • Parameters

      Returns void

setColorSchemeName

setColorSchemeName: (name: string) => void

Type declaration

    • (name: string): void
    • Parameters

      • name: string

      Returns void

setNumberOfColors

setNumberOfColors: (numColors: number) => void

Type declaration

    • (numColors: number): void
    • Parameters

      • numColors: number

      Returns void

CPUFallbackEnabledElement

CPUFallbackEnabledElement:

optionalcanvas

canvas?: HTMLCanvasElement

optionalcolormap

optionalimage

image?: IImage

optionalinvalid

invalid?: boolean

optionalmetadata

metadata?: { dimensions?: Point3; direction?: Mat3; imagePixelModule?: { bitsAllocated: number; bitsStored: number; bluePaletteColorLookupTableData: number[]; bluePaletteColorLookupTableDescriptor?: number[]; columns: number; greenPaletteColorLookupTableData: number[]; greenPaletteColorLookupTableDescriptor?: number[]; highBit: number; largestPixelValue?: number; photometricInterpretation: string; pixelAspectRatio?: number; pixelRepresentation: number; planarConfiguration?: number; redPaletteColorLookupTableData: number[]; redPaletteColorLookupTableDescriptor?: number[]; rows: number; samplesPerPixel: number; smallestPixelValue?: number }; imagePlaneModule?: { columnCosines: Point3; columnPixelSpacing: number; columns: number; frameOfReferenceUID: string; imageOrientationPatient: number[]; imagePositionPatient: number[]; pixelSpacing: Point2; rowCosines: Point3; rowPixelSpacing: number; rows: number; sliceLocation?: number; sliceThickness?: number }; origin?: Point3; spacing?: Point3 }

Type declaration

  • optionaldimensions?: Point3

    Last index is always 1 for CPU

  • optionaldirection?: Mat3
  • optionalimagePixelModule?: { bitsAllocated: number; bitsStored: number; bluePaletteColorLookupTableData: number[]; bluePaletteColorLookupTableDescriptor?: number[]; columns: number; greenPaletteColorLookupTableData: number[]; greenPaletteColorLookupTableDescriptor?: number[]; highBit: number; largestPixelValue?: number; photometricInterpretation: string; pixelAspectRatio?: number; pixelRepresentation: number; planarConfiguration?: number; redPaletteColorLookupTableData: number[]; redPaletteColorLookupTableDescriptor?: number[]; rows: number; samplesPerPixel: number; smallestPixelValue?: number }
    • bitsAllocated: number
    • bitsStored: number
    • bluePaletteColorLookupTableData: number[]
    • optionalbluePaletteColorLookupTableDescriptor?: number[]
    • columns: number
    • greenPaletteColorLookupTableData: number[]
    • optionalgreenPaletteColorLookupTableDescriptor?: number[]
    • highBit: number
    • optionallargestPixelValue?: number
    • photometricInterpretation: string
    • optionalpixelAspectRatio?: number
    • pixelRepresentation: number
    • optionalplanarConfiguration?: number
    • redPaletteColorLookupTableData: number[]
    • optionalredPaletteColorLookupTableDescriptor?: number[]
    • rows: number
    • samplesPerPixel: number
    • optionalsmallestPixelValue?: number
  • optionalimagePlaneModule?: { columnCosines: Point3; columnPixelSpacing: number; columns: number; frameOfReferenceUID: string; imageOrientationPatient: number[]; imagePositionPatient: number[]; pixelSpacing: Point2; rowCosines: Point3; rowPixelSpacing: number; rows: number; sliceLocation?: number; sliceThickness?: number }
    • columnCosines: Point3
    • columnPixelSpacing: number
    • columns: number
    • frameOfReferenceUID: string
    • imageOrientationPatient: number[]
    • imagePositionPatient: number[]
    • pixelSpacing: Point2
    • rowCosines: Point3
    • rowPixelSpacing: number
    • rows: number
    • optionalsliceLocation?: number
    • optionalsliceThickness?: number
  • optionalorigin?: Point3
  • optionalspacing?: Point3

    Last spacing is always EPSILON for CPU

optionalneedsRedraw

needsRedraw?: boolean

optionaloptions

options?: { colormap?: CPUFallbackColormap }

Type declaration

optionalpan

pan?: Point2

optionalrenderingTools

renderingTools?: CPUFallbackRenderingTools

optionalrotation

rotation?: number

optionalscale

scale?: number

optionaltransform

optionalviewport

optionalzoom

zoom?: number

CPUFallbackLookupTable

CPUFallbackLookupTable:

build

build: (force: boolean) => void

Type declaration

    • (force: boolean): void
    • Parameters

      • force: boolean

      Returns void

getColor

getColor: (scalar: number) => Point4

Type declaration

    • Parameters

      • scalar: number

      Returns Point4

setAlphaRange

setAlphaRange: (start: number, end: number) => void

Type declaration

    • (start: number, end: number): void
    • Parameters

      • start: number
      • end: number

      Returns void

setHueRange

setHueRange: (start: number, end: number) => void

Type declaration

    • (start: number, end: number): void
    • Parameters

      • start: number
      • end: number

      Returns void

setNumberOfTableValues

setNumberOfTableValues: (number: number) => void

Type declaration

    • (number: number): void
    • Parameters

      • number: number

      Returns void

setRamp

setRamp: (ramp: string) => void

Type declaration

    • (ramp: string): void
    • Parameters

      • ramp: string

      Returns void

setRange

setRange: (start: number, end: number) => void

Type declaration

    • (start: number, end: number): void
    • Parameters

      • start: number
      • end: number

      Returns void

setSaturationRange

setSaturationRange: (start: number, end: number) => void

Type declaration

    • (start: number, end: number): void
    • Parameters

      • start: number
      • end: number

      Returns void

setTableRange

setTableRange: (start: number, end: number) => void

Type declaration

    • (start: number, end: number): void
    • Parameters

      • start: number
      • end: number

      Returns void

setValueRange

setValueRange: (start: number, end: number) => void

Type declaration

    • (start: number, end: number): void
    • Parameters

      • start: number
      • end: number

      Returns void

setTableValue

  • setTableValue(index: number, rgba: Point4): any
  • Parameters

    Returns any

CPUFallbackTransform

CPUFallbackTransform:

clone

Type declaration

getMatrix

getMatrix: () => TransformMatrix2D

Type declaration

invert

invert: () => void

Type declaration

    • (): void
    • Returns void

multiply

multiply: (matrix: TransformMatrix2D) => void

Type declaration

reset

reset: () => void

Type declaration

    • (): void
    • Returns void

rotate

rotate: (rad: number) => void

Type declaration

    • (rad: number): void
    • Parameters

      • rad: number

      Returns void

scale

scale: (sx: number, sy: number) => void

Type declaration

    • (sx: number, sy: number): void
    • Parameters

      • sx: number
      • sy: number

      Returns void

transformPoint

transformPoint: (point: Point2) => Point2

Type declaration

translate

translate: (x: number, y: number) => void

Type declaration

    • (x: number, y: number): void
    • Parameters

      • x: number
      • y: number

      Returns void

CustomEventType

CustomEventType<T>:

Type parameters

  • T = any

readonlydetail

detail: T

Returns any custom data event was created with. Typically used for synthetic events.

initCustomEvent

  • initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void
  • Parameters

    • typeArg: string
    • canBubbleArg: boolean
    • cancelableArg: boolean
    • detailArg: T

    Returns void

ICache

ICache:

getCacheSize

getCacheSize: () => number

Type declaration

    • (): number
    • Get the current cache size


      Returns number

getImageLoadObject

getImageLoadObject: (imageId: string) => void | IImageLoadObject

Type declaration

getMaxCacheSize

getMaxCacheSize: () => number

Type declaration

    • (): number
    • Get the maximum cache size


      Returns number

getVolumeLoadObject

getVolumeLoadObject: (volumeId: string) => void | IVolumeLoadObject

Type declaration

purgeCache

purgeCache: () => void

Type declaration

    • (): void
    • Purge cache both image and volume


      Returns void

putImageLoadObject

putImageLoadObject: (imageId: string, imageLoadObject: IImageLoadObject) => Promise<any>

Type declaration

    • Stores the imageLoad Object inside the cache


      Parameters

      Returns Promise<any>

putVolumeLoadObject

putVolumeLoadObject: (volumeId: string, volumeLoadObject: IVolumeLoadObject) => Promise<any>

Type declaration

    • Stores the volumeLoad Object inside the cache


      Parameters

      Returns Promise<any>

setMaxCacheSize

setMaxCacheSize: (maxCacheSize: number) => void

Type declaration

    • (maxCacheSize: number): void
    • Set the maximum cache size


      Parameters

      • maxCacheSize: number

      Returns void

ICachedImage

ICachedImage:

optionalimage

image?: IImage

imageId

imageId: string

imageLoadObject

imageLoadObject: IImageLoadObject

loaded

loaded: boolean

optionalsharedCacheKey

sharedCacheKey?: string

sizeInBytes

sizeInBytes: number

timeStamp

timeStamp: number

ICachedVolume

ICachedVolume:

loaded

loaded: boolean

sizeInBytes

sizeInBytes: number

timeStamp

timeStamp: number

optionalvolume

volume?: IImageVolume

volumeId

volumeId: string

volumeLoadObject

volumeLoadObject: IVolumeLoadObject

ICamera

ICamera:

Camera Interface. See https://kitware.github.io/vtk-examples/site/VTKBook/03Chapter3/#35-cameras if you want to know more about the camera.

optionalflipHorizontal

flipHorizontal?: boolean

flip Horizontal

optionalflipVertical

flipVertical?: boolean

flip Vertical

optionalfocalPoint

focalPoint?: Point3

Camera Focal point

optionalparallelProjection

parallelProjection?: boolean

Camera Parallel Projection flag - whether camera is using parallel projection

optionalparallelScale

parallelScale?: number

Camera parallel scale - used for parallel projection zoom, smaller values zoom in

optionalposition

position?: Point3

Camera position

optionalscale

scale?: number

Scale factor for the camera, it is the ratio of how much an image pixel takes up one screen pixel

optionalviewAngle

viewAngle?: number

Camera view angle - 90 degrees is orthographic

optionalviewPlaneNormal

viewPlaneNormal?: Point3

Camera viewPlaneNormal - negative of the direction the camera is pointing or directionOfProjection

optionalviewUp

viewUp?: Point3

Camera viewUp - the direction of viewUP in camera

IEnabledElement

IEnabledElement:

Cornerstone Enabled Element interface

FrameOfReferenceUID

FrameOfReferenceUID: string

FrameOfReference the enabledElement is rendering inside

renderingEngine

renderingEngine: default

Cornerstone Rendering Engine instance

renderingEngineId

renderingEngineId: string

Unique ID of the renderingEngine

viewport

viewport: default | default

Cornerstone Viewport instance - can be Stack or Volume Viewport as of now

viewportId

viewportId: string

Unique ID of the viewport in the renderingEngine

IImage

IImage:

Cornerstone Image interface, it is used for both CPU and GPU rendering

optionalcachedLut

cachedLut?: { invert?: boolean; lutArray?: Uint8ClampedArray; modalityLUT?: unknown; voiLUT?: CPUFallbackLUT; windowCenter?: number | number[]; windowWidth?: number | number[] }

CPU: image cached LUT


Type declaration

  • optionalinvert?: boolean
  • optionallutArray?: Uint8ClampedArray
  • optionalmodalityLUT?: unknown
  • optionalvoiLUT?: CPUFallbackLUT
  • optionalwindowCenter?: number | number[]
  • optionalwindowWidth?: number | number[]

color

color: boolean

is image a color image

optionalcolormap

CPU: custom color map for image

columnPixelSpacing

columnPixelSpacing: number

column pixel spacing

columns

columns: number

image number of columns

getCanvas

getCanvas: () => HTMLCanvasElement

Type declaration

    • (): HTMLCanvasElement
    • Returns HTMLCanvasElement

getPixelData

getPixelData: () => number[]

Type declaration

    • (): number[]
    • function that returns the pixelData as an array


      Returns number[]

height

height: number

image height

imageId

imageId: string

Image Id

intercept

intercept: number

intercept from metadata for scaling

invert

invert: boolean

whether image pixels are inverted in color

optionalisPreScaled

isPreScaled?: boolean

Whether the image is Pre-scaled during loading

maxPixelValue

maxPixelValue: number

minPixelValue

minPixelValue: number

minimum pixel value of the image

optionalmodalityLUT

modalityLUT?: CPUFallbackLUT

CPU: custom modality LUT for image

numComps

numComps: number

number of components in the image

optionalpreScale

preScale?: { scaled: boolean; scalingParameters: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number } }

preScale object


Type declaration

  • scaled: boolean

    boolean flag to indicate whether the image has been scaled

  • scalingParameters: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number }

    scaling parameters

    • optionalmodality?: string

      modality of the image

    • optionalrescaleIntercept?: number

      rescale intercept

    • optionalrescaleSlope?: number

      rescale slop

    • optionalsuvbw?: number

      PT suvbw

optionalrender

render?: (enabledElement: CPUFallbackEnabledElement, invalidated: boolean) => unknown

Type declaration

rgba

rgba: boolean

is image rgb and alpha

rowPixelSpacing

rowPixelSpacing: number

row pixel spacing

rows

rows: number

image number of rows

optionalscaling

scaling?: { PET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number } }

image scaling metadata - including PT suv values


Type declaration

  • optionalPET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number }
    • optionalSUVbsaFactor?: number
    • optionalSUVlbmFactor?: number
    • optionalsuvbwToSuvbsa?: number
    • optionalsuvbwToSuvlbm?: number

optionalsharedCacheKey

sharedCacheKey?: string

sizeInBytes

sizeInBytes: number

image size in number of bytes

optionalsliceThickness

sliceThickness?: number

slice thickness

slope

slope: number

slope from metadata for scaling

optionalstats

stats?: { lastGetPixelDataTime?: number; lastLutGenerateTime?: number; lastPutImageDataTime?: number; lastRenderTime?: number; lastRenderedViewport?: unknown; lastStoredPixelDataToCanvasImageDataTime?: number }

CPU: image statistics for rendering


Type declaration

  • optionallastGetPixelDataTime?: number
  • optionallastLutGenerateTime?: number
  • optionallastPutImageDataTime?: number
  • optionallastRenderTime?: number
  • optionallastRenderedViewport?: unknown
  • optionallastStoredPixelDataToCanvasImageDataTime?: number

optionalvoiLUT

CPU: custom VOI LUT for image

width

width: number

image width

windowCenter

windowCenter: number | number[]

windowCenter from metadata

windowWidth

windowWidth: number | number[]

windowWidth from metadata

IImageData

IImageData:

IImageData of an image, which stores actual scalarData and metaData about the image. IImageData is different from vtkImageData.

dimensions

dimensions: Point3

image dimensions

direction

direction: Mat3

image direction

optionalhasPixelSpacing

hasPixelSpacing?: boolean

whether the image has pixel spacing and it is not undefined

imageData

imageData: vtkImageData

vtkImageData object

metadata

metadata: { Modality: string }

image metadata - currently only modality


Type declaration

  • Modality: string

origin

origin: Point3

image origin

optionalpreScale

preScale?: { scaled?: boolean; scalingParameters?: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number } }

preScale object


Type declaration

  • optionalscaled?: boolean

    boolean flag to indicate whether the image has been scaled

  • optionalscalingParameters?: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number }

    scaling parameters

    • optionalmodality?: string

      modality of the image

    • optionalrescaleIntercept?: number

      rescale intercept

    • optionalrescaleSlope?: number

      rescale slop

    • optionalsuvbw?: number

      PT suvbw

scalarData

scalarData: Float32Array

image scalarData which stores the array of pixelData

optionalscaling

scaling?: Scaling

image scaling for scaling pixelArray

spacing

spacing: Point3

image spacing

IImageLoadObject

IImageLoadObject:

ImageLoadObject interface which any imageLoader should return

optionalcancelFn

cancelFn?: () => void

Type declaration

    • (): void
    • optional cancel function for loading


      Returns void

optionaldecache

decache?: () => void

Type declaration

    • (): void
    • optional decache function


      Returns void

promise

promise: Promise<IImage>

promise that resolves to an image

IImageVolume

IImageVolume:

Cornerstone ImageVolume interface. Todo: we should define new IVolume class with appropriate typings for the other types of volume that don’t have images (nrrd, nifti)

optionalconvertToCornerstoneImage

convertToCornerstoneImage?: (imageId: string, imageIdIndex: number) => IImageLoadObject

Type declaration

    • method to convert the volume data in the volume cache, to separate images in the image cache


      Parameters

      • imageId: string
      • imageIdIndex: number

      Returns IImageLoadObject

dimensions

dimensions: Point3

volume dimensions

direction

direction: Mat3

volume direction

hasPixelSpacing

hasPixelSpacing: boolean

whether the metadata for the pixel spacing is not undefined

optionalimageData

imageData?: vtkImageData

volume image data as vtkImageData

optionalimageIds

imageIds?: string[]

imageIds of the volume (if it is built of separate imageIds)

isPrescaled

isPrescaled: boolean

Whether preScaling has been performed on the volume

optionalloadStatus

loadStatus?: Record<string, any>

loading status object for the volume containing loaded/loading statuses

metadata

metadata: Metadata

volume metadata

numVoxels

numVoxels: number

number of voxels in the volume

origin

origin: Point3

volume origin - set to the imagePositionPatient of the last image in the volume

optionalreferencedVolumeId

referencedVolumeId?: string

volume referencedVolumeId (if it is derived from another volume)

scalarData

scalarData: any

volume scalar data

optionalscaling

scaling?: { PET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number } }

volume scaling metadata


Type declaration

  • optionalPET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number }
    • optionalSUVbsaFactor?: number
    • optionalSUVlbmFactor?: number
    • optionalsuvbwToSuvbsa?: number
    • optionalsuvbwToSuvlbm?: number

optionalsizeInBytes

sizeInBytes?: number

volume size in bytes

spacing

spacing: Point3

volume spacing

readonlyvolumeId

volumeId: string

unique identifier of the volume in the cache

vtkOpenGLTexture

vtkOpenGLTexture: any

openGL texture for the volume

IRegisterImageLoader

IRegisterImageLoader:

Register image loader interface

registerImageLoader

registerImageLoader: (scheme: string, imageLoader: ImageLoaderFn) => void

Type declaration

IRenderingEngine

IRenderingEngine:

hasBeenDestroyed

hasBeenDestroyed: boolean

id

id: string

offScreenCanvasContainer

offScreenCanvasContainer: any

offscreenMultiRenderWindow

offscreenMultiRenderWindow: any

_debugRender

  • _debugRender(): void
  • Returns void

destroy

  • destroy(): void
  • Returns void

disableElement

  • disableElement(viewportId: string): void
  • Parameters

    • viewportId: string

    Returns void

enableElement

fillCanvasWithBackgroundColor

  • fillCanvasWithBackgroundColor(canvas: HTMLCanvasElement, backgroundColor: [number, number, number]): void
  • Parameters

    • canvas: HTMLCanvasElement
    • backgroundColor: [number, number, number]

    Returns void

getStackViewports

getViewport

getViewports

getVolumeViewports

render

  • render(): void
  • Returns void

renderFrameOfReference

  • renderFrameOfReference(FrameOfReferenceUID: string): void
  • Parameters

    • FrameOfReferenceUID: string

    Returns void

renderViewport

  • renderViewport(viewportId: string): void
  • Parameters

    • viewportId: string

    Returns void

renderViewports

  • renderViewports(viewportIds: string[]): void
  • Parameters

    • viewportIds: string[]

    Returns void

resize

  • resize(immediate?: boolean, resetPan?: boolean, resetZoom?: boolean): void
  • Parameters

    • optionalimmediate: boolean
    • optionalresetPan: boolean
    • optionalresetZoom: boolean

    Returns void

setViewports

IStackViewport

IStackViewport:

Interface for Stack Viewport

_actors

_actors: Map<string, any>

actors rendered in the viewport

canvas

canvas: HTMLCanvasElement

canvas associated to the viewport

canvasToWorld

canvasToWorld: (canvasPos: Point2) => Point3

Type declaration

    • canvasToWorld Returns the world coordinates of the given canvasPos projected onto the plane defined by the Viewport‘s camera.


      Parameters

      Returns Point3

customRenderViewportToCanvas

customRenderViewportToCanvas: () => { canvas: HTMLCanvasElement; element: HTMLDivElement; renderingEngineId: string; viewportId: string }

Type declaration

    • (): { canvas: HTMLCanvasElement; element: HTMLDivElement; renderingEngineId: string; viewportId: string }
    • Custom rendering pipeline for the rendering for the CPU fallback


      Returns { canvas: HTMLCanvasElement; element: HTMLDivElement; renderingEngineId: string; viewportId: string }

      • canvas: HTMLCanvasElement
      • element: HTMLDivElement
      • renderingEngineId: string
      • viewportId: string

defaultOptions

defaultOptions: any

viewport default options including the axis, and background color

element

element: HTMLDivElement

public DOM element associated to the viewport

getCurrentImageId

getCurrentImageId: () => string

Type declaration

    • (): string
    • Returns the currently rendered imageId


      Returns string

getCurrentImageIdIndex

getCurrentImageIdIndex: () => number

Type declaration

    • (): number
    • Returns the index of the imageId being renderer


      Returns number

getFrameOfReferenceUID

getFrameOfReferenceUID: () => string

Type declaration

    • (): string
    • Returns the frame of reference UID, if the image doesn’t have imagePlaneModule metadata, it returns undefined, otherwise, frameOfReferenceUID is returned.


      Returns string

getImageIds

getImageIds: () => string[]

Type declaration

    • (): string[]
    • Returns the list of image Ids for the current viewport


      Returns string[]

getProperties

getProperties: () => StackViewportProperties

Type declaration

hasImageId

hasImageId: (imageId: string) => boolean

Type declaration

    • (imageId: string): boolean
    • Returns true if the viewport contains the imageId


      Parameters

      • imageId: string

      Returns boolean

hasImageURI

hasImageURI: (imageURI: string) => boolean

Type declaration

    • (imageURI: string): boolean
    • Returns true if the viewport contains the imageURI


      Parameters

      • imageURI: string

      Returns boolean

id

id: string

unique identifier of the viewport

modality

modality: string

options

viewport options

renderingEngineId

renderingEngineId: string

renderingEngineId the viewport belongs to

resize

resize: () => void

Type declaration

    • (): void
    • Resizes the viewport - only used in CPU fallback for StackViewport. The GPU resizing happens inside the RenderingEngine.


      Returns void

sHeight

sHeight: number

height of the viewport on the offscreen canvas (if rendering using GPU)

sWidth

sWidth: number

width of the viewport on the offscreen canvas (if rendering using GPU)

scaling

scaling: Scaling

Scaling parameters

suppressEvents

suppressEvents: boolean

Suppress events

sx

sx: number

sx of the viewport on the offscreen canvas (if rendering using GPU)

sy

sy: number

sy of the viewport on the offscreen canvas (if rendering using GPU)

type

viewport type, can be ORTHOGRAPHIC or STACK for now

worldToCanvas

worldToCanvas: (worldPos: Point3) => Point2

Type declaration

    • Returns the canvas coordinates of the given worldPos projected onto the Viewport‘s canvas.


      Parameters

      Returns Point2

_getCorners

  • _getCorners(bounds: number[]): number[][]
  • Parameters

    • bounds: number[]

    Returns number[][]

addActor

  • add one actor


    Parameters

    Returns void

addActors

  • add actors to the list of actors


    Parameters

    Returns void

calibrateSpacing

  • calibrateSpacing(imageId: string): void
  • Calibrates the image with new metadata that has been added for imageId. To calibrate a viewport, you should add your calibration data manually to calibratedPixelSpacingMetadataProvider and call viewport.calibrateSpacing for it get applied.


    Parameters

    • imageId: string

    Returns void

getActor

  • returns specific actor by its uid


    Parameters

    • actorUID: string

    Returns ActorEntry

getActorByIndex

  • returns specific actor by array index


    Parameters

    • index: number

    Returns ActorEntry

getActorUIDByIndex

  • getActorUIDByIndex(index: number): string
  • returns specific actor uid by array index


    Parameters

    • index: number

    Returns string

getActors

  • returns all the actor entires for a viewport which is an object containing actor and its uid


    Returns ActorEntry[]

getCamera

  • If the user has selected CPU rendering, return the CPU camera, otherwise return the default camera


    Returns ICamera

getCanvas

  • getCanvas(): HTMLCanvasElement
  • returns the canvas


    Returns HTMLCanvasElement

getDefaultActor

  • get the first actor


    Returns ActorEntry

getImageData

  • Returns the image and its properties that is being shown inside the stack viewport. It returns, the image dimensions, image direction, image scalar data, vtkImageData object, metadata, and scaling (e.g., PET suvbw)


    Returns IImageData | CPUIImageData

getPan

  • Gets the canvas pan value


    Returns Point2

getRenderer

  • getRenderer(): any
  • If the renderer is CPU based, throw an error. Otherwise, returns the vtkRenderer responsible for rendering the Viewport.


    Returns any

getRenderingEngine

  • getRenderingEngine(): any
  • returns the renderingEngine instance the viewport belongs to


    Returns any

getZoom

  • getZoom(): number
  • returns the parallel zoom relative to the default (eg returns 1 after reset)


    Returns number

removeAllActors

  • removeAllActors(): void
  • remove all actors from the viewport


    Returns void

render

  • render(): void
  • triggers render for all actors in the viewport


    Returns void

reset

  • reset(immediate: boolean): void
  • reset camera and options


    Parameters

    • immediate: boolean

    Returns void

resetCamera

  • resetCamera(resetPan?: boolean, resetZoom?: boolean): boolean
  • Centers Pan and resets the zoom for stack viewport.


    Parameters

    • optionalresetPan: boolean
    • optionalresetZoom: boolean

    Returns boolean

resetProperties

  • resetProperties(): void
  • Reset the viewport properties to the default values


    Returns void

setActors

  • set and overwrite actors in a viewport


    Parameters

    Returns void

setCamera

  • setCamera(cameraInterface: ICamera): void
  • Set the camera based on the provided camera object.


    Parameters

    Returns void

setColormap

  • Sets the colormap for the current viewport.


    Parameters

    Returns void

setImageIdIndex

  • setImageIdIndex(imageIdIndex: number): Promise<string>
  • Loads the image based on the provided imageIdIndex. It is an Async function which returns a promise that resolves to the imageId.


    Parameters

    • imageIdIndex: number

    Returns Promise<string>

setOptions

  • set options for the viewport


    Parameters

    Returns void

setPan

  • setPan(pan: Point2, storeAsInitialCamera?: boolean): any
  • Sets the canvas pan value


    Parameters

    • pan: Point2
    • optionalstoreAsInitialCamera: boolean

    Returns any

setProperties

  • Sets the properties for the viewport on the default actor. Properties include setting the VOI, inverting the colors and setting the interpolation type, rotation


    Parameters

    Returns void

setStack

  • setStack(imageIds: string[], currentImageIdIndex?: number): Promise<string>
  • Sets the imageIds to be visualized inside the stack viewport. It accepts list of imageIds, the index of the first imageId to be viewed. It is a asynchronous function that returns a promise resolving to imageId being displayed in the stack viewport.


    Parameters

    • imageIds: string[]
    • optionalcurrentImageIdIndex: number

    Returns Promise<string>

setZoom

  • setZoom(zoom: number, storeAsInitialCamera?: boolean): any
  • Sets the relative zoom - set to 1 to reset it


    Parameters

    • zoom: number
    • optionalstoreAsInitialCamera: boolean

    Returns any

unsetColormap

  • unsetColormap(): void
  • It sets the colormap to the default colormap.


    Returns void

IStreamingImageVolume

IStreamingImageVolume:

Cornerstone StreamingImageVolume which extends ImageVolume

dimensions

dimensions: Point3

Dimensions of the volume

direction

direction: Mat3

volume direction in world space

hasPixelSpacing

hasPixelSpacing: boolean

whether the metadata for the pixel spacing is not undefined

optionalimageData

imageData?: any

volume image data

optionalimageIds

imageIds?: string[]

optional image ids for the volume if it is made of separated images

isPrescaled

isPrescaled: boolean = false

Whether preScaling has been performed on the volume

optionalloadStatus

loadStatus?: Record<string, any>

load status object for the volume

metadata

metadata: Metadata

volume metadata

numVoxels

numVoxels: number

volume number of voxels

origin

origin: Point3

volume origin, Note this is an opinionated origin for the volume

optionalreferencedVolumeId

referencedVolumeId?: string

optional reference volume id if the volume is derived from another volume

scalarData

scalarData: Float32Array | Uint8Array

volume scalar data

optionalscaling

scaling?: { PET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number } }

volume scaling parameters if it contains scaled data


Type declaration

  • optionalPET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number }
    • optionalSUVbsaFactor?: number
    • optionalSUVlbmFactor?: number
    • optionalsuvbwToSuvbsa?: number
    • optionalsuvbwToSuvlbm?: number

optionalsizeInBytes

sizeInBytes?: number

volume size in bytes

spacing

spacing: Point3

volume spacing in 3d world space

readonlyvolumeId

volumeId: string

Read-only unique identifier for the volume

vtkOpenGLTexture

vtkOpenGLTexture: any

open gl texture for the volume

clearLoadCallbacks

  • clearLoadCallbacks(): void
  • method to load all the loading requests


    Returns void

convertToCornerstoneImage

  • convertToCornerstoneImage(imageId: string, imageIdIndex: number): any
  • method to convert the volume data in the volume cache, to separate images in the image cache


    Parameters

    • imageId: string
    • imageIdIndex: number

    Returns any

decache

  • decache(completelyRemove: boolean): void
  • method to decache the volume from cache


    Parameters

    • completelyRemove: boolean

    Returns void

IStreamingVolumeProperties

IStreamingVolumeProperties:

imageIds

imageIds: string[]

imageIds of the volume

loadStatus

loadStatus: { cachedFrames: boolean[]; callbacks: () => void[]; loaded: boolean; loading: boolean }

loading status object for the volume containing loaded/loading statuses


Type declaration

  • cachedFrames: boolean[]
  • callbacks: () => void[]
  • loaded: boolean
  • loading: boolean

IViewport

IViewport:

Viewport interface for cornerstone viewports

_actors

_actors: Map<string, any>

actors rendered in the viewport

canvas

canvas: HTMLCanvasElement

canvas associated to the viewport

canvasToWorld

canvasToWorld: (canvasPos: Point2) => Point3

Type declaration

customRenderViewportToCanvas

customRenderViewportToCanvas: () => unknown

Type declaration

    • (): unknown
    • whether the viewport has custom rendering


      Returns unknown

defaultOptions

defaultOptions: any

viewport default options including the axis, and background color

element

element: HTMLDivElement

public DOM element associated to the viewport

getFrameOfReferenceUID

getFrameOfReferenceUID: () => string

Type declaration

    • (): string
    • frameOfReferenceUID the viewport’s default actor is rendering


      Returns string

id

id: string

unique identifier of the viewport

options

viewport options

renderingEngineId

renderingEngineId: string

renderingEngineId the viewport belongs to

sHeight

sHeight: number

height of the viewport on the offscreen canvas (if rendering using GPU)

sWidth

sWidth: number

width of the viewport on the offscreen canvas (if rendering using GPU)

suppressEvents

suppressEvents: boolean

Suppress events

sx

sx: number

sx of the viewport on the offscreen canvas (if rendering using GPU)

sy

sy: number

sy of the viewport on the offscreen canvas (if rendering using GPU)

type

viewport type, can be ORTHOGRAPHIC or STACK for now

worldToCanvas

worldToCanvas: (worldPos: Point3) => Point2

Type declaration

_getCorners

  • _getCorners(bounds: number[]): number[][]
  • Parameters

    • bounds: number[]

    Returns number[][]

addActor

  • add one actor


    Parameters

    Returns void

addActors

  • add actors to the list of actors


    Parameters

    Returns void

getActor

  • returns specific actor by its uid


    Parameters

    • actorUID: string

    Returns ActorEntry

getActorByIndex

  • returns specific actor by array index


    Parameters

    • index: number

    Returns ActorEntry

getActorUIDByIndex

  • getActorUIDByIndex(index: number): string
  • returns specific actor uid by array index


    Parameters

    • index: number

    Returns string

getActors

  • returns all the actor entires for a viewport which is an object containing actor and its uid


    Returns ActorEntry[]

getCamera

  • returns camera object


    Returns ICamera

getCanvas

  • getCanvas(): HTMLCanvasElement
  • returns the canvas


    Returns HTMLCanvasElement

getDefaultActor

getPan

  • Gets the canvas pan value


    Returns Point2

getRenderer

  • getRenderer(): void
  • returns the vtkRenderer (for GPU rendering) of the viewport


    Returns void

getRenderingEngine

  • getRenderingEngine(): any
  • returns the renderingEngine instance the viewport belongs to


    Returns any

getZoom

  • getZoom(): number
  • returns the parallel zoom relative to the default (eg returns 1 after reset)


    Returns number

removeAllActors

  • removeAllActors(): void
  • remove all actors from the viewport


    Returns void

render

  • render(): void
  • triggers render for all actors in the viewport


    Returns void

reset

  • reset(immediate: boolean): void
  • reset camera and options


    Parameters

    • immediate: boolean

    Returns void

setActors

  • set and overwrite actors in a viewport


    Parameters

    Returns void

setCamera

  • setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void
  • sets the camera


    Parameters

    • cameraInterface: ICamera
    • optionalstoreAsInitialCamera: boolean

    Returns void

setOptions

setPan

  • setPan(pan: Point2, storeAsInitialCamera?: boolean): any
  • Sets the canvas pan value


    Parameters

    • pan: Point2
    • optionalstoreAsInitialCamera: boolean

    Returns any

setZoom

  • setZoom(zoom: number, storeAsInitialCamera?: boolean): any
  • Sets the relative zoom - set to 1 to reset it


    Parameters

    • zoom: number
    • optionalstoreAsInitialCamera: boolean

    Returns any

IViewportId

IViewportId:

Interface to uniquely define a viewport in cornerstone. Note: viewportIds can be shared between different rendering engines, but having a renderingEngineId and a viewportId is required to uniquely define a viewport.

renderingEngineId

renderingEngineId: string

viewportId

viewportId: string

IVolume

IVolume:

Cornerstone ImageVolume interface.

dimensions

dimensions: Point3

volume dimensions

direction

direction: Mat3

volume direction

optionalimageData

imageData?: vtkImageData

volume image data as vtkImageData

metadata

metadata: Metadata

volume metadata

origin

origin: Point3

volume origin

optionalreferencedVolumeId

referencedVolumeId?: string

referencedVolumeId if volume is derived from another volume

scalarData

scalarData: Float32Array | Uint8Array

volume scalarData

optionalscaling

scaling?: { PET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number } }

volume scaling metadata


Type declaration

  • optionalPET?: { SUVbsaFactor?: number; SUVlbmFactor?: number; suvbwToSuvbsa?: number; suvbwToSuvlbm?: number }
    • optionalSUVbsaFactor?: number
    • optionalSUVlbmFactor?: number
    • optionalsuvbwToSuvbsa?: number
    • optionalsuvbwToSuvlbm?: number

optionalsizeInBytes

sizeInBytes?: number

volume size in bytes

spacing

spacing: Point3

volume spacing

volumeId

volumeId: string

unique identifier for the volume in the cache

IVolumeInput

IVolumeInput:

VolumeInput that can be used to add a volume to a viewport. It includes mandatory volumeId but other options such as visibility, blendMode, slabThickness and callback can also be provided

optionalactorUID

actorUID?: string

optionalblendMode

blendMode?: BlendModes

Blend mode of the volume - by default it is additive

optionalcallback

Callback to be called when the volume is added to the viewport

optionalslabThickness

slabThickness?: number

Slab thickness of the volume - by default it is 0.05

optionalvisibility

visibility?: boolean

Visibility of the volume - by default it is true

volumeId

volumeId: string

Volume ID of the volume in the cache

IVolumeLoadObject

IVolumeLoadObject:

VolumeLoadObject interface which any volumeLoader should return

optionalcancelFn

cancelFn?: () => void

Type declaration

    • (): void
    • optional cancel function for loading


      Returns void

optionaldecache

decache?: () => void

Type declaration

    • (): void
    • optional decache function


      Returns void

promise

promise: Promise<ImageVolume>

promise that resolves to an ImageVolume

IVolumeViewport

IVolumeViewport:

Interface for the Volume Viewport

_actors

_actors: Map<string, any>

actors rendered in the viewport

canvas

canvas: HTMLCanvasElement

canvas associated to the viewport

canvasToWorld

canvasToWorld: (canvasPos: Point2) => Point3

Type declaration

    • canvasToWorld Returns the world coordinates of the given canvasPos projected onto the plane defined by the Viewport‘s vtkCamera‘s focal point and the direction of projection.


      Parameters

      Returns Point3

customRenderViewportToCanvas

customRenderViewportToCanvas: () => unknown

Type declaration

    • (): unknown
    • whether the viewport has custom rendering


      Returns unknown

defaultOptions

defaultOptions: any

viewport default options including the axis, and background color

element

element: HTMLDivElement

public DOM element associated to the viewport

getCurrentImageId

getCurrentImageId: () => string

Type declaration

    • (): string
    • Uses viewport camera and volume actor to decide if the viewport is looking at the volume in the direction of acquisition (imageIds). If so, it uses the origin and focalPoint to find which imageId is currently being viewed.


      Returns string

getCurrentImageIdIndex

getCurrentImageIdIndex: () => number

Type declaration

    • (): number
    • Uses viewport camera and volume actor to decide if the viewport is looking at the volume in the direction of acquisition (imageIds). If so, it uses the origin and focalPoint to calculate the slice index.


      Returns number

getFrameOfReferenceUID

getFrameOfReferenceUID: () => string

Type declaration

    • (): string
    • Returns string

getProperties

getProperties: () => any

Type declaration

    • (): any
    • Returns any

hasImageURI

hasImageURI: (imageURI: string) => boolean

Type declaration

    • (imageURI: string): boolean
    • if the volume viewport has imageURI (no loader schema) in one of its volume actors


      Parameters

      • imageURI: string

      Returns boolean

hasVolumeId

hasVolumeId: (volumeId: string) => boolean

Type declaration

    • (volumeId: string): boolean
    • Checks if the viewport has a volume actor with the given volumeId


      Parameters

      • volumeId: string

      Returns boolean

id

id: string

unique identifier of the viewport

options

viewport options

renderingEngineId

renderingEngineId: string

renderingEngineId the viewport belongs to

sHeight

sHeight: number

height of the viewport on the offscreen canvas (if rendering using GPU)

sWidth

sWidth: number

width of the viewport on the offscreen canvas (if rendering using GPU)

suppressEvents

suppressEvents: boolean

Suppress events

sx

sx: number

sx of the viewport on the offscreen canvas (if rendering using GPU)

sy

sy: number

sy of the viewport on the offscreen canvas (if rendering using GPU)

type

viewport type, can be ORTHOGRAPHIC or STACK for now

useCPURendering

useCPURendering: boolean

worldToCanvas

worldToCanvas: (worldPos: Point3) => Point2

Type declaration

    • Returns the canvas coordinates of the given worldPos projected onto the Viewport‘s canvas.


      Parameters

      Returns Point2

_getCorners

  • _getCorners(bounds: number[]): number[][]
  • Parameters

    • bounds: number[]

    Returns number[][]

addActor

  • add one actor


    Parameters

    Returns void

addActors

  • add actors to the list of actors


    Parameters

    Returns void

addVolumes

  • addVolumes(volumeInputArray: IVolumeInput[], immediate?: boolean, suppressEvents?: boolean): Promise<void>
  • Creates and adds volume actors for all volumes defined in the volumeInputArray. For each entry, if a callback is supplied, it will be called with the new volume actor as input.


    Parameters

    • volumeInputArray: IVolumeInput[]
    • optionalimmediate: boolean
    • optionalsuppressEvents: boolean

    Returns Promise<void>

flip

  • Flip the viewport along the desired axis


    Parameters

    Returns void

getActor

  • returns specific actor by its uid


    Parameters

    • actorUID: string

    Returns ActorEntry

getActorByIndex

  • returns specific actor by array index


    Parameters

    • index: number

    Returns ActorEntry

getActorUIDByIndex

  • getActorUIDByIndex(index: number): string
  • returns specific actor uid by array index


    Parameters

    • index: number

    Returns string

getActors

  • returns all the actor entires for a viewport which is an object containing actor and its uid


    Returns ActorEntry[]

getBounds

  • getBounds(): any
  • getBounds gets the visible bounds of the viewport


    Returns any

getCamera

  • returns camera object


    Returns ICamera

getCanvas

  • getCanvas(): HTMLCanvasElement
  • returns the canvas


    Returns HTMLCanvasElement

getDefaultActor

  • get the first actor


    Returns ActorEntry

getImageData

  • Returns the image and its properties that is being shown inside the stack viewport. It returns, the image dimensions, image direction, image scalar data, vtkImageData object, metadata, and scaling (e.g., PET suvbw) Note: since the volume viewport supports fusion, to get the image data for a specific volume, use the optional volumeId argument.


    Parameters

    • optionalvolumeId: string

    Returns IImageData

getIntensityFromWorld

  • getIntensityFromWorld(point: Point3): number
  • Given a point in world coordinates, return the intensity at that point


    Parameters

    Returns number

getPan

  • Gets the canvas pan value


    Returns Point2

getRenderer

  • getRenderer(): void
  • returns the vtkRenderer (for GPU rendering) of the viewport


    Returns void

getRenderingEngine

  • getRenderingEngine(): any
  • returns the renderingEngine instance the viewport belongs to


    Returns any

getSlabThickness

  • getSlabThickness(): number
  • Gets the slab thickness option in the Viewport‘s options.


    Returns number

getZoom

  • getZoom(): number
  • returns the parallel zoom relative to the default (eg returns 1 after reset)


    Returns number

removeAllActors

  • removeAllActors(): void
  • remove all actors from the viewport


    Returns void

removeVolumeActors

  • removeVolumeActors(actorUIDs: string[], immediate?: boolean): void
  • It removes the volume actor from the Viewport. If the volume actor is not in the viewport, it does nothing.


    Parameters

    • actorUIDs: string[]
    • optionalimmediate: boolean

    Returns void

render

  • render(): void
  • triggers render for all actors in the viewport


    Returns void

reset

  • reset(immediate: boolean): void
  • reset camera and options


    Parameters

    • immediate: boolean

    Returns void

resetCamera

  • resetCamera(resetPan?: boolean, resetZoom?: boolean): boolean
  • Reset the camera for the volume viewport


    Parameters

    • optionalresetPan: boolean
    • optionalresetZoom: boolean

    Returns boolean

setActors

  • set and overwrite actors in a viewport


    Parameters

    Returns void

setBlendMode

  • setBlendMode(blendMode: BlendModes, filterActorUIDs?: string[], immediate?: boolean): void
  • Sets the blendMode for actors of the viewport.


    Parameters

    • blendMode: BlendModes
    • optionalfilterActorUIDs: string[]
    • optionalimmediate: boolean

    Returns void

setCamera

  • setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void
  • sets the camera


    Parameters

    • cameraInterface: ICamera
    • optionalstoreAsInitialCamera: boolean

    Returns void

setOptions

  • set options for the viewport


    Parameters

    Returns void

setOrientation

setPan

  • setPan(pan: Point2, storeAsInitialCamera?: boolean): any
  • Sets the canvas pan value


    Parameters

    • pan: Point2
    • optionalstoreAsInitialCamera: boolean

    Returns any

setProperties

  • Sets the properties for the viewport. If no volumeId is provided it applies the properties to the default volume actor (first volume)


    Parameters

    Returns void

setSlabThickness

  • setSlabThickness(slabThickness: number, filterActorUIDs?: string[]): void
  • Sets the slab thickness for actors of the viewport.


    Parameters

    • slabThickness: number
    • optionalfilterActorUIDs: string[]

    Returns void

setVolumes

  • setVolumes(volumeInputArray: IVolumeInput[], immediate?: boolean, suppressEvents?: boolean): Promise<void>
  • Creates volume actors for all volumes defined in the volumeInputArray. For each entry, if a callback is supplied, it will be called with the new volume actor as input. For each entry, if a blendMode and/or slabThickness is defined, this will be set on the actor’s VolumeMapper.


    Parameters

    • volumeInputArray: IVolumeInput[]
    • optionalimmediate: boolean
    • optionalsuppressEvents: boolean

    Returns Promise<void>

setZoom

  • setZoom(zoom: number, storeAsInitialCamera?: boolean): any
  • Sets the relative zoom - set to 1 to reset it


    Parameters

    • zoom: number
    • optionalstoreAsInitialCamera: boolean

    Returns any

Type Aliases

Actor

Actor: vtkActor

ActorEntry

ActorEntry: { actor: Actor | VolumeActor | ImageActor; slabThickness?: number; uid: string }

Cornerstone Actor Entry including actor uid, actual Actor, and slabThickness for the actor. ActorEntry is the object that is retrieved from viewport when calling viewport.getActor(s)


Type declaration

  • actor: Actor | VolumeActor | ImageActor
  • optionalslabThickness?: number
  • uid: string

ActorSliceRange

ActorSliceRange: { actor: VolumeActor; current: number; focalPoint: Point3; max: number; min: number; viewPlaneNormal: Point3 }

Object containing the min, max and current position in the normal direction for the actor


Type declaration

CPUFallbackColormapData

CPUFallbackColormapData: { colors?: Point4[]; gamma?: number; name: string; numColors?: number; numOfColors?: number; segmentedData?: unknown }

Type declaration

  • optionalcolors?: Point4[]
  • optionalgamma?: number
  • name: string
  • optionalnumColors?: number
  • optionalnumOfColors?: number
  • optionalsegmentedData?: unknown

CPUFallbackColormapsData

CPUFallbackColormapsData: {}

Type declaration

CPUFallbackLUT

CPUFallbackLUT: { lut: number[] }

Type declaration

  • lut: number[]

CPUFallbackRenderingTools

CPUFallbackRenderingTools: { colorLUT?: CPUFallbackLookupTable; colormapId?: string; lastRenderedImageId?: string; lastRenderedIsColor?: boolean; lastRenderedViewport?: { colormap: unknown; hflip: boolean; invert: boolean; modalityLUT: CPUFallbackLUT; rotation: number; vflip: boolean; voiLUT: CPUFallbackLUT; windowCenter: number | number[]; windowWidth: number | number[] }; renderCanvas?: HTMLCanvasElement; renderCanvasContext?: CanvasRenderingContext2D; renderCanvasData?: ImageData }

Type declaration

  • optionalcolorLUT?: CPUFallbackLookupTable
  • optionalcolormapId?: string
  • optionallastRenderedImageId?: string
  • optionallastRenderedIsColor?: boolean
  • optionallastRenderedViewport?: { colormap: unknown; hflip: boolean; invert: boolean; modalityLUT: CPUFallbackLUT; rotation: number; vflip: boolean; voiLUT: CPUFallbackLUT; windowCenter: number | number[]; windowWidth: number | number[] }
    • colormap: unknown
    • hflip: boolean
    • invert: boolean
    • modalityLUT: CPUFallbackLUT
    • rotation: number
    • vflip: boolean
    • voiLUT: CPUFallbackLUT
    • windowCenter: number | number[]
    • windowWidth: number | number[]
  • optionalrenderCanvas?: HTMLCanvasElement
  • optionalrenderCanvasContext?: CanvasRenderingContext2D
  • optionalrenderCanvasData?: ImageData

CPUFallbackViewport

CPUFallbackViewport: { colormap?: CPUFallbackColormap; displayedArea?: CPUFallbackViewportDisplayedArea; focalPoint?: number[]; hflip?: boolean; invert?: boolean; modality?: string; modalityLUT?: CPUFallbackLUT; parallelScale?: number; pixelReplication?: boolean; rotation?: number; scale?: number; translation?: { x: number; y: number }; vflip?: boolean; voi?: { windowCenter: number; windowWidth: number }; voiLUT?: CPUFallbackLUT }

Type declaration

  • optionalcolormap?: CPUFallbackColormap
  • optionaldisplayedArea?: CPUFallbackViewportDisplayedArea
  • optionalfocalPoint?: number[]
  • optionalhflip?: boolean
  • optionalinvert?: boolean
  • optionalmodality?: string
  • optionalmodalityLUT?: CPUFallbackLUT
  • optionalparallelScale?: number
  • optionalpixelReplication?: boolean
  • optionalrotation?: number
  • optionalscale?: number
  • optionaltranslation?: { x: number; y: number }
    • x: number
    • y: number
  • optionalvflip?: boolean
  • optionalvoi?: { windowCenter: number; windowWidth: number }
    • windowCenter: number
    • windowWidth: number
  • optionalvoiLUT?: CPUFallbackLUT

CPUFallbackViewportDisplayedArea

CPUFallbackViewportDisplayedArea: { brhc: { x: number; y: number }; columnPixelSpacing: number; presentationSizeMode: string; rowPixelSpacing: number; tlhc: { x: number; y: number } }

Type declaration

  • brhc: { x: number; y: number }
    • x: number
    • y: number
  • columnPixelSpacing: number
  • presentationSizeMode: string
  • rowPixelSpacing: number
  • tlhc: { x: number; y: number }
    • x: number
    • y: number

CPUIImageData

CPUIImageData: { dimensions: Point3; direction: Mat3; hasPixelSpacing?: boolean; imageData: CPUImageData; metadata: { Modality: string }; origin: Point3; preScale?: { scaled?: boolean; scalingParameters?: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number } }; scalarData: number[]; scaling: Scaling; spacing: Point3 }

Type declaration

  • dimensions: Point3
  • direction: Mat3
  • optionalhasPixelSpacing?: boolean

    whether the image has pixel spacing and it is not undefined

  • imageData: CPUImageData
  • metadata: { Modality: string }
    • Modality: string
  • origin: Point3
  • optionalpreScale?: { scaled?: boolean; scalingParameters?: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number } }

    preScale object

    • optionalscaled?: boolean

      boolean flag to indicate whether the image has been scaled

    • optionalscalingParameters?: { modality?: string; rescaleIntercept?: number; rescaleSlope?: number; suvbw?: number }

      scaling parameters

      • optionalmodality?: string

        modality of the image

      • optionalrescaleIntercept?: number

        rescale intercept

      • optionalrescaleSlope?: number

        rescale slop

      • optionalsuvbw?: number

        PT suvbw

  • scalarData: number[]
  • scaling: Scaling
  • spacing: Point3

CPUImageData

CPUImageData: { getDimensions?: () => Point3; getDirection?: () => Mat3; getIndexToWorld?: () => Point3; getScalarData?: () => number[]; getSpacing?: () => Point3; getWorldToIndex?: () => Point3; indexToWorld?: (point: Point3) => Point3; worldToIndex?: (point: Point3) => Point3 }

Type declaration

FlipDirection

FlipDirection: { flipHorizontal?: boolean; flipVertical?: boolean }

Flip direction which can be horizontal or vertical.


Type declaration

  • optionalflipHorizontal?: boolean
  • optionalflipVertical?: boolean

ImageLoaderFn

ImageLoaderFn: (imageId: string, options?: Record<string, any>) => { cancelFn?: () => void | undefined; decache?: () => void | undefined; promise: Promise<Record<string, any>> }

Type declaration

    • (imageId: string, options?: Record<string, any>): { cancelFn?: () => void | undefined; decache?: () => void | undefined; promise: Promise<Record<string, any>> }
    • Any imageLoader function should implement a loading given the imageId and returns a mandatory promise which will resolve to the loaded image object. Additional cancelFn and decache can be implemented.


      Parameters

      • imageId: string
      • optionaloptions: Record<string, any>

      Returns { cancelFn?: () => void | undefined; decache?: () => void | undefined; promise: Promise<Record<string, any>> }

      • optionalcancelFn?: () => void | undefined
          • (): void | undefined
          • Returns void | undefined

      • optionaldecache?: () => void | undefined
          • (): void | undefined
          • Returns void | undefined

      • promise: Promise<Record<string, any>>

        Promise that resolves to the image object

ImageSliceData

ImageSliceData: { imageIndex: number; numberOfSlices: number }

Type declaration

  • imageIndex: number
  • numberOfSlices: number

Mat3

Mat3: [number, number, number, number, number, number, number, number, number]

This represents a 3x3 matrix of numbers

Metadata

Metadata: { BitsAllocated: number; BitsStored: number; Columns: number; FrameOfReferenceUID: string; HighBit: number; ImageOrientationPatient: number[]; Modality: string; PhotometricInterpretation: string; PixelRepresentation: number; PixelSpacing: number[]; Rows: number; SamplesPerPixel: number; SeriesInstanceUID?: string; voiLut: VOI[] }

Type declaration

  • BitsAllocated: number

    Number of bits allocated for each pixel sample. Each sample shall have the same number of bits allocated

  • BitsStored: number

    Number of bits stored for each pixel sample

  • Columns: number

    Number of columns in the image.

  • FrameOfReferenceUID: string

    Uniquely identifies the Frame of Reference for a Series

  • HighBit: number

    Most significant bit for pixel sample data

  • ImageOrientationPatient: number[]

    The direction cosines of the first row and the first column with respect to the patient

  • Modality: string

    Image Modality

  • PhotometricInterpretation: string

    Specifies the intended interpretation of the pixel data

  • PixelRepresentation: number

    Data representation of the pixel samples.

  • PixelSpacing: number[]

    Physical distance in the patient between the center of each pixel

  • Rows: number

    Number of rows in the image.

  • SamplesPerPixel: number
  • optionalSeriesInstanceUID?: string

    SeriesInstanceUID of the volume

  • voiLut: VOI[]

    Window Level/Center for the image

OrientationVectors

OrientationVectors: { viewPlaneNormal: Point3; viewUp: Point3 }
  • viewUp - An array of three floating point numbers describing a vector that represents the up direction for the view.
  • viewPlaneNormal - The direction of the projection

see Axial vs Sagittal vs Coronal see Rendering_Core_Camera

@example
renderingEngine.setViewports([
{
viewportId: 'a-viewport-uid',
type: ViewportType.ORTHOGRAPHIC,
element: document.querySelector('div'),
defaultOptions: {
orientation: {
viewUp: [0, 0, 1],
viewPlaneNormal: [1, 0, 0],
},
background: [1, 0, 0],
},
}]);

Type declaration

  • viewPlaneNormal: Point3

    Slice Normal for the viewport - the normal that points in the opposite direction of the slice normal out of screen and is negative of direction of projection

  • viewUp: Point3

    viewUp direction for the viewport - the vector that points from bottom to top of the viewport

PTScaling

PTScaling: { suvbwToSuvbsa?: number; suvbwToSuvlbm?: number }

Type declaration

  • optionalsuvbwToSuvbsa?: number

    suv body weight to suv body surface area

  • optionalsuvbwToSuvlbm?: number

    suv body weight to suv lean body mass

Plane

Plane: [number, number, number, number]

Plane equation Ax+By+Cz=D, plane is defined by [A, B, C, D]

Point2

Point2: [number, number]

This duplicates the typing established in gl-matrix for a vec2

Point3

Point3: [number, number, number]

This duplicates the typing established in gl-matrix for a vec3

Point4

Point4: [number, number, number, number]

This represents a 4-vector or RGBA value.

PublicViewportInput

PublicViewportInput: { defaultOptions?: ViewportInputOptions; element: HTMLDivElement; type: ViewportType; viewportId: string }

Public Interface for viewport input to get enabled/disabled or set


Type declaration

  • optionaldefaultOptions?: ViewportInputOptions

    options for the viewport

  • element: HTMLDivElement

    HTML element in the DOM

  • type: ViewportType

    type of the viewport

  • viewportId: string

    unique id for the viewport in the renderingEngine

Scaling

Scaling: { PET?: PTScaling }

Type declaration

ScalingParameters

ScalingParameters: { modality: string; rescaleIntercept: number; rescaleSlope: number; suvbsa?: number; suvbw?: number; suvlbm?: number }

Type declaration

  • modality: string

    modality

  • rescaleIntercept: number

    b in m*p+b which specifies the offset of the transformation

  • rescaleSlope: number

    m in m*p+b which specifies the linear transformation from stored pixels to memory value

  • optionalsuvbsa?: number

    SUV body surface area

  • optionalsuvbw?: number

    SUV body weight

  • optionalsuvlbm?: number

    SUV lean body mass

StackViewportProperties

StackViewportProperties: { interpolationType?: InterpolationType; invert?: boolean; rotation?: number; suppressEvents?: boolean; voiRange?: VOIRange }

Stack Viewport Properties


Type declaration

  • optionalinterpolationType?: InterpolationType

    interpolation type - linear or nearest neighbor

  • optionalinvert?: boolean

    invert flag - whether the image is inverted

  • optionalrotation?: number

    image rotation

  • optionalsuppressEvents?: boolean

    suppress events (optional)

  • optionalvoiRange?: VOIRange

    voi range (upper, lower) for the viewport

TransformMatrix2D

TransformMatrix2D: [number, number, number, number, number, number]

used for CPU rendering

VOI

VOI: { windowCenter: number; windowWidth: number }

Type declaration

  • windowCenter: number

    Window Center for display

  • windowWidth: number

    Window Width for display

VOIRange

VOIRange: { lower: number; upper: number }

Type declaration

  • lower: number

    lower value for display

  • upper: number

    upper value for display

ViewportInputOptions

ViewportInputOptions: { background?: [number, number, number]; orientation?: OrientationAxis | OrientationVectors; suppressEvents?: boolean }

This type defines the shape of viewport input options, so we can throw when it is incorrect.


Type declaration

  • optionalbackground?: [number, number, number]

    background color

  • optionalorientation?: OrientationAxis | OrientationVectors

    orientation of the viewport which can be either an Enum for axis Enums.OrientationAxis.[AXIAL|SAGITTAL|CORONAL|DEFAULT] or an object with viewPlaneNormal and viewUp

  • optionalsuppressEvents?: boolean

    whether the events should be suppressed and not fired

VolumeActor

VolumeActor: vtkVolume

VolumeInputCallback

VolumeInputCallback: (params: { volumeActor: VolumeActor; volumeId: string }) => unknown

Type declaration

    • (params: { volumeActor: VolumeActor; volumeId: string }): unknown
    • Volume input callback type, used to perform operations on the volume data after it has been loaded.


      Parameters

      Returns unknown

VolumeLoaderFn

VolumeLoaderFn: (volumeId: string, options?: Record<string, any>) => { cancelFn?: () => void | undefined; decache?: () => void | undefined; promise: Promise<Record<string, any>> }

Type declaration

    • (volumeId: string, options?: Record<string, any>): { cancelFn?: () => void | undefined; decache?: () => void | undefined; promise: Promise<Record<string, any>> }
    • Any volumeLoader function should implement a loading given the volumeId and returns a mandatory promise which will resolve to the loaded volume object. Additional cancelFn and decache can be implemented.


      Parameters

      • volumeId: string
      • optionaloptions: Record<string, any>

      Returns { cancelFn?: () => void | undefined; decache?: () => void | undefined; promise: Promise<Record<string, any>> }

      • optionalcancelFn?: () => void | undefined
          • (): void | undefined
          • cancel function


            Returns void | undefined

      • optionaldecache?: () => void | undefined
          • (): void | undefined
          • decache function


            Returns void | undefined

      • promise: Promise<Record<string, any>>

        promise that resolves to the volume object

VolumeViewportProperties

VolumeViewportProperties: { voiRange?: VOIRange }

Stack Viewport Properties


Type declaration

  • optionalvoiRange?: VOIRange

    voi range (upper, lower) for the viewport