This commit is contained in:
Firesieht 2022-10-29 01:01:36 +03:00
commit c4c9651fdd
4 changed files with 42 additions and 53 deletions

3
dwv.js

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,25 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://cdn.rawgit.com/konvajs/konva/8.3.0/konva.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/i18next/21.6.0/i18next.min.js"></script>
<script type="text/javascript" src="https://github.com/ivmartel/dwv/releases/download/v0.30.4/dwv-0.30.4.min.js"></script>
<title>Document</title> <title>Document</title>
</head> </head>
<body> <body>
<div id="dwv"> <div id="dwv">
<div id="layerGroup0"></div> <div id="layerGroup0"></div>
</div> </div>
<input type="range" id="sliceRange" value="0"> <input type="range" id="sliceRange" value="0">
<script src="dwv.js"></script>
<script src="index.js"></script> <script src="index.js"></script>
</body> </body>
</html> </html>

View File

@ -1,55 +1,28 @@
var filterList = ['Threshold', 'Sharpen', 'Sobel'];
var shapeList = [ var app = new dwv.App();
'Arrow',
'Ruler',
'Protractor',
'Rectangle',
'Roi',
'Ellipse',
'Circle',
'FreeHand'
];
var toolList = { var tools = {
Scroll: {}, Scroll: {},
Opacity: {},
WindowLevel: {},
ZoomAndPan: {},
Draw: { Draw: {
options: shapeList, options: ['Circle', 'Roi'],
type: 'factory', type: 'factory'
events: ['drawcreate', 'drawchange', 'drawmove', 'drawdelete']
},
Livewire: {
events: ['drawcreate', 'drawchange', 'drawmove', 'drawdelete']
},
Filter: {
options: filterList,
type: 'instance',
events: ['filterrun', 'filterundo']
},
Floodfill: {
events: ['drawcreate', 'drawchange', 'drawmove', 'drawdelete']
} }
}; };
// initialise the application app.init({
var options = {
dataViewConfigs: {'*': [{divId: 'layerGroup0'}]}, dataViewConfigs: {'*': [{divId: 'layerGroup0'}]},
tools: toolList tools: tools
}; });
// main application
var app = new dwv.App();
app.init(options);
// activate tool once done loading
app.addEventListener('load', function () { app.addEventListener('load', function () {
app.setTool('Scroll'); app.setTool('Scroll');
app.setTool('Draw'); //var layer = new dwv.gui.DrawLayer('layerGroup0')
app.setDrawShape(toolList.Draw.options[0]); // factory = new dwv.tool.draw.CircleFactory();
// var point1 = new dwv.math.Point2D(10, 10)
// var point2 = new dwv.math.Point2D(10, 100)
// var draw = factory.create([point1, point2], app.getToolboxController().getSelectedTool().style, app.getActiveLayerGroup().getActiveViewLayer().getViewController())
// app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().add(draw)
// console.log(app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren()[0])
}); });
@ -60,14 +33,26 @@ function receiveMessage(event)
if (data.type == "setDicom"){ if (data.type == "setDicom"){
app.loadURLs([data.data]) app.loadURLs([data.data])
} else if(data.type == "setTool"){ } else if(data.type == "setTool"){
app.setTool('Draw'); if (data.data == "null"){
app.setDrawShape("Circle"); app.setTool('Scroll');
} else{
app.setTool('Draw');
app.setDrawShape(data.data);
}
} }
} }
window.addEventListener("message", receiveMessage, false); window.addEventListener("message", receiveMessage, false);
//
app.addEventListener("drawchange", function (){
console.log("DRAWWWWWW")
})
var range = document.getElementById('sliceRange'); var range = document.getElementById('sliceRange');
range.min = 0; range.min = 0;
app.addEventListener('loadend', function () { app.addEventListener('loadend', function () {

BIN
radiologic.zip Normal file

Binary file not shown.