VideoViewport
Hierarchy
- Viewport
- VideoViewport
Implements
Index
Constructors
Properties
Accessors
Methods
- _getCorners
- _getEdges
- _getFocalPointForResetCamera
- _isInBounds
- _removeActor
- addActor
- addActors
- addImages
- addWidget
- canvasToWorld
- customRenderViewportToCanvas
- end
- getActor
- getActorByIndex
- getActorUIDByIndex
- getActorUIDs
- getActors
- getCamera
- getCanvas
- getClippingPlanesForActor
- getCurrentImageId
- getCurrentImageIdIndex
- getDefaultActor
- getDisplayArea
- getFrameNumber
- getFrameOfReferenceUID
- getFrameRange
- getImageData
- getImageDataMetadata
- getImageIds
- getNumberOfSlices
- getPan
- getProperties
- getReferenceId
- getRenderer
- getRenderingEngine
- getRotation
- getViewPresentation
- getViewReference
- getWidget
- getWidgets
- getZoom
- hasImageURI
- isReferenceViewable
- pause
- play
- removeActors
- removeAllActors
- removeWidgets
- render
- reset
- resetCamera
- resetProperties
- resize
- scroll
- setActors
- setAverageWhite
- setCamera
- setDisplayArea
- setFrameNumber
- setFrameRange
- setOptions
- setOrientationOfClippingPlanes
- setPan
- setPlaybackRate
- setProperties
- setRendered
- setScrollSpeed
- setTime
- setVOI
- setVideo
- setVideoURL
- setViewPresentation
- setViewReference
- setWindowLevel
- setZoom
- start
- togglePlayPause
- triggerCameraModifiedEventIfNecessary
- updateCameraClippingPlanesAndRange
- worldToCanvas
- boundsRadius
Constructors
constructor
Parameters
props: VideoViewportInput
Returns VideoViewport
Properties
_actors
a Map containing the actor uid and actors
_suppressCameraModifiedEvents
informs if a new actor was added before a resetCameraClippingRange phase
readonlycanvas
an internal canvas that is created on the provided HTML element
readonlycanvasContext
readonlydefaultOptions
Default options for the viewport which includes orientation, viewPlaneNormal and backgroundColor
readonlyelement
HTML element in DOM that is used for rendering the viewport
readonlyid
unique identifier for the viewport
publicisDisabled
if the viewport has been disabled
publicmodality
options
options for the viewport which includes orientation axis, backgroundColor and displayArea
readonlyrenderingEngineId
renderingEngineId the viewport belongs to
sHeight
sHeight of viewport on the offscreen canvas
sWidth
sWidth of viewport on the offscreen canvas
readonlysuppressEvents
A flag representing if viewport methods should fire events or not
sx
sx of viewport on the offscreen canvas
sy
sy of viewport on the offscreen canvas
readonlytype
Type of viewport
readonlyuid
updateRenderingPipeline
Type declaration
Returns void
publicviewportStatus
Record the rendering status, mostly for testing purposes, but can also be useful for knowing things like whether the viewport is initialized
publicstaticreadonlyCameraViewPresentation
CameraViewPresentation is a view preentation 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.
publicstaticreadonlyTransferViewPresentation
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.
publicstaticframeRangeExtractor
Accessors
publicstaticuseCustomRenderingPipeline
Returns boolean
Methods
_getCorners
Parameters
bounds: number[]
Returns number[][]
_getEdges
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
_getFocalPointForResetCamera
_isInBounds
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
_removeActor
Remove the actor from the viewport
Parameters
actorUID: string
The unique identifier for the actor.
Returns void
publicaddActor
Add an actor to the viewport including its id, its actor and slabThickness if defined
Parameters
actorEntry: ActorEntry
ActorEntry
- actorEntry.uid - The unique identifier for the actor.
- actorEntry.actor - The volume actor.
- actorEntry.slabThickness - The slab thickness.
Returns void
publicaddActors
Add a list of actors (actor entries) to the viewport
Parameters
actors: ActorEntry[]
An array of ActorEntry objects.
resetCameraPanAndZoom: boolean = false
force reset pan and zoom of the camera, default value is false.
Returns void
publicaddImages
Parameters
stackInputs: any[]
Returns void
publicaddWidget
Parameters
widgetId: any
widget: any
Returns void
publiccanvasToWorld
publiccustomRenderViewportToCanvas
whether the viewport has custom rendering
Returns void
publicend
Returns Promise<void>
publicgetActor
Get an actor by its UID
Parameters
actorUID: string
The unique ID of the actor.
Returns ActorEntry
An ActorEntry object.
publicgetActorByIndex
Get an actor by its index
Parameters
index: number
array index.
Returns ActorEntry
actorUID
publicgetActorUIDByIndex
Get an actor UID by its index
Parameters
index: number
array index.
Returns string
actorUID
publicgetActorUIDs
Returns an array of unique identifiers for all the actors in the viewport.
Returns string[]
An array of strings
publicgetActors
Get all the actors in the viewport
Returns ActorEntry[]
An array of ActorEntry objects.
publicgetCamera
returns camera object
Returns ICamera
publicgetCanvas
Gets the target output canvas for the
Viewport
.Returns HTMLCanvasElement
an HTMLCanvasElement.
publicgetClippingPlanesForActor
Method to get the clipping planes of a given actor
Parameters
optionalactorEntry: 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
publicgetCurrentImageId
This function returns the imageID associated with either the current frame being displayed, or the range of frames being played. This may not correspond to any particular imageId that has imageId metadata, as the format is one of:
<DICOMweb URI>/frames/<Start Frame>(-<End Frame>)?
or<Other URI>[?&]frameNumber=<Start Frame>(-<EndFrame>)?
for a URL parameter.Returns string
an imageID for video
publicgetCurrentImageIdIndex
Gets the current slice in the current camera orientation
Returns number
publicgetDefaultActor
Get the default actor
Returns ActorEntry
An actor entry.
publicgetDisplayArea
returns the displayArea
Returns DisplayArea
publicgetFrameNumber
Gets the 1 based frame number (ala DICOM value), eg
1+ currentImageIdIndex
Returns number
publicgetFrameOfReferenceUID
frameOfReferenceUID the viewport’s default actor is rendering
Returns string
publicgetFrameRange
Returns [number, number]
publicgetImageData
Returns { calibration: IImageCalibration; dimensions: any; direction: any; getScalarData: () => CanvasScalarData; hasPixelSpacing: boolean; imageData: { getDimensions: () => any; getDirection: () => any; getRange: () => number[]; getScalarData: () => CanvasScalarData; getSpacing: () => any; indexToWorld: (point: Point2, destPoint?: Point3) => Point3; worldToIndex: (point: Point3) => number[] }; metadata: { Modality: any }; origin: any; preScale: { scaled: boolean }; spacing: any }
calibration: IImageCalibration
dimensions: any
direction: any
getScalarData: () => CanvasScalarData
Returns CanvasScalarData
hasPixelSpacing: boolean
imageData: { getDimensions: () => any; getDirection: () => any; getRange: () => number[]; getScalarData: () => CanvasScalarData; getSpacing: () => any; indexToWorld: (point: Point2, destPoint?: Point3) => Point3; worldToIndex: (point: Point3) => number[] }
getDimensions: () => any
Returns any
getDirection: () => any
Returns any
getRange: () => number[]
Returns number[]
getScalarData: () => CanvasScalarData
Returns CanvasScalarData
getSpacing: () => any
Returns any
indexToWorld: (point: Point2, destPoint?: Point3) => Point3
worldToIndex: (point: Point3) => number[]
Parameters
point: Point3
Returns number[]
metadata: { Modality: any }
Modality: any
origin: any
preScale: { scaled: boolean }
scaled: boolean
spacing: any
publicgetImageDataMetadata
Parameters
image: string | IImage
Returns { bitsAllocated: number; columns: any; dimensions: any[]; direction: number[]; hasPixelSpacing: boolean; imagePlaneModule: any; numComps: number; numVoxels: number; origin: any; rows: any; spacing: any[] }
bitsAllocated: number
columns: any
dimensions: any[]
direction: number[]
hasPixelSpacing: boolean
imagePlaneModule: any
numComps: number
numVoxels: number
origin: any
rows: any
spacing: any[]
publicgetImageIds
Gets all the image ids associated with this video element. This will have # of frames elements.
Returns string[]
publicgetNumberOfSlices
Gets the number of slices in the current camera orientation
Returns number
publicgetPan
Gets the canvas pan value
Returns Point2
publicgetProperties
Retrieve the viewport properties
Returns VideoViewportProperties
publicgetReferenceId
Gets a target id that can be used to specify how to show this
Parameters
specifier: ViewReferenceSpecifier = {}
Returns string
publicgetRenderer
Returns the
vtkRenderer
responsible for rendering theViewport
.Returns any
The
vtkRenderer
for theViewport
.
publicgetRenderingEngine
Returns the rendering engine driving the
Viewport
.Returns default
The RenderingEngine instance.
publicgetRotation
get the rotation either from the camera provided or the viewport if not provided
Returns number
publicgetViewPresentation
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 atributes 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
andViewport.TransferViewPresentation
Parameters
viewPresSel: ViewPresentationSelector = ...
select which attributes to display.
Returns ViewPresentation
publicgetViewReference
Gets a view target that species what type of view is required to show the current view, or the one specified in the forTarget modifiers.
Parameters
optionalviewRefSpecifier: ViewReferenceSpecifier
Returns ViewReference
publicgetWidget
Parameters
id: any
Returns any
publicgetWidgets
Returns any[]
publicgetZoom
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
publichasImageURI
Checks to see if the imageURI is currently being displayed. The imageURI may contain frame numbers according to the DICOM standard format, which will be stripped to compare the base image URI, and then the values used to check if that frame is currently being displayed.
The DICOM standard allows for comma separated values as well, however, this is not supported here, with only a single range or single value being tested.
For a single value, the time range +/- 5 frames is permitted to allow the detection to actually succeed when nearby without requiring an exact time frame to be matched.
Parameters
imageURI: string
containing frame number or range.
Returns boolean
publicisReferenceViewable
Figure out if a given view can be shown in the current viewport.
Parameters
viewRef: ViewReference
options: ReferenceCompatibleOptions = {}
Returns boolean
publicpause
Returns Promise<void>
publicplay
Returns Promise<void>
publicremoveActors
Remove the actors with the given UIDs from the viewport
Parameters
actorUIDs: string[]
An array of actor UIDs to remove.
Returns void
publicremoveAllActors
Remove all actors from the renderer
Returns void
publicremoveWidgets
Returns void
publicrender
Renders the
Viewport
using theRenderingEngine
.Returns void
publicreset
Resets the options the
Viewport
‘sdefaultOptions
Parameters
immediate: boolean = false
If
true
, renders the viewport after the options are reset.
Returns void
publicresetCamera
Centers Pan and resets the zoom for stack viewport.
Returns boolean
publicresetProperties
Reset the viewport properties to the default values
Returns void
publicresize
Resizes the viewport - only used in CPU fallback for StackViewport. The GPU resizing happens inside the RenderingEngine.
Returns void
publicscroll
Parameters
delta: number = 1
Returns Promise<void>
publicsetActors
It removes all actors from the viewport and then adds the actors from the array.
Parameters
actors: ActorEntry[]
An array of ActorEntry objects.
Returns void
publicsetAverageWhite
Parameters
averageWhite: [number, number, number]
Returns void
publicsetCamera
sets the camera
Parameters
camera: ICamera
Returns void
publicsetDisplayArea
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
publicsetFrameNumber
Sets the current frame
Parameters
frame: number
Returns Promise<void>
publicsetFrameRange
Sets the playback frame range. The video will play over the given set of frames (assuming it is playing).
Parameters
frameRange: number[]
the minimum to maximum (inclusive) frames to play over
Returns void
publicsetOptions
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
publicsetOrientationOfClippingPlanes
publicsetPan
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
publicsetPlaybackRate
Parameters
rate: number = 1
Returns void
publicsetProperties
Sets the properties for the viewport on the default actor.
Parameters
props: VideoViewportProperties
Returns void
publicsetRendered
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
publicsetScrollSpeed
Parameters
scrollSpeed: number = 1
unit: SpeedUnit = VideoViewportEnum.SpeedUnit.FRAME
Returns void
publicsetTime
Sets the current video time, in seconds
Parameters
timeInSeconds: number
Returns Promise<void>
publicsetVOI
Parameters
voiRange: VOIRange
Returns void
publicsetVideo
Sets the video image id to show and hte frame number. Requirements are to have the imageUrlModule in the metadata with the rendered endpoint being the raw video in video/mp4 format.
Parameters
imageId: string
optionalframeNumber: number
Returns Promise<unknown>
publicsetVideoURL
Displays a raw video, without any metadata associated with it. Plays back, but does not permit tools to apply to the viewport, which requires providing additional metadata for the study.
Parameters
videoURL: string
to display
Returns Promise<unknown>
publicsetViewPresentation
Applies the display area, zoom, pan and rotation from the view presentation. No-op is viewPres isn’t defined.
Parameters
viewPres: ViewPresentation
Returns void
publicsetViewReference
Navigates to the image specified by the viewRef.
Parameters
viewRef: ViewReference
Returns void
publicsetWindowLevel
Parameters
windowWidth: number = 256
windowCenter: number = 128
Returns void
publicsetZoom
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
publicstart
Returns Promise<void>
publictogglePlayPause
Returns boolean
publictriggerCameraModifiedEventIfNecessary
publicupdateCameraClippingPlanesAndRange
Nothing to do for the clipping planes for video as they don’t exist.
Returns void
publicworldToCanvas
staticboundsRadius
Computes the bounds radius value
Parameters
bounds: number[]
Returns number
An object representing a single stack viewport, which is a camera looking into an internal scene, and an associated target output
canvas
.