UNPKG

custom-cornerstone-tools

Version:

Medical imaging tools for the Cornerstone library - customized for DrNuvem

145 lines (121 loc) 4.83 kB
<!DOCTYPE HTML> <html> <head> <!-- support for mobile touch devices --> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"> <!-- twitter bootstrap CSS stylesheet - not required by cornerstoneTools --> <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> <link href="../cornerstone.min.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="page-header"> <h1> Freehand drawing </h1> <p> This page demonstrates how to use the freehand drawing tool </p> <a href="../index.html">Go back to the Examples page</a> </div> <br> <div class="row"> <div class="col-xs-2"> <ul class="list-group"> <a id="disable" class="list-group-item">Disable</a> <a id="enable" class="list-group-item">Enable</a> <a id="activate" class="list-group-item">Activate</a> <a id="deactivate" class="list-group-item">Deactivate</a> </ul> <br/> <ul class="list-group"> <a id="clearToolData" class="list-group-item">Clear drawing</a> </ul> <br/> </div> <div class="col-xs-10"> <div style="width:512px;height:512px;position:relative;display:inline-block;color:white;" oncontextmenu="return false" class='cornerstone-enabled-image' unselectable='on' onselectstart='return false;' onmousedown='return false;'> <div id="dicomImage" style="width:512px;height:512px;top:0px;left:0px; position:absolute;"> </div> </div> </div> </div> <div class="row"> <div class="col-xs-12"> <h3>Functionality</h3> <ul> <li>Click to draw a point</li> <li>Keep clicking to draw a shape</li> <li>Hold Shift while dragging to draw freehand</li> <li>End the shape by connecting it to one of the other nodes</li> <li>Click elsewhere to start a new shape</li> </ul> </div> </div> </body> <!-- jquery - included to make things easier to demo, not needed or used by the cornerstone library but is used by our example image loader--> <script src="../jquery.min.js"></script> <!-- include the cornerstone library --> <script src="../cornerstone.min.js"></script> <script src="../cornerstoneMath.min.js"></script> <!-- include the cornerstone tools library --> <script src="../../dist/cornerstoneTools.js"></script> <!-- include special code for these examples which provides images --> <script src="../exampleImageLoader.js"></script> <script> var element = $('#dicomImage').get(0); var imageId = 'example://1'; cornerstoneTools.toolStyle.setToolWidth(3); cornerstoneTools.toolColors.setToolColor("#ffcc33"); cornerstoneTools.toolColors.setActiveColor("#0099ff"); cornerstoneTools.toolColors.setFillColor("#0099ff"); // image enable the dicomImage element cornerstone.enable(element); cornerstone.loadImage(imageId).then(function(image) { cornerstone.displayImage(element, image); cornerstoneTools.mouseInput.enable(element); // Enable all tools we want to use with this element cornerstoneTools.freehand.activate(element, 1); activate("#activate"); function activate(id) { $('a').removeClass('active'); $(id).addClass('active'); } // Tool button event handlers that set the new active tool $('#disable').click(function() { activate("#disable"); cornerstoneTools.freehand.disable(element); return false; }); $('#enable').click(function() { activate("#enable"); cornerstoneTools.freehand.enable(element); return false; }); $('#activate').click(function() { activate("#activate"); cornerstoneTools.freehand.activate(element, 1); return false; }); $('#deactivate').click(function() { activate("#deactivate"); cornerstoneTools.freehand.deactivate(element, 1); return false; }); $('#clearToolData').click(function() { var toolStateManager = cornerstoneTools.getElementToolStateManager(element); // Note that this only works on ImageId-specific tool state managers (for now) toolStateManager.clear(element) cornerstone.updateImage(element); }); }); </script> </html>