Function: renderToCanvasGPU()
renderToCanvasGPU(
canvas
,imageOrVolume
,modality
,renderingEngineId
,viewportOptions
):Promise
<CanvasLoadPosition
>
Renders an cornerstone image to a Canvas. This method will handle creation of a temporary enabledElement, setting the imageId, and rendering the image via a StackViewport, copying the canvas drawing to the given canvas Element, and disabling the created temporary element. SuppressEvents argument is used to prevent events from firing during the render process (e.g. during a series of renders to a thumbnail image).
Parameters
• canvas: HTMLCanvasElement
Canvas element to render to
• imageOrVolume: IImage
| ImageVolumeProps
The image to render
• modality: any
= undefined
[Default = undefined] The modality of the image
• renderingEngineId: string
= '_thumbnails'
• viewportOptions: ViewportInputOptions
& object
= ...
Returns
Promise
<CanvasLoadPosition
>
- A promise that resolves when the image has been rendered with the imageId
Example
const canvas = document.getElementById('myCanvas')
renderToCanvasGPU(canvas, image)