cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

is it possible to capture the active viewport as key image. by using measurement tool or any action button?

Open Malik-Adil opened this issue 7 years ago • 1 comments

I am working on some medical product and I need to capture the current state of the image which is loading in the canvas. Is any function available for capturing the image into some form e.g base64, jpeg, png, etc

Malik-Adil avatar May 31 '19 09:05 Malik-Adil

MDN Docs: HtmlCanvasElement.toDataURL()

Keep in mind, this will create an exact copy of what's currently displayed in the viewport. More robust methods might include:

- Serializing the annotation/viewport data, and sending it to the server to create a new image
- Adjusting the canvas, before capture, to show ideal image

CornerstoneTools has a saveAs utility that does the basics:

  • https://github.com/cornerstonejs/cornerstoneTools/blob/4bbdf329b58d2e593302a580c14fc95609b07a8e/src/util/SaveAs.js

Past related comments:

  • https://github.com/cornerstonejs/cornerstone/issues/325#issuecomment-435966847
  • https://github.com/cornerstonejs/cornerstoneTools/issues/260

dannyrb avatar May 31 '19 12:05 dannyrb