add post & bug with draw

This commit is contained in:
Firesieht 2022-10-27 22:10:43 +03:00
parent 31fbe19e99
commit 5d8272d364
2 changed files with 66 additions and 10 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}

View File

@ -1,18 +1,71 @@
// create the dwv app var filterList = ['Threshold', 'Sharpen', 'Sobel'];
var app = new dwv.App();
// initialise with the id of the container div var shapeList = [
app.init({ 'Arrow',
dataViewConfigs: {'*': [{divId: 'layerGroup0'}]}, 'Ruler',
tools: { 'Protractor',
Scroll: {} 'Rectangle',
'Roi',
'Ellipse',
'Circle',
'FreeHand'
];
var toolList = {
Scroll: {},
Opacity: {},
WindowLevel: {},
ZoomAndPan: {},
Draw: {
options: shapeList,
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
var options = {
dataViewConfigs: {'*': [{divId: 'layerGroup0'}]},
tools: toolList
};
// main application
var app = new dwv.App();
app.init(options);
// activate tool once done loading // activate tool once done loading
app.addEventListener('load', function () { app.addEventListener('load', function () {
app.setTool('Scroll'); app.setTool('Scroll');
app.setTool('Draw');
app.setDrawShape(toolList.Draw.options[0]);
}); });
// load dicom data
app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm','https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323707.dcm','https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323563.dcm']);
function receiveMessage(event)
{
console.log(event.data, "FFFFFFFFF")
let data = JSON.parse(event.data)
if (data.type == "setDicom"){
app.loadURLs([data.data])
} else if(data.type == "setTool"){
app.setTool('Draw');
app.setDrawShape("Circle");
}
}
window.addEventListener("message", receiveMessage, false);
// //
var range = document.getElementById('sliceRange'); var range = document.getElementById('sliceRange');