# HG changeset patch # User Benjamin Golinvaux # Date 1588057059 -7200 # Node ID 240531afdd2dd36d42536124b3779e85256f8ad3 # Parent 4ebf246f391984aadf24bbf9808bb02717ef425e Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes diff -r 4ebf246f3919 -r 240531afdd2d Samples/Sdl/SdlHelpers.h --- a/Samples/Sdl/SdlHelpers.h Mon Apr 27 16:49:03 2020 +0200 +++ b/Samples/Sdl/SdlHelpers.h Tue Apr 28 08:57:39 2020 +0200 @@ -93,44 +93,5 @@ p.SetControlModifier(modifiers & KeyboardModifiers_Control); p.SetShiftModifier(modifiers & KeyboardModifiers_Shift); } - - //inline void ParseCommonCommandLineArguments() - //{ - - // po::options_description description("Usage:"); - - // description.add_options() - // ("trace", "Enable TRACE logging mode (default: false)") - // ("info", "Enable INFO logging mode (default: false)") - // ("orthanc", po::value()->default_value("http://localhost:8042"), "Base URL of the Orthanc instance") - - // po::variables_map vm; - // po::store(po::command_line_parser(argc, argv).options(description).run(), vm); - // po::notify(vm); - - // if (vm.count("help")) - // { - - // } - - // if (vm.count("compression")) - // { - // cout << "Compression level " << vm["compression"].as() << endl; - // } - - // return 0; - - //} - - //inline void DeclareOptionAndDefault(boost::program_options::options_description& options, - // const std::string& flag, const std::string& defaultValue, - // std::string help = "") - //{ - // description.add_options() - // (flag, po::value()->default_value(defaultValue), help); - //} - - //inline void ProcessOptions - } diff -r 4ebf246f3919 -r 240531afdd2d Samples/WebAssembly/SingleFrameViewer/CMakeLists.txt --- a/Samples/WebAssembly/SingleFrameViewer/CMakeLists.txt Mon Apr 27 16:49:03 2020 +0200 +++ b/Samples/WebAssembly/SingleFrameViewer/CMakeLists.txt Tue Apr 28 08:57:39 2020 +0200 @@ -70,6 +70,5 @@ ${CMAKE_SOURCE_DIR}/SingleFrameViewerApp.js ${CMAKE_SOURCE_DIR}/index.html ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm - ${CMAKE_SOURCE_DIR}/WasmWrapper.js DESTINATION ${CMAKE_INSTALL_PREFIX} ) diff -r 4ebf246f3919 -r 240531afdd2d Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp --- a/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp Mon Apr 27 16:49:03 2020 +0200 +++ b/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp Tue Apr 28 08:57:39 2020 +0200 @@ -44,37 +44,11 @@ namespace OrthancStone { - class Observer : public IWebViewerLoadersObserver - { - public: - virtual void SignalSeriesUpdated(LoadedDicomResources& series) - { - LOG(INFO) << "====================================="; - LOG(INFO) << series.GetSize() << " series"; - - /*for (size_t i = 0; i < series.GetSize(); i++) - { - series.GetResource(i).Print(stdout); - printf("\n"); - }*/ - } - - virtual void SignalThumbnailLoaded(const std::string& studyInstanceUid, - const std::string& seriesInstanceUid, - SeriesThumbnailType type) - { - LOG(INFO) << "*** Thumbnail loaded: " << studyInstanceUid << " / " - << seriesInstanceUid << " (type " << type << ")"; - } - }; } - - static std::auto_ptr context_; static boost::shared_ptr application_; - extern "C" { int main(int argc, char const *argv[]) @@ -95,13 +69,12 @@ context_->SetLocalOrthanc(".."); context_->SetDicomCacheSize(128 * 1024 * 1024); // 128MB - DISPATCH_JAVASCRIPT_EVENT("StoneInitialized"); + DISPATCH_JAVASCRIPT_EVENT("WasmModuleInitialized"); } EXTERN_CATCH_EXCEPTIONS; return 0; } - EMSCRIPTEN_KEEPALIVE void InitializeViewport(const char* canvasId) @@ -120,43 +93,9 @@ "Only one single viewport is available for this application"); } - { - std::auto_ptr observer(new OrthancStone::Observer); - -#if 1 - OrthancStone::DicomSource source1; - //source1.SetDicomWebSource("http://localhost:8042/dicom-web"); source1.SetDicomWebRendered(true); - source1.SetDicomWebThroughOrthancSource("self"); source1.SetDicomWebRendered(true); - //source1.SetDicomWebThroughOrthancSource("my-google"); source1.SetDicomWebRendered(false); - boost::shared_ptr app2( - OrthancStone::WebViewerLoaders::Create(*context_, source1, true, observer.release())); -#else - OrthancStone::DicomSource source1; - source1.SetOrthancSource(); - boost::shared_ptr app2( - OrthancStone::WebViewerLoaders::Create(*context_, source1, true, observer.release())); - //app2->AddOrthancStudy("27f7126f-4f66fb14-03f4081b-f9341db2-53925988"); - //app2->AddOrthancSeries("1e2c125c-411b8e86-3f4fe68e-a7584dd3-c6da78f0"); -#endif - - // BRAINIX - //app2->AddDicomAllSeries(); - //app2->AddDicomStudy("2.16.840.1.113669.632.20.1211.10000357775"); - app2->AddDicomSeries("2.16.840.1.113669.632.20.1211.10000357775", "1.3.46.670589.11.0.0.11.4.2.0.8743.5.3800.2006120117110979000"); // Standard image: type 5 - - app2->AddDicomStudy("1.3.51.0.7.633920140505.6339234439.633987.633918098"); // "Video" type 4: video720p.dcm - app2->AddDicomStudy("1.2.276.0.7230010.3.1.2.2344313775.14992.1458058404.7528"); // "PDF" type 3: pdf.dcm - app2->AddDicomSeries("1.2.276.0.7230010.3.1.2.296485376.1.1568899779.944131", "1.2.276.0.7230010.3.1.3.296485376.1.1568899781.944588"); // RTSTRUCT, "Unsupported" type 2: DICOM/WebViewer2/TFE/IMAGES/IM452 - - - //app2->AddDicomStudy("1.2.276.0.7230010.3.1.2.380371456.1.1544616291.954997"); // CSPO - } - boost::shared_ptr viewport(OrthancStone::GetWebGLViewportsRegistry().Add(canvasId)); application_ = OrthancStone::Application::Create(*context_, viewport); - // Paint the viewport to black - { OrthancStone::WebGLViewportsRegistry::Accessor accessor( OrthancStone::GetWebGLViewportsRegistry(), canvasId); @@ -172,8 +111,8 @@ EMSCRIPTEN_KEEPALIVE - void LoadOrthanc(const char* instance, - int frame) + void LoadFromOrthanc(const char* instance, + int frame) { try { @@ -188,11 +127,11 @@ EMSCRIPTEN_KEEPALIVE - void LoadDicomWeb(const char* server, - const char* studyInstanceUid, - const char* seriesInstanceUid, - const char* sopInstanceUid, - int frame) + void LoadFromDicomWeb(const char* server, + const char* studyInstanceUid, + const char* seriesInstanceUid, + const char* sopInstanceUid, + int frame) { try { diff -r 4ebf246f3919 -r 240531afdd2d Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApp.js --- a/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApp.js Mon Apr 27 16:49:03 2020 +0200 +++ b/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApp.js Tue Apr 28 08:57:39 2020 +0200 @@ -9,35 +9,35 @@ WasmModuleWrapper.prototype.Setup = function(Module) { this._InitializeViewport = Module.cwrap('InitializeViewport', null, [ 'string' ]); - this._LoadOrthanc = Module.cwrap('LoadOrthanc', null, [ 'string', 'int' ]); - this._LoadDicomWeb = Module.cwrap('LoadDicomWeb', null, [ 'string', 'string', 'string', 'string', 'int' ]); + this._LoadFromOrthanc = Module.cwrap('LoadFromOrthanc', null, [ 'string', 'int' ]); + this._LoadFromDicomWeb = Module.cwrap('LoadFromDicomWeb', null, [ 'string', 'string', 'string', 'string', 'int' ]); }; WasmModuleWrapper.prototype.InitializeViewport = function(canvasId) { this._InitializeViewport(canvasId); }; -WasmModuleWrapper.prototype.LoadOrthanc = function(instance, frame) { - this._LoadOrthanc(instance, frame); +WasmModuleWrapper.prototype.LoadFromOrthanc = function(instance, frame) { + this._LoadFromOrthanc(instance, frame); }; -WasmModuleWrapper.prototype.LoadDicomWeb = function(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame) { - this._LoadDicomWeb(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame); +WasmModuleWrapper.prototype.LoadFromDicomWeb = function(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame) { + this._LoadFromDicomWeb(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame); }; -var moduleWrapper = new WasmModuleWrapper(); +var wasmModuleWrapper = new WasmModuleWrapper(); $(document).ready(function() { - window.addEventListener('StoneInitialized', function() { - stone.Setup(Module); - console.warn('Native Stone properly intialized'); + window.addEventListener('WasmModuleInitialized', function() { + wasmModuleWrapper.Setup(Module); + console.warn('Native C++ module initialized'); - stone.InitializeViewport('viewport'); + wasmModuleWrapper.InitializeViewport('viewport'); }); window.addEventListener('StoneException', function() { - alert('Exception caught in Stone'); + alert('Exception caught in C++ code'); }); var scriptSource; @@ -75,15 +75,6 @@ $('#orthancLoad').click(function() { - stone.LoadOrthanc($('#orthancInstance').val(), + wasmModuleWrapper.LoadFromOrthanc($('#orthancInstance').val(), $('#orthancFrame').val()); }); - - -$('#dicomWebLoad').click(function() { - stone.LoadDicomWeb($('#dicomWebServer').val(), - $('#dicomWebStudy').val(), - $('#dicomWebSeries').val(), - $('#dicomWebInstance').val(), - $('#dicomWebFrame').val()); -}); diff -r 4ebf246f3919 -r 240531afdd2d Samples/WebAssembly/SingleFrameViewer/WasmWrapper.js --- a/Samples/WebAssembly/SingleFrameViewer/WasmWrapper.js Mon Apr 27 16:49:03 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - -const Stone = function() { - this._InitializeViewport = undefined; - this._LoadOrthanc = undefined; - this._LoadDicomWeb = undefined; -}; - -Stone.prototype.Setup = function(Module) { - this._InitializeViewport = Module.cwrap('InitializeViewport', null, [ 'string' ]); - this._LoadOrthanc = Module.cwrap('LoadOrthanc', null, [ 'string', 'int' ]); - this._LoadDicomWeb = Module.cwrap('LoadDicomWeb', null, [ 'string', 'string', 'string', 'string', 'int' ]); -}; - -Stone.prototype.InitializeViewport = function(canvasId) { - this._InitializeViewport(canvasId); -}; - -Stone.prototype.LoadOrthanc = function(instance, frame) { - this._LoadOrthanc(instance, frame); -}; - -Stone.prototype.LoadDicomWeb = function(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame) { - this._LoadDicomWeb(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame); -}; - -var stone = new Stone(); - diff -r 4ebf246f3919 -r 240531afdd2d Samples/WebAssembly/SingleFrameViewer/index.html --- a/Samples/WebAssembly/SingleFrameViewer/index.html Mon Apr 27 16:49:03 2020 +0200 +++ b/Samples/WebAssembly/SingleFrameViewer/index.html Tue Apr 28 08:57:39 2020 +0200 @@ -27,10 +27,6 @@

Orthanc instance: - -

Frame number: @@ -39,33 +35,9 @@

-

Load from DICOMweb

-

- Server name in Orthanc: -

-

- Study instance UID: -

-

- Series instance UID: -

-

- SOP instance UID: -

-

- Frame number: -

-

- -

- -