Class: IStackViewport
An object representing a single stack viewport, which is a camera
looking into an internal viewport, and an associated target output canvas.
StackViewports can be rendered using both GPU and a fallback CPU is the GPU is not available (or low performance). Read more about StackViewports in the documentation section of this website.
Extends
Constructors
new IStackViewport()
new IStackViewport(
props):IStackViewport
Constructor for the StackViewport class
Parameters
• props: ViewportInput
ViewportInput
Returns
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:210
Properties
_actors
_actors:
Map<string,ActorEntry>
a Map containing the actor uid and actors
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:124
_suppressCameraModifiedEvents
_suppressCameraModifiedEvents:
boolean=false
informs if a new actor was added before a resetCameraClippingRange phase
Inherited from
Viewport._suppressCameraModifiedEvents
Defined in
packages/core/src/RenderingEngine/Viewport.ts:130
addActor()
addActor: (
actorEntry) =>void
If the renderer is CPU based, throw an error. Otherwise, add the actor to the viewport
Parameters
• actorEntry: ActorEntry
The ActorEntry object that was created by the user.
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:413
addActors()
addActors: (
actors) =>void
If the renderer is CPU based, throw an error. Otherwise, add a list of actors to the viewport
Parameters
• actors: ActorEntry[]
An array of ActorEntry objects.
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:405
calibration
protectedcalibration:IImageCalibration
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:134
canvas
readonlycanvas:HTMLCanvasElement
an internal canvas that is created on the provided HTML element
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:94
canvasToWorld()
canvasToWorld: (
canvasPos) =>Point3
canvasToWorld Returns the world coordinates of the given canvasPos
projected onto the plane defined by the Viewport's camera.
Parameters
• canvasPos: Point2
The position in canvas coordinates.
Returns
The corresponding world coordinates.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:363
defaultOptions
readonlydefaultOptions:ViewportInputOptions
Default options for the viewport which includes orientation, viewPlaneNormal and backgroundColor
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:126
element
readonlyelement:HTMLDivElement
HTML element in DOM that is used for rendering the viewport
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:92
fitToCanvasCamera
protectedfitToCanvasCamera:ICamera
The camera that is defined for resetting displayArea to ensure absolute displayArea settings
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:142
flipHorizontal
protectedflipHorizontal:boolean=false
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:107
flipVertical
protectedflipVertical:boolean=false
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:108
getActor()
getActor: (
actorUID) =>ActorEntry
If the renderer is CPU based, throw an error. Otherwise, it returns the actor entry for the given actor UID.
Parameters
• actorUID: string
The unique ID of the actor you want to get.
Returns
An ActorEntry object.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:392
getActors()
getActors: () =>
ActorEntry[]
If the renderer is CPU based, throw an error. Otherwise, return the actors in the viewport
Returns
An array of ActorEntry objects.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:386
getCamera()
getCamera: () =>
ICamera
If the user has selected CPU rendering, return the CPU camera, otherwise return the default camera
Returns
The camera object.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:319
getDefaultActor()
getDefaultActor: () =>
ActorEntry
If the renderer is CPU based, throw an error. Otherwise, return the default actor which is the first actor in the renderer.
Returns
An actor entry.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:380
getImageData()
getImageData: () =>
IImageData|CPUIImageData
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: dimensions, direction, scalarData, vtkImageData, metadata, scaling
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:312
getRotation()
getRotation: () =>
number
Returns
number
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:331
hasPixelSpacing
protectedhasPixelSpacing:boolean=true
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:133
id
readonlyid:string
unique identifier for the viewport
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:90
imagesLoader
protectedimagesLoader:IImagesLoader
The progressive retrieval configuration used for this viewport.
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:160
initialCamera
protectedinitialCamera:ICamera
The camera that is initially defined on the reset for the relative pan/zoom
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:138
insetImageMultiplier
protectedinsetImageMultiplier:number
The amount by which the images are inset in a viewport by default.
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:102
isDisabled
isDisabled:
boolean
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:109
modality
modality:
string
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:195
options
options:
ViewportInputOptions
options for the viewport which includes orientation axis, backgroundColor and displayArea
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:128
removeAllActors()
removeAllActors: () =>
void
It throws an error if the renderer is CPU based. Otherwise, it removes the actors from the viewport.
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:418
renderingEngineId
readonlyrenderingEngineId:string
RenderingEngine id that the viewport belongs to
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:96
resetCamera()
resetCamera: (
options?) =>boolean
Resets the camera for the stack viewport. This method adjusts the camera to fit the image in the viewport, potentially resetting pan, zoom, and other view parameters.
Parameters
• options?
Optional configuration for the reset operation
• options.resetPan?: boolean
Whether to reset the pan (default: true)
• options.resetToCenter?: boolean
• options.resetZoom?: boolean
Whether to reset the zoom (default: true)
• options.suppressEvents?: boolean
Returns
boolean
boolean - True if the camera was reset successfully, false otherwise
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:348
scaling
scaling:
Scaling
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:196
setActors()
setActors: (
actors) =>void
If the renderer is CPU-based, throw an error; otherwise, set the actors in the viewport.
Parameters
• actors: ActorEntry[]
An array of ActorEntry objects.
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:399
setCamera()
setCamera: (
cameraInterface,storeAsInitialCamera?) =>void
Set the camera based on the provided camera object.
Parameters
• cameraInterface: ICamera
The camera interface that will be used to render the scene.
• storeAsInitialCamera?: boolean
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:326
setInterpolationType()
protectedsetInterpolationType: (interpolationType) =>void
Sets the interpolation type. No-op in the base.
Parameters
• interpolationType: InterpolationType
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:422
sHeight
sHeight:
number
sHeight of viewport on the offscreen canvas
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:122
stackActorReInitialized
stackActorReInitialized:
boolean
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:204
suppressEvents
readonlysuppressEvents:boolean
A flag representing if viewport methods should fire events or not
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:132
sWidth
sWidth:
number
sWidth of viewport on the offscreen canvas
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:120
sx
sx:
number
sx of viewport on the offscreen canvas
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:116
sy
sy:
number
sy of viewport on the offscreen canvas
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:118
type
readonlytype:ViewportType
Type of viewport
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:98
unsetColormap()
unsetColormap: () =>
void
It sets the colormap to the default colormap.
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:336
viewportStatus
viewportStatus:
ViewportStatus=ViewportStatus.NO_DATA
Record the rendering status, mostly for testing purposes, but can also be useful for knowing things like whether the viewport is initialized
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:113
worldToCanvas()
worldToCanvas: (
worldPos) =>Point2
Returns the canvas coordinates of the given worldPos
projected onto the Viewport's canvas.
Parameters
• worldPos: Point3
The position in world coordinates.
Returns
The corresponding canvas coordinates.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:373
CameraViewPresentation
readonlystaticCameraViewPresentation:ViewPresentationSelector
CameraViewPresentation is a view presentation selector that has all the camera related presentation selections, and would typically be used for choosing presentation information between two viewports showing the same type of orientation of a view, such as the CT, PT and fusion views in the same orientation view.
Inherited from
Viewport.CameraViewPresentation
Defined in
packages/core/src/RenderingEngine/Viewport.ts:71
TransferViewPresentation
readonlystaticTransferViewPresentation:ViewPresentationSelector
TransferViewPresentation is a view presentation selector that selects all the transfer function related attributes. It would typically be used for synchronizing different orientations of the same series, or for synchronizing two views of the same type of series such as a CT.
Inherited from
Viewport.TransferViewPresentation
Defined in
packages/core/src/RenderingEngine/Viewport.ts:84
Accessors
useCustomRenderingPipeline
getstaticuseCustomRenderingPipeline():boolean
Returns
boolean
Overrides
Viewport.useCustomRenderingPipeline
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:233
Methods
_getCorners()
_getCorners(
bounds):number[][]
Parameters
• bounds: number[]
Returns
number[][]
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:2070
_getEdges()
_getEdges(
bounds): [number[],number[]][]
Returns a list of edges for the imageData bounds, which are the cube edges in the case of volumeViewport edges. p1: front, bottom, left p2: front, top, left p3: back, bottom, left p4: back, top, left p5: front, bottom, right p6: front, top, right p7: back, bottom, right p8: back, top, right
Parameters
• bounds: number[]
Bounds of the renderer
Returns
[number[], number[]][]
Edges of the containing bounds
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:2166
_getFocalPointForResetCamera()
_getFocalPointForResetCamera(
centeredFocalPoint,previousCamera,__namedParameters):Point3
Parameters
• centeredFocalPoint: Point3
• previousCamera: ICamera
• __namedParameters
• __namedParameters.resetPan: boolean = true
• __namedParameters.resetToCenter: boolean = true
Returns
Inherited from
Viewport._getFocalPointForResetCamera
Defined in
packages/core/src/RenderingEngine/Viewport.ts:2083
_isInBounds()
_isInBounds(
point,bounds):boolean
Determines whether or not the 3D point position is inside the boundaries of the 3D imageData.
Parameters
• point: Point3
3D coordinate
• bounds: number[]
Bounds of the image
Returns
boolean
boolean
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:2143
_removeActor()
_removeActor(
actorUID):ActorEntry
Remove the actor from the viewport
Parameters
• actorUID: string
The unique identifier for the actor.
Returns
The removed actor entry or undefined if it didn't exist
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:603
addImages()
addImages(
stackInputs):void
This method is used to add images to the stack viewport. It takes an array of stack inputs, each containing an imageId and an actor UID. For each stack input, it retrieves the image from the cache and creates a VTK image data object. It then creates an actor mapper for the image data and adds it to the list of actors. Finally, it sets the actors for the stack viewport.
Parameters
• stackInputs: IStackInput[]
An array of stack inputs, each containing an image ID and an actor UID.
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2376
addWidget()
addWidget(
widgetId,widget):void
Parameters
• widgetId: any
• widget: any
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:200
calibrateSpacing()
calibrateSpacing(
imageId):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
imageId to be calibrated
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2791
clearDefaultProperties()
clearDefaultProperties(
imageId?):void
Remove the global default properties of the viewport or remove default properties for an imageId if specified
Parameters
• imageId?: string
If given, we remove the default properties only for this imageID, if not the global default properties will be removed
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:710
createVTKImageData()
createVTKImageData(
__namedParameters):vtkImageData
Parameters
• __namedParameters
• __namedParameters.dimensions: any
• __namedParameters.direction: any
• __namedParameters.numberOfComponents: any
• __namedParameters.origin: any
• __namedParameters.pixelArray: any
• __namedParameters.spacing: any
Returns
vtkImageData
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:1751
customRenderViewportToCanvas()
customRenderViewportToCanvas():
object
Returns
object
canvas
canvas:
HTMLCanvasElement
element
element:
HTMLDivElement
renderingEngineId
renderingEngineId:
string
viewportId
viewportId:
string
viewportStatus
viewportStatus:
ViewportStatus
Overrides
Viewport.customRenderViewportToCanvas
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3433
errorCallback()
errorCallback(
imageId,permanent,error):void
Parameters
• imageId: any
• permanent: any
• error: any
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2199
flip()
protectedflip(flipOptions):void
Flip the viewport on horizontal or vertical axis, this method works with vtk-js backed rendering pipeline.
Parameters
• flipOptions: FlipDirection
Flip options specifying the axis of flip
- flipOptions.flipHorizontal - Flip the viewport on horizontal axis
- flipOptions.flipVertical - Flip the viewport on vertical axis
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:376
getActorByIndex()
getActorByIndex(
index):ActorEntry
Get an actor by its index
Parameters
• index: number
array index.
Returns
actorUID
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:575
getActorUIDByIndex()
getActorUIDByIndex(
index):string
Get an actor UID by its index
Parameters
• index: number
array index.
Returns
string
actorUID
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:563
getActorUIDs()
getActorUIDs():
string[]
Returns an array of unique identifiers for all the actors in the viewport.
Returns
string[]
An array of strings
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:523
getCameraNoRotation()
protectedgetCameraNoRotation():ICamera
Returns
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1457
getCanvas()
getCanvas():
HTMLCanvasElement
Gets the target output canvas for the Viewport.
Returns
HTMLCanvasElement
an HTMLCanvasElement.
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1438
getClippingPlanesForActor()
getClippingPlanesForActor(
actorEntry?):vtkPlane[]
Method to get the clipping planes of a given actor
Parameters
• actorEntry?: ActorEntry
The actor entry (a specific type you'll define dependent on your code)
Returns
vtkPlane[]
vtkPlanes - An array of vtkPlane objects associated with the given actor
Inherited from
Viewport.getClippingPlanesForActor
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1771
getCornerstoneImage()
getCornerstoneImage():
IImage
Returns the raw/loaded image being shown inside the stack viewport.
Returns
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:620
getCurrentImageId()
getCurrentImageId(
index):string
Returns the currently rendered imageId
Parameters
• index: number = ...
Returns
string
string for imageId
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3392
getCurrentImageIdIndex()
getCurrentImageIdIndex():
number
Returns the index of the imageId being renderer
Returns
number
currently shown imageId index
Overrides
Viewport.getCurrentImageIdIndex
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3169
getDefaultProperties()
getDefaultProperties(
imageId?):StackViewportProperties
Retrieve the viewport default properties
Parameters
• imageId?: string
If given, we retrieve the default properties of an image index if it exists If not given,we return the global properties of the viewport
Returns
viewport properties including voi, invert, interpolation type,
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:801
getDisplayArea()
getDisplayArea():
DisplayArea
Returns
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1056
getFrameOfReferenceUID()
getFrameOfReferenceUID(
sliceIndex?):string
Returns the frame of reference UID, if the image doesn't have imagePlaneModule metadata, it returns undefined, otherwise, frameOfReferenceUID is returned.
Parameters
• sliceIndex?: number
Returns
string
frameOfReferenceUID : string representing frame of reference id
Overrides
Viewport.getFrameOfReferenceUID
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:614
getImageActor()
getImageActor(
volumeId?):vtkImageSlice
Retrieves an image actor from the viewport actors.
Parameters
• volumeId?: string
Optional. The ID of the volume to find the corresponding image actor.
Returns
vtkImageSlice
The image actor if found, otherwise null.
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:542
getImageDataMetadata()
getImageDataMetadata(
image):ImageDataMetaData
Calculates image metadata based on the image object. It calculates normal axis for the images, and output image metadata
Parameters
• image: IImage
stack image containing cornerstone image
Returns
ImageDataMetaData
image metadata: bitsAllocated, number of components, origin, direction, dimensions, spacing, number of voxels.
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:1565
getImageIds()
getImageIds():
string[]
Returns the list of image Ids for the current viewport
Returns
string[]
list of strings for image Ids
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3384
getImagePlaneReferenceData()
getImagePlaneReferenceData(
sliceIndex):ViewReference
Gets the view reference data for a given image slice. This uses the image plane module to read a default focal point/normal, and also returns the referenced image id and the frame of reference uid.
Parameters
• sliceIndex: number = ...
Returns
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:1697
getLoaderImageOptions()
getLoaderImageOptions(
imageId):object
Parameters
• imageId: string
Returns
object
additionalDetails
additionalDetails:
object
additionalDetails.imageId
imageId:
string
additionalDetails.imageIdIndex
imageIdIndex:
number
priority
priority:
number=5
requestType
requestType:
RequestType=RequestType.Interaction
transferSyntaxUID
transferSyntaxUID:
any
useRGBA
useRGBA:
boolean=false
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2213
getNumberOfSlices()
getNumberOfSlices():
number
Gets the number of slices
Returns
number
Overrides
Viewport.getNumberOfSlices
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:646
getPan()
getPan(
initialCamera):Point2
Helper function to return the current canvas pan value.
Parameters
• initialCamera: ICamera = ...
Returns
a Point2 containing the current pan values on the canvas, computed from the current camera, where the initial pan value is [0,0].
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1279
getProperties()
getProperties():
StackViewportProperties
Retrieve the viewport properties
Returns
viewport properties including voi, invert, interpolation type,
Overrides
Viewport.getProperties
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:820
getRenderer()
getRenderer():
vtkRenderer
Returns the vtkRenderer responsible for rendering the Viewport.
Returns
vtkRenderer
The vtkRenderer for the Viewport.
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:303
getRendererContextPool()
getRendererContextPool():
vtkRenderer
Get the renderer for this viewport - handles ContextPoolRenderingEngine
Returns
vtkRenderer
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3121
getRendererTiled()
getRendererTiled():
vtkRenderer
Returns the vtkRenderer responsible for rendering the Viewport.
Returns
vtkRenderer
The vtkRenderer for the Viewport.
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3131
getRenderingEngine()
getRenderingEngine():
RenderingEngine
Returns the rendering engine driving the Viewport.
Returns
The RenderingEngine instance.
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:294
getRenderPasses()
getRenderPasses():
any[]
Get render passes for this viewport. If sharpening or smoothing is enabled, returns appropriate render passes.
Returns
any[]
Array of VTK render passes or null if no custom passes are needed
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:468
getSliceIndex()
getSliceIndex():
number
returns the slice index of the view
Returns
number
slice index
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3177
getSliceIndexForImage()
getSliceIndexForImage(
reference):number
Parameters
• reference: string | ViewReference
Returns
number
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3367
getSliceInfo()
getSliceInfo():
object
Returns information about the current slice view.
Returns
object
An object containing the slice index and slice axis.
height
height:
number
sliceIndex
sliceIndex:
number
slicePlane
slicePlane:
number
width
width:
number
Throws
Error if the view is oblique.
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3186
getSliceViewInfo()
getSliceViewInfo():
object
Returns
object
height
height:
number
indexToSliceMatrix
indexToSliceMatrix:
mat4
sliceIndex
sliceIndex:
number
slicePlane
slicePlane:
number
sliceToIndexMatrix
sliceToIndexMatrix:
mat4
width
width:
number
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2356
getTargetImageIdIndex()
getTargetImageIdIndex():
number
Returns the imageIdIndex that is targeted to be loaded, in case of debounced loading (with scroll), the targetImageIdIndex is the latest imageId index that is requested to be loaded but debounced.
Returns
number
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3363
getViewPresentation()
getViewPresentation(
viewPresSel):ViewPresentation
Gets a view presentation information specifying HOW a viewport displays something, but not what is being displayed. See getViewReference to get information on WHAT is being displayed.
This is intended to have information on how an image is presented to the user, without specifying what image s displayed. All of this information is available externally, but this method combines the parts of this that are appropriate for remember or applying to other views, without necessarily needing to know what all the attributes are. That differs from methods like getCamera which fetch exact view details that are not likely to be identical between viewports as they change sizes or apply to different images.
Note that the results of this can be used on different viewports, for example, the pan values can be applied to a volume viewport showing a CT, and a stack viewport showing an ultrasound.
The selector allows choosing which view presentation attributes to return.
Some default values are available from Viewport.CameraViewPresentation and
Viewport.TransferViewPresentation
Parameters
• viewPresSel: ViewPresentationSelector = ...
select which attributes to display.
Returns
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1981
getViewReference()
getViewReference(
viewRefSpecifier):ViewReference
Gets a standard target to show this image instance. Returns undefined if the requested slice index is not available.
If using sliceIndex for requesting a specific reference, the slice index MUST come from the stack of image ids. Using slice index from a volume or from a different stack of images ids, EVEN if they contain the same set of images will result in random images being chosen.
Parameters
• viewRefSpecifier: ViewReferenceSpecifier = {}
Returns
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3302
getViewReferenceId()
getViewReferenceId(
specifier):string
Returns the imageId string for the specified view, using the
imageId:<imageId> URN format.
Parameters
• specifier: ViewReferenceSpecifier = {}
Returns
string
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3352
getVtkActiveCamera()
protectedgetVtkActiveCamera():vtkCamera|vtkSlabCamera
Gets the active vtkCamera for the viewport.
Returns
vtkCamera | vtkSlabCamera
vtk driven camera
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1446
getWidget()
getWidget(
id):any
Parameters
• id: any
Returns
any
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:204
getWidgets()
getWidgets():
any[]
Returns
any[]
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:208
getZoom()
getZoom(
compareCamera):number
Returns a current zoom level relative to the initial parallel scale originally applied to the image. That is, on initial display, the zoom level is 1. Computed as a function of the camera.
Parameters
• compareCamera: ICamera = ...
Returns
number
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1362
hasImageId()
hasImageId(
imageId):boolean
Returns true if the viewport contains the given imageId
Parameters
• imageId: string
imageId
Returns
boolean
boolean if imageId is in viewport
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3403
hasImageURI()
hasImageURI(
imageURI):boolean
Returns true if the viewport contains the given imageURI (no data loader scheme)
Parameters
• imageURI: string
imageURI
Returns
boolean
boolean if imageURI is in viewport
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3412
isInAcquisitionPlane()
isInAcquisitionPlane():
boolean
Returns
boolean
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3545
isOrientationChangeable()
isOrientationChangeable():
boolean
Returns whether the viewport supports changing orientation (e.g. via setCamera with viewPlaneNormal/viewUp). Used by tools like OrientationControllerTool to decide where to show interactive orientation markers.
Returns
boolean
Inherited from
Viewport.isOrientationChangeable
Defined in
packages/core/src/RenderingEngine/Viewport.ts:193
isPlaneViewable()
isPlaneViewable(
planeRestriction,options?):boolean
Parameters
• planeRestriction: PlaneRestriction
• options?: ReferenceCompatibleOptions
Returns
boolean
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1887
isReferenceViewable()
isReferenceViewable(
viewRef,options):boolean
Determines if a given ViewReference is viewable in this StackViewport.
Parameters
• viewRef: ViewReference
The ViewReference to check.
• options: ReferenceCompatibleOptions = {}
Additional options for compatibility checking.
Returns
boolean
True if the ViewReference is viewable, false otherwise.
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3209
jumpToWorld()
jumpToWorld(
worldPos):boolean
Parameters
• worldPos: Point3
Returns
boolean
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2836
loadImages()
loadImages(
imageIds,listener):Promise<unknown>
Parameters
• imageIds: string[]
• listener: ImageLoadListener
Returns
Promise<unknown>
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2227
removeActors()
removeActors(
actorUIDs):void
Remove the actors with the given UIDs from the viewport
Parameters
• actorUIDs: string[]
An array of actor UIDs to remove.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:624
removeWidgets()
removeWidgets():
void
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:221
render()
render():
void
Renders the Viewport using the RenderingEngine.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:316
renderImageObject()
renderImageObject(
image):void
Renders the given Cornerstone image object in the viewport. This method is intended to be used by utilities to render an individual image, rather than by applications that want to display a complete image stack. If you want to load and display a complete image stack, use the setStack method instead of this one.
The rendered image will appear in the viewport's element. Use this method if you have other means of loading and the cornerstone image object is already available.
If you don't understand the difference between this method and setStack, you probably want to use setStack.
Parameters
• image: any
The Cornerstone image object to render.
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2294
reset()
reset(
immediate):void
Resets the options the Viewport's defaultOptions
Parameters
• immediate: boolean = false
If true, renders the viewport after the options are reset.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:346
resetCameraForResize()
resetCameraForResize():
boolean
Returns
boolean
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:842
resetCameraNoEvent()
protectedresetCameraNoEvent():void
Reset the camera to the default viewport camera without firing events
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:757
resetProperties()
resetProperties():
void
Reset the viewport properties to the default values
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:854
resetToDefaultProperties()
resetToDefaultProperties():
void
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:913
resize()
resize():
void
Resizes the viewport - only used in CPU fallback for StackViewport. The GPU resizing happens inside the RenderingEngine.
Returns
void
Overrides
Viewport.resize
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:508
scroll()
scroll(
delta,debounce,loop):void
It scrolls the stack of imageIds by the delta amount provided. If the debounce flag is set, it will only scroll the stack if the delta is greater than the debounceThreshold which is 40 milliseconds by default.
Parameters
• delta: number
number of indices to scroll, it can be positive or negative
• debounce: boolean = true
whether to debounce the scroll event
• loop: boolean = false
whether to loop the stack
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2709
setCameraNoEvent()
protectedsetCameraNoEvent(camera):void
Sets the camera to the default viewport camera without firing events
Parameters
• camera: ICamera
The camera to use for the viewport.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:768
setColorTransform()
protectedsetColorTransform(voiRange,averageWhite):any
This applies a color transform as an svg filter to the output image.
Parameters
• voiRange: any
• averageWhite: any
Returns
any
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:264
setDataIds()
setDataIds(
_imageIds,_options?):void
This is a wrapper for setStack/setVideo/etc
Parameters
• _imageIds: string[]
• _options?: ImageSetOptions
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:2203
setDefaultProperties()
setDefaultProperties(
ViewportProperties,imageId?):void
Update the default properties of the viewport and add properties by imageId if specified
Parameters
• ViewportProperties: StackViewportProperties
The properties to set
• imageId?: string
If given, we set the default properties only for this image index, if not the default properties will be set for all imageIds
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:689
setDisplayArea()
setDisplayArea(
displayArea,suppressEvents):void
Sets the camera to an initial bounds. If resetPan and resetZoom are true it places the focal point at the center of the volume (or slice); otherwise, only the camera zoom and camera Pan or Zoom is reset for the current view.
Parameters
• displayArea: DisplayArea
The display area of interest.
• suppressEvents: boolean = false
If true, don't fire displayArea event.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:838
setDisplayAreaFit()
protectedsetDisplayAreaFit(displayArea):void
This applies a display area with a fit of the provided area to the available area. The zoom level is controlled by the imageArea parameter, which is a pair of percentage width in the horizontal and vertical dimension is scaled to fit the displayable area. Both values are taken into account, and the scaling is set so that both fractions of the image area are visible.
The panning is controlled by the imageCanvasPoint, which has two values, teh imagePoint and the canvasPoint. They are fractional values of the image and canvas respectively, with the panning set to display the image pixel at the given fraction on top of the canvas at the given percentage. The default points are 0.5.
For example, if the zoom level is [2,1], then the image is displayed such that at least twice the width is visible, and the height is visible. That will result in the image width being black, divided up on the left and right according to the imageCanvasPoint
Then, if the imagePoint is [1,0] and the canvas point is [1,0], then the right most edge of the image, at the top of the image, will be displayed at the right most edge of the canvas, at the top.
Parameters
• displayArea: DisplayArea
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:975
setDisplayAreaScale()
protectedsetDisplayAreaScale(displayArea):void
Sets the viewport to pixel scaling mode. Pixel scaling displays 1 image pixel as 1 (or scale) physical screen pixels. That is, a 1024x512 image will be displayed with scale=2, as 2048x1024 physical image pixels.
Parameters
• displayArea: DisplayArea
display area to set
- displayArea.scale - the number of physical pixels to display
each image pixel in. Values
< 1mean smaller than physical, while values> 1mean more than one pixel. Default is 1 Suggest using whole numbers or integer fractions (eg1/3)
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:902
setFitToCanvasCamera()
protectedsetFitToCanvasCamera(camera):void
Sets the provided camera as the displayArea camera. This allows computing differences applied later as compared to the initial position, for things like zoom and pan.
Parameters
• camera: ICamera
to store as the initial value.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1267
setImageIdIndex()
setImageIdIndex(
imageIdIndex):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
number represents imageId index in the list of provided imageIds in setStack
Returns
Promise<string>
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2768
setInitialCamera()
protectedsetInitialCamera(camera):void
Sets the provided camera as the initial camera. This allows computing differences applied later as compared to the initial position, for things like zoom and pan.
Parameters
• camera: ICamera
to store as the initial value.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1257
setNeedsRender()
setNeedsRender():
void
Mark the viewport as needing a render pass (e.g. after external display-set / segmentation updates). Does not queue a render; the rendering engine’s normal RAF cycle will pick this up.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:257
setOptions()
setOptions(
options,immediate):void
Sets new options and (TODO) applies them.
Parameters
• options: ViewportInputOptions
The viewport options to set.
• immediate: boolean = false
If true, renders the viewport after the options are set.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:328
setOrientationOfClippingPlanes()
setOrientationOfClippingPlanes(
vtkPlanes,slabThickness,viewPlaneNormal,focalPoint):void
Parameters
• vtkPlanes: vtkPlane[]
• slabThickness: number
• viewPlaneNormal: Point3
• focalPoint: Point3
Returns
void
Inherited from
Viewport.setOrientationOfClippingPlanes
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1734
setPan()
setPan(
pan,storeAsInitialCamera):void
Sets the canvas pan value relative to the initial view position of 0,0 Modifies the camera to perform the pan.
Parameters
• pan: Point2
• storeAsInitialCamera: boolean = false
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1328
setProperties()
setProperties(
properties,suppressEvents):void
Configures the properties of the viewport. This method allows customization of the viewport by setting attributes like VOI (Value of Interest), color inversion, interpolation type, and image rotation. If setProperties is called for the first time, the provided properties will become the default settings for all images in the stack in case the resetPropertiese need to be called
Parameters
• properties: StackViewportProperties = {}
An object containing the properties to be set.
• suppressEvents: boolean = false
A boolean value to control event suppression. If true, the related events will not be triggered. Default is false.
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:735
setRendered()
setRendered():
void
Indicate that the image has been rendered. This will set the viewportStatus to RENDERED if there is image data available to actually be rendered - otherwise, the rendering simply showed the background image.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:243
setRotation()
protectedsetRotation(rotation):void
Parameters
• rotation: number
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:1206
setStack()
setStack(
imageIds,currentImageIdIndex):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[]
list of strings, that represents list of image Ids
• currentImageIdIndex: number = 0
number representing the index of the initial image to be displayed
Returns
Promise<string>
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:1817
setUseCPURendering()
setUseCPURendering(
value):void
Parameters
• value: boolean
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:228
setViewPresentation()
setViewPresentation(
viewPres):void
Applies the display area, zoom, pan and rotation from the view presentation. No-op is viewPres isn't defined.
Parameters
• viewPres: ViewPresentation
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:2032
setViewReference()
setViewReference(
viewRef):void
Applies the view reference, which may navigate the slice index and apply other camera modifications. Assumes that the slice index is correct for this viewport
Parameters
• viewRef: ViewReference
Returns
void
Overrides
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:3329
setZoom()
setZoom(
value,storeAsInitialCamera):void
Zooms the image using parallel scale by updating the camera value.
Parameters
• value: number
The relative parallel scale to apply. It is relative to the initial offsets value.
• storeAsInitialCamera: boolean = false
can be set to true to reset the camera after applying this zoom as the initial camera. A subsequent getZoom call will return "1", but the zoom will have been applied.
Returns
void
Inherited from
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1379
shouldUseCustomRenderPass()
protectedshouldUseCustomRenderPass():boolean
Check if custom render passes should be used for this viewport.
Returns
boolean
True if custom render passes should be used, false otherwise
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:459
successCallback()
successCallback(
imageId,image):void
Parameters
• imageId: any
• image: any
Returns
void
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:2150
triggerCameraModifiedEventIfNecessary()
triggerCameraModifiedEventIfNecessary(
previousCamera,updatedCamera):void
Trigger camera modified event
Parameters
• previousCamera: ICamera
• updatedCamera: ICamera
Returns
void
Inherited from
Viewport.triggerCameraModifiedEventIfNecessary
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1656
updateCameraClippingPlanesAndRange()
updateCameraClippingPlanesAndRange():
void
Updates the camera's clipping planes and range.
Returns
void
Inherited from
Viewport.updateCameraClippingPlanesAndRange
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1676
updateClippingPlanesForActors()
protectedupdateClippingPlanesForActors(updatedCamera):Promise<void>
Updates the actors clipping planes orientation from the camera properties
Parameters
• updatedCamera: ICamera
ICamera
Returns
Promise<void>
Inherited from
Viewport.updateClippingPlanesForActors
Defined in
packages/core/src/RenderingEngine/Viewport.ts:1686
updateRenderingPipeline()
updateRenderingPipeline():
void
Returns
void
Overrides
Viewport.updateRenderingPipeline
Defined in
packages/core/src/RenderingEngine/StackViewport.ts:237
boundsRadius()
staticboundsRadius(bounds):number
Computes the bounds radius value
Parameters
• bounds: number[]
Returns
number