VolumeViewport
Hierarchy
- BaseVolumeViewport
- VolumeViewport
Index
Constructors
Properties
Accessors
Methods
- _getCorners
- _getEdges
- _getFocalPointForResetCamera
- _isInBounds
- _removeActor
- addActor
- addActors
- addVolumes
- canvasToWorld
- flip
- getActor
- getActorByIndex
- getActorUIDByIndex
- getActors
- getBounds
- getCamera
- getCanvas
- getCurrentImageId
- getCurrentImageIdIndex
- getDefaultActor
- getFrameOfReferenceUID
- getImageData
- getIntensityFromWorld
- getPan
- getRenderer
- getRenderingEngine
- getSlabThickness
- getZoom
- hasImageURI
- hasVolumeId
- removeActors
- removeAllActors
- removeVolumeActors
- render
- reset
- resetCamera
- setActors
- setBlendMode
- setCamera
- setOptions
- setOrientation
- setOrientationOfClippingPlanes
- setPan
- setProperties
- setSlabThickness
- setVolumes
- setZoom
- triggerCameraModifiedEventIfNecessary
- worldToCanvas
Constructors
constructor
Parameters
props: ViewportInput
Returns VolumeViewport
Properties
_actors
a Map containing the actor uid and actors
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
getProperties
Type declaration
Returns void
readonlyid
unique identifier for the viewport
publicisDisabled
if the viewport has been disabled
options
options for the viewport which includes orientation axis and backgroundColor
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
useCPURendering
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
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>
publiccanvasToWorld
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
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.
publicgetCurrentImageId
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
ImageId
publicgetCurrentImageIdIndex
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. Todo: This only works if the imageIds are properly sorted
Returns number
The slice index
publicgetDefaultActor
Get the default actor
Returns ActorEntry
An actor entry.
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}
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
Helper function to return the current canvas pan value.
Returns Point2
a Point2 containing the current pan values on the canvas, computed from the current camera, where the initial pan value is [0,0].
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.
publicgetSlabThickness
Gets the largest slab thickness from all actors in the viewport.
Returns number
slabThickness - The slab thickness.
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.
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
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
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
Reset the camera for the volume viewport
Parameters
resetPan: boolean = true
resetZoom: boolean = true
resetToCenter: boolean = true
Returns boolean
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
publicsetBlendMode
Sets the blendMode for actors of the viewport.
Parameters
blendMode: BlendModes
filterActorUIDs: any[] = []
immediate: boolean = false
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
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
The orientation to set the camera to.
immediate: boolean = true
Whether the
Viewport
should be rendered as soon as the camera is 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
publicsetProperties
Sets the properties for the volume viewport on the volume (if fusion, it sets it for the first volume in the fusion)
Parameters
voiRange: VolumeViewportProperties = {}
Sets the lower and upper voi
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
publicsetSlabThickness
It sets the slabThickness of the actors of the viewport. If filterActorUIDs are provided, only the actors with the given UIDs will be affected. If no filterActorUIDs are provided, all actors will be affected.
Parameters
slabThickness: number
The slab thickness to set.
filterActorUIDs: any[] = []
Optional argument to filter the actors to apply the slab thickness to (if not provided, all actors will be affected).
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
An object representing a VolumeViewport. VolumeViewports are used to render 3D volumes from which various orientations can be viewed. Since VolumeViewports use SharedVolumeMappers behind the scene, memory footprint of visualizations of the same volume in different orientations is very small.
For setting volumes on viewports you need to use addVolumesToViewports which will add volumes to the specified viewports.