Mercurial > hg > orthanc-stone
annotate Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp @ 2107:5970030a413c
Upgraded Emscripten version to 3.1.49
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 24 Nov 2023 11:29:46 +0100 |
parents | 07964689cb0b |
children | c23eef785569 |
rev | line source |
---|---|
1457 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
2077
07964689cb0b
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
07964689cb0b
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1457 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU Affero General Public License | |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Affero General Public License for more details. | |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
17 * |
1457 | 18 * You should have received a copy of the GNU Affero General Public License |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 #include "SingleFrameViewerApplication.h" |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 |
1902 | 25 #include "../../../../OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.h" |
26 #include "../../../../OrthancStone/Sources/Platforms/WebAssembly/WebGLViewport.h" | |
27 #include "../../../../OrthancStone/Sources/Platforms/WebAssembly/WebGLViewportsRegistry.h" | |
1543 | 28 #include "../../../../OrthancStone/Sources/StoneException.h" |
29 #include "../../../../OrthancStone/Sources/StoneInitialization.h" | |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 |
1507
169adf9090a6
replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
31 #include <Compatibility.h> // For std::unique_ptr<> |
1457 | 32 #include <Toolbox.h> |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 #include <emscripten.h> |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 #include <emscripten/html5.h> |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 #define DISPATCH_JAVASCRIPT_EVENT(name) \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 EM_ASM( \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 const customEvent = document.createEvent("CustomEvent"); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 customEvent.initCustomEvent(name, false, false, undefined); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 window.dispatchEvent(customEvent); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 ); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 #define EXTERN_CATCH_EXCEPTIONS \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 catch (Orthanc::OrthancException& e) \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 { \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 LOG(ERROR) << "OrthancException: " << e.What(); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
50 } \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 catch (OrthancStone::StoneException& e) \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 { \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 LOG(ERROR) << "StoneException: " << e.What(); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 } \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 catch (std::exception& e) \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 { \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 LOG(ERROR) << "Runtime error: " << e.what(); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
59 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 } \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
61 catch (...) \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 { \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 LOG(ERROR) << "Native exception"; \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 namespace OrthancStone |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 |
1507
169adf9090a6
replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
73 static std::unique_ptr<OrthancStone::WebAssemblyLoadersContext> context_; |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 static boost::shared_ptr<OrthancStone::Application> application_; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 extern "C" |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
78 int main(int argc, char const *argv[]) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
80 try |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 Orthanc::Logging::Initialize(); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 Orthanc::Logging::EnableInfoLevel(true); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 //Orthanc::Logging::EnableTraceLevel(true); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 LOG(WARNING) << "Initializing native Stone"; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
87 LOG(WARNING) << "Compiled with Emscripten " << __EMSCRIPTEN_major__ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 << "." << __EMSCRIPTEN_minor__ |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 << "." << __EMSCRIPTEN_tiny__; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 LOG(INFO) << "Endianness: " << Orthanc::EnumerationToString(Orthanc::Toolbox::DetectEndianness()); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
92 context_.reset(new OrthancStone::WebAssemblyLoadersContext(1, 4, 1)); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 context_->SetLocalOrthanc(".."); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
94 context_->SetDicomCacheSize(128 * 1024 * 1024); // 128MB |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
95 |
1388
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
96 DISPATCH_JAVASCRIPT_EVENT("WasmModuleInitialized"); |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 EXTERN_CATCH_EXCEPTIONS; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 return 0; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 EMSCRIPTEN_KEEPALIVE |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 void InitializeViewport(const char* canvasId) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 try |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
107 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 if (context_.get() == NULL) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
109 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 "The loaders context is not available yet"); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
112 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
113 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
114 if (application_.get() != NULL) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
115 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
116 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
117 "Only one single viewport is available for this application"); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
118 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
119 |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1543
diff
changeset
|
120 boost::shared_ptr<OrthancStone::WebGLViewport> viewport( |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1543
diff
changeset
|
121 OrthancStone::WebGLViewportsRegistry::GetGlobalRegistry().Add(canvasId)); |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
122 application_ = OrthancStone::Application::Create(*context_, viewport); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
123 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
124 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 OrthancStone::WebGLViewportsRegistry::Accessor accessor( |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1543
diff
changeset
|
126 OrthancStone::WebGLViewportsRegistry::GetGlobalRegistry(), canvasId); |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
127 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
128 if (accessor.IsValid()) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
129 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 accessor.GetViewport().Invalidate(); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
133 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 EXTERN_CATCH_EXCEPTIONS; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 EMSCRIPTEN_KEEPALIVE |
1388
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
139 void LoadFromOrthanc(const char* instance, |
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
140 int frame) |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 try |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 if (application_.get() != NULL) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 OrthancStone::DicomSource source; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 application_->LoadOrthancFrame(source, instance, frame); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 EXTERN_CATCH_EXCEPTIONS; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
153 |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 EMSCRIPTEN_KEEPALIVE |
1388
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
155 void LoadFromDicomWeb(const char* server, |
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
156 const char* studyInstanceUid, |
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
157 const char* seriesInstanceUid, |
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
158 const char* sopInstanceUid, |
240531afdd2d
Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1377
diff
changeset
|
159 int frame) |
1377
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 try |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
162 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
163 if (application_.get() != NULL) |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 { |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 OrthancStone::DicomSource source; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 source.SetDicomWebThroughOrthancSource(server); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
167 application_->LoadDicomWebFrame(source, studyInstanceUid, seriesInstanceUid, |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
168 sopInstanceUid, frame); |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
169 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
170 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
171 EXTERN_CATCH_EXCEPTIONS; |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
172 } |
458ab069f313
Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
173 } |