From 01bd4f729b82ffae888e2ab65918c2c2f1a8341e Mon Sep 17 00:00:00 2001 From: ilia Date: Sun, 30 Oct 2022 14:43:40 +0300 Subject: [PATCH] add contrast --- index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 9c81fc6..c307fdb 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,8 @@ var tools = { type: 'factory' }, ZoomAndPan: {}, - WindowLevel: {} + WindowLevel: {}, + Filter: {} }; app.init({ @@ -28,6 +29,7 @@ app.addEventListener('load', function () { app.setDrawShape('Circle') }); + function createCircle(circleData) { var point1 = new dwv.math.Point2D(circleData.center.x, circleData.center.y) var point2 = new dwv.math.Point2D(circleData.center.x, circleData.center.y+circleData.radius) @@ -191,6 +193,9 @@ function receiveMessage(event) else if (data.type == 'deleteSelected') { app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().find('#'+findActive())[0].destroy() } + else if (data.type == 'setContrast') { + document.getElementById("layerGroup0").style = `filter: contrast(${data.data}%);` + } } window.addEventListener("message", receiveMessage, false); @@ -219,11 +224,10 @@ app.addEventListener('loadend', function () { //range.max = app.getImage(0).getGeometry().getSize().get(2) - 1; }); -//app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm']) +app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm']) app.addEventListener('load', () => { - app.setTool('Scroll') - + // createCircle({ // type: 'Circle', // center: {