cornerstone
cornerstone copied to clipboard
is it possible to capture the active viewport as key image. by using measurement tool or any action button?
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
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