comparison Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApp.js @ 1388:240531afdd2d

Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 28 Apr 2020 08:57:39 +0200
parents c0e4eb14c912
children 27e0a00bd3e8
comparison
equal deleted inserted replaced
1387:4ebf246f3919 1388:240531afdd2d
7 this._LoadDicomWeb = undefined; 7 this._LoadDicomWeb = undefined;
8 }; 8 };
9 9
10 WasmModuleWrapper.prototype.Setup = function(Module) { 10 WasmModuleWrapper.prototype.Setup = function(Module) {
11 this._InitializeViewport = Module.cwrap('InitializeViewport', null, [ 'string' ]); 11 this._InitializeViewport = Module.cwrap('InitializeViewport', null, [ 'string' ]);
12 this._LoadOrthanc = Module.cwrap('LoadOrthanc', null, [ 'string', 'int' ]); 12 this._LoadFromOrthanc = Module.cwrap('LoadFromOrthanc', null, [ 'string', 'int' ]);
13 this._LoadDicomWeb = Module.cwrap('LoadDicomWeb', null, [ 'string', 'string', 'string', 'string', 'int' ]); 13 this._LoadFromDicomWeb = Module.cwrap('LoadFromDicomWeb', null, [ 'string', 'string', 'string', 'string', 'int' ]);
14 }; 14 };
15 15
16 WasmModuleWrapper.prototype.InitializeViewport = function(canvasId) { 16 WasmModuleWrapper.prototype.InitializeViewport = function(canvasId) {
17 this._InitializeViewport(canvasId); 17 this._InitializeViewport(canvasId);
18 }; 18 };
19 19
20 WasmModuleWrapper.prototype.LoadOrthanc = function(instance, frame) { 20 WasmModuleWrapper.prototype.LoadFromOrthanc = function(instance, frame) {
21 this._LoadOrthanc(instance, frame); 21 this._LoadFromOrthanc(instance, frame);
22 }; 22 };
23 23
24 WasmModuleWrapper.prototype.LoadDicomWeb = function(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame) { 24 WasmModuleWrapper.prototype.LoadFromDicomWeb = function(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame) {
25 this._LoadDicomWeb(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame); 25 this._LoadFromDicomWeb(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame);
26 }; 26 };
27 27
28 var moduleWrapper = new WasmModuleWrapper(); 28 var wasmModuleWrapper = new WasmModuleWrapper();
29 29
30 $(document).ready(function() { 30 $(document).ready(function() {
31 31
32 window.addEventListener('StoneInitialized', function() { 32 window.addEventListener('WasmModuleInitialized', function() {
33 stone.Setup(Module); 33 wasmModuleWrapper.Setup(Module);
34 console.warn('Native Stone properly intialized'); 34 console.warn('Native C++ module initialized');
35 35
36 stone.InitializeViewport('viewport'); 36 wasmModuleWrapper.InitializeViewport('viewport');
37 }); 37 });
38 38
39 window.addEventListener('StoneException', function() { 39 window.addEventListener('StoneException', function() {
40 alert('Exception caught in Stone'); 40 alert('Exception caught in C++ code');
41 }); 41 });
42 42
43 var scriptSource; 43 var scriptSource;
44 44
45 if ('WebAssembly' in window) { 45 if ('WebAssembly' in window) {
73 }); 73 });
74 }); 74 });
75 75
76 76
77 $('#orthancLoad').click(function() { 77 $('#orthancLoad').click(function() {
78 stone.LoadOrthanc($('#orthancInstance').val(), 78 wasmModuleWrapper.LoadFromOrthanc($('#orthancInstance').val(),
79 $('#orthancFrame').val()); 79 $('#orthancFrame').val());
80 }); 80 });
81
82
83 $('#dicomWebLoad').click(function() {
84 stone.LoadDicomWeb($('#dicomWebServer').val(),
85 $('#dicomWebStudy').val(),
86 $('#dicomWebSeries').val(),
87 $('#dicomWebInstance').val(),
88 $('#dicomWebFrame').val());
89 });