UNPKG

cornerstone-tools-cacalc

Version:

Medical imaging tools for the Cornerstone library with added functionality for computing Agatston calcium scores

88 lines (63 loc) 3.42 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>util/setContextToDisplayFontSize.js - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#applyWWWCRegion">applyWWWCRegion</a></li><li><a href="global.html#calculateMinMaxMean">calculateMinMaxMean</a></li><li><a href="global.html#createMagnificationCanvas">createMagnificationCanvas</a></li><li><a href="global.html#dragCallback">dragCallback</a></li><li><a href="global.html#drawMagnificationTool">drawMagnificationTool</a></li><li><a href="global.html#getPlayClipTimeouts">getPlayClipTimeouts</a></li><li><a href="global.html#mouseDownCallback">mouseDownCallback</a></li><li><a href="global.html#mouseUpCallback">mouseUpCallback</a></li><li><a href="global.html#onImageRendered">onImageRendered</a></li><li><a href="global.html#performThresholding">performThresholding</a></li><li><a href="global.html#playClip">playClip</a></li><li><a href="global.html#recordStartPoint">recordStartPoint</a></li><li><a href="global.html#removeMagnificationCanvas">removeMagnificationCanvas</a></li><li><a href="global.html#stopClip">stopClip</a></li><li><a href="global.html#stopClipWithData">stopClipWithData</a></li><li><a href="global.html#triggerStopEvent">triggerStopEvent</a></li></ul> </nav> <div id="main"> <h1 class="page-title">util/setContextToDisplayFontSize.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>import * as cornerstone from '../cornerstone-core.js'; /** * Sets the canvas context transformation matrix so it is scaled to show text * more cleanly even if the image is scaled up. See * https://github.com/chafey/cornerstoneTools/wiki/DrawingText * for more information * * @param enabledElement * @param context * @param fontSize * @returns {{fontSize: number, lineHeight: number, fontScale: number}} */ export default function (enabledElement, context, fontSize) { const fontScale = 0.1; cornerstone.setToPixelCoordinateSystem(enabledElement, context, fontScale); // Return the font size to use const scaledFontSize = fontSize / enabledElement.viewport.scale / fontScale; // TODO: actually calculate this? const lineHeight = fontSize / enabledElement.viewport.scale / fontScale; return { fontSize: scaledFontSize, lineHeight, fontScale }; } </code></pre> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>