VolumeViewport3D
Hierarchy
- BaseVolumeViewport
- VolumeViewport3D
Index
Constructors
Properties
- _actors
- _suppressCameraModifiedEvents
- canvas
- customRenderViewportToCanvas
- defaultOptions
- element
- getNumberOfSlices
- id
- isDisabled
- options
- renderingEngineId
- resize
- sHeight
- sWidth
- suppressEvents
- sx
- sy
- type
- updateRenderingPipeline
- useCPURendering
- useNativeDataType
- viewportStatus
- CameraViewPresentation
- TransferViewPresentation
Accessors
Methods
- _getCorners
- _getEdges
- _getFocalPointForResetCamera
- _isInBounds
- _removeActor
- addActor
- addActors
- addVolumes
- addWidget
- canvasToWorld
- clearDefaultProperties
- flip
- getActor
- getActorByIndex
- getActorUIDByIndex
- getActorUIDs
- getActors
- getBounds
- getCamera
- getCanvas
- getClippingPlanesForActor
- getCurrentImageId
- getCurrentImageIdIndex
- getDefaultActor
- getDefaultProperties
- getDisplayArea
- getFrameOfReferenceUID
- getImageData
- getImageIds
- getIntensityFromWorld
- getPan
- getProperties
- getReferenceId
- getRenderer
- getRenderingEngine
- getRotation
- getSlabThickness
- getViewPresentation
- getViewReference
- getWidget
- getWidgets
- getZoom
- hasImageURI
- hasVolumeId
- isReferenceViewable
- removeActors
- removeAllActors
- removeVolumeActors
- removeWidgets
- render
- reset
- resetCamera
- resetProperties
- resetSlabThickness
- resetToDefaultProperties
- scroll
- setActors
- setBlendMode
- setCamera
- setDefaultProperties
- setDisplayArea
- setOptions
- setOrientation
- setOrientationOfClippingPlanes
- setPan
- setProperties
- setRendered
- setSlabThickness
- setViewPresentation
- setViewReference
- setVolumes
- setZoom
- triggerCameraModifiedEventIfNecessary
- updateCameraClippingPlanesAndRange
- worldToCanvas
- boundsRadius
Constructors
constructor
Parameters
props: ViewportInput
Returns VolumeViewport3D
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
customRenderViewportToCanvas
Type declaration
Returns unknown
readonlydefaultOptions
Default options for the viewport which includes orientation, viewPlaneNormal and backgroundColor
readonlyelement
HTML element in DOM that is used for rendering the viewport
getNumberOfSlices
Type declaration
Returns number
readonlyid
unique identifier for the viewport
publicisDisabled
if the viewport has been disabled
options
options for the viewport which includes orientation axis, backgroundColor and displayArea
readonlyrenderingEngineId
RenderingEngine id that the viewport belongs to
resize
Type declaration
Returns void
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
updateRenderingPipeline
Type declaration
Returns void
useCPURendering
useNativeDataType
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.
Accessors
staticuseCustomRenderingPipeline
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
publicaddVolumes
Creates and adds volume actors for all volumes defined in the
volumeInputArray
. For each entry, if acallback
is supplied, it will be called with the new volume actor as input.Parameters
volumeInputArray: IVolumeInput[]
The array of
VolumeInput
s which define the volumes to add.immediate: boolean = false
Whether the
Viewport
should be rendered as soon as volumes are added.suppressEvents: boolean = false
Returns Promise<void>
publicaddWidget
Parameters
widgetId: any
widget: any
Returns void
publiccanvasToWorld
publicclearDefaultProperties
Remove the global default properties of the viewport or remove default properties for a volumeId if specified
Parameters
optionalvolumeId: string
If given, we remove the default properties only for this volumeId, if not the global default properties will be removed
Returns void
publicflip
Flip the viewport along the desired axis
Parameters
flipDirection: FlipDirection
FlipDirection
Returns 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.
publicgetBounds
gets the visible bounds of the viewport in the world coordinate system
Returns number[]
publicgetCamera
Get the camera’s current state
Returns ICamera
The camera object.
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
getCurrentImageId
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
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
publicgetDefaultActor
Get the default actor
Returns ActorEntry
An actor entry.
publicgetDefaultProperties
Retrieve the viewport default properties
Parameters
optionalvolumeId: string
If given, we retrieve the default properties of a volumeId if it exists If not given,we return the global properties of the viewport
Returns VolumeViewportProperties
default viewport properties including voi, invert, interpolation type, colormap
publicgetDisplayArea
returns the displayArea
Returns DisplayArea
publicgetFrameOfReferenceUID
Returns string
publicgetImageData
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
The volumeId of the volume to get the image for.
Returns IImageData
IImageData: {dimensions, direction, scalarData, vtkImageData, metadata, scaling}
publicgetImageIds
Returns the list of image Ids for the current viewport
Parameters
optionalvolumeId: string
volumeId
Returns string[]
list of strings for image Ids
publicgetIntensityFromWorld
Given a point in world coordinates, return the intensity at that point
Parameters
point: Point3
The point in world coordinates to get the intensity from.
Returns number
The intensity value of the voxel at the given point.
publicgetPan
publicgetProperties
Retrieve the viewport properties
Parameters
optionalvolumeId: string
The volume id to get the properties for (if undefined, the first volume)
Returns VolumeViewportProperties
viewport properties including voi, interpolation type: TODO: slabThickness, invert, rotation, flip
publicgetReferenceId
For a volume viewport, the reference id will be a URN starting with
volumeId:<volumeId>
, followed by additional arguments to specify the view orientation. This will end up being a unique string that identifies the view reference being shown. It is different from the view reference in that the values are all incorporated into a string to allow using it as a parameter key.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.
getRotation
Gets the rotation resulting from the value set in setRotation AND taking into account any flips that occurred subsequently from the camera provided or the viewport.
Returns number
the rotation resulting from the value set in setRotation AND taking into account any flips that occurred subsequently.
publicgetSlabThickness
Gets the largest slab thickness from all actors in the viewport.
Returns number
slabThickness - The slab thickness.
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, allowing comparison between view positions as well as restoring views later.
Parameters
viewRefSpecifier: 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
if the volume viewport has imageURI (no loader schema) in one of its volume actors
Parameters
imageURI: string
Returns boolean
publichasVolumeId
Checks if the viewport has a volume actor with the given volumeId
Parameters
volumeId: string
the volumeId to look for
Returns boolean
Boolean indicating if the volume is present in the viewport
publicisReferenceViewable
Find out if this viewport would show this view
Parameters
viewRef: ViewReference
optionaloptions: ReferenceCompatibleOptions
allows specifying whether the view COULD display this with some modification - either navigation or displaying as volume.
Returns boolean
true if the target is compatible with this view
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
publicremoveVolumeActors
It removes the volume actor from the Viewport. If the volume actor is not in the viewport, it does nothing.
Parameters
actorUIDs: string[]
Array of actor UIDs to remove. In case of simple volume it will be the volume Id, but in case of Segmentation it will be
{volumeId}-{representationType}
since the same volume can be rendered in multiple representations.immediate: boolean = false
If true, the Viewport will be rendered immediately
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
Resets the camera based on the rendering volume(s) 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
resetPan: boolean = true
If true, the camera focal point is reset to the center of the volume (slice)
resetZoom: boolean = true
If true, the camera zoom is reset to the default zoom
resetToCenter: boolean = true
Returns boolean
boolean
resetProperties
Reset the viewport properties to the default values
Parameters
optionalvolumeId: string
Returns void
resetSlabThickness
Reset the slab thickness for actors of the viewport.
Returns void
publicresetToDefaultProperties
Reset the viewport properties to the default values
Parameters
volumeId: string
Returns void
publicscroll
Scrolls the viewport in the given direction/amount
Parameters
delta: number = 1
Returns 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
setBlendMode
Sets the blendMode for actors of the viewport.
Parameters
blendMode: BlendModes
optionalfilterActorUIDs: string[]
optionalimmediate: boolean
Returns void
publicsetCamera
Set the camera parameters
Parameters
cameraInterface: ICamera
ICamera
storeAsInitialCamera: boolean = false
to set the provided camera as the initial one, used to compute differences for things like pan and zoom.
Returns void
publicsetDefaultProperties
Update the default properties for the volume viewport on the volume
Parameters
ViewportProperties: VolumeViewportProperties
The properties to set
optionalvolumeId: string
The volume id to set the default properties for (if undefined, we set the global default viewport properties)
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
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
publicsetOrientation
It sets the orientation for the camera, the orientation can be one of the following: axial, sagittal, coronal, default. Use the Enums.OrientationAxis to set the orientation. The “default” orientation is the orientation that the volume was acquired in (scan axis)
Parameters
_orientation: OrientationAxis | OrientationVectors
_immediate: boolean = true
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
publicsetProperties
Sets the properties for the volume viewport on the volume and if setProperties is called for the first time, the properties will also become the default one. (if fusion, it sets it for the first volume in the fusion)
Parameters
VolumeViewportProperties: VolumeViewportProperties = {}
The properties to set
optionalvolumeId: string
The volume id to set the properties for (if undefined, the first volume)
suppressEvents: boolean = false
If true, the viewport will not emit events
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
setSlabThickness
Sets the slab thickness for actors of the viewport.
Parameters
slabThickness: number
optionalfilterActorUIDs: string[]
Returns void
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 specified view reference.
Parameters
viewRef: ViewReference
Returns void
publicsetVolumes
Creates volume actors for all volumes defined in the
volumeInputArray
. For each entry, if acallback
is supplied, it will be called with the new volume actor as input. For each entry, if ablendMode
and/orslabThickness
is defined, this will be set on the actor’sVolumeMapper
.Parameters
volumeInputArray: IVolumeInput[]
The array of
VolumeInput
s which define the volumes to add.immediate: boolean = false
Whether the
Viewport
should be rendered as soon as volumes are added.suppressEvents: boolean = false
Returns Promise<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
publictriggerCameraModifiedEventIfNecessary
publicupdateCameraClippingPlanesAndRange
Updates the camera’s clipping planes and range.
Returns void
publicworldToCanvas
staticboundsRadius
Computes the bounds radius value
Parameters
bounds: number[]
Returns number
An object representing a 3-dimensional volume viewport. VolumeViewport3Ds are used to render 3D volumes in their entirety, and not just load a single slice at a time.
For setting volumes on viewports you need to use addVolumesToViewports which will add volumes to the specified viewports.