annotate OrthancStone/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp @ 1518:433cf964838d

prevents random config. names + typofix + doc
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 31 Jul 2020 12:47:27 +0200
parents 244ad1e4e76a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1457
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
1 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
2 * Stone of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
4 * Department, University Hospital of Liege, Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
6 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
7 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
10 * the License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
11 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
12 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
15 * Affero General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
16 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
19 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
21
1377
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 #include "SingleFrameViewerApplication.h"
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23
1512
244ad1e4e76a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1507
diff changeset
24 #include "../../../Sources/Loaders/WebAssemblyLoadersContext.h"
244ad1e4e76a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1507
diff changeset
25 #include "../../../Sources/StoneException.h"
244ad1e4e76a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1507
diff changeset
26 #include "../../../Sources/StoneInitialization.h"
1377
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27
1507
169adf9090a6 replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
28 #include <Compatibility.h> // For std::unique_ptr<>
1457
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1388
diff changeset
29 #include <Toolbox.h>
1377
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 #include <emscripten.h>
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 #include <emscripten/html5.h>
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
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 #define DISPATCH_JAVASCRIPT_EVENT(name) \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 EM_ASM( \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 const customEvent = document.createEvent("CustomEvent"); \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 customEvent.initCustomEvent(name, false, false, undefined); \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 window.dispatchEvent(customEvent); \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 );
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 #define EXTERN_CATCH_EXCEPTIONS \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 catch (Orthanc::OrthancException& e) \
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 LOG(ERROR) << "OrthancException: " << e.What(); \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \
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 catch (OrthancStone::StoneException& e) \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 { \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 LOG(ERROR) << "StoneException: " << e.What(); \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \
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 catch (std::exception& e) \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 { \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 LOG(ERROR) << "Runtime error: " << e.what(); \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \
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 catch (...) \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 { \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 LOG(ERROR) << "Native exception"; \
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \
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
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64
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 namespace OrthancStone
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
1507
169adf9090a6 replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
70 static std::unique_ptr<OrthancStone::WebAssemblyLoadersContext> context_;
1377
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 static boost::shared_ptr<OrthancStone::Application> application_;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 extern "C"
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 int main(int argc, char const *argv[])
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 try
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 Orthanc::Logging::Initialize();
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 Orthanc::Logging::EnableInfoLevel(true);
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 //Orthanc::Logging::EnableTraceLevel(true);
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 LOG(WARNING) << "Initializing native Stone";
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 LOG(WARNING) << "Compiled with Emscripten " << __EMSCRIPTEN_major__
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 << "." << __EMSCRIPTEN_minor__
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 << "." << __EMSCRIPTEN_tiny__;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88 LOG(INFO) << "Endianness: " << Orthanc::EnumerationToString(Orthanc::Toolbox::DetectEndianness());
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89 context_.reset(new OrthancStone::WebAssemblyLoadersContext(1, 4, 1));
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 context_->SetLocalOrthanc("..");
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 context_->SetDicomCacheSize(128 * 1024 * 1024); // 128MB
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92
1388
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
93 DISPATCH_JAVASCRIPT_EVENT("WasmModuleInitialized");
1377
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 }
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 EXTERN_CATCH_EXCEPTIONS;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 return 0;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 }
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 EMSCRIPTEN_KEEPALIVE
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
101 void InitializeViewport(const char* canvasId)
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 try
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
105 if (context_.get() == NULL)
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls,
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 "The loaders context is not available yet");
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
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 if (application_.get() != NULL)
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 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls,
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 "Only one single viewport is available for this application");
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
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117 boost::shared_ptr<OrthancStone::WebGLViewport> viewport(OrthancStone::GetWebGLViewportsRegistry().Add(canvasId));
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 application_ = OrthancStone::Application::Create(*context_, viewport);
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
120 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121 OrthancStone::WebGLViewportsRegistry::Accessor accessor(
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 OrthancStone::GetWebGLViewportsRegistry(), canvasId);
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 if (accessor.IsValid())
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 accessor.GetViewport().Invalidate();
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 }
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 EXTERN_CATCH_EXCEPTIONS;
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 EMSCRIPTEN_KEEPALIVE
1388
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
135 void LoadFromOrthanc(const char* instance,
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
136 int frame)
1377
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 try
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140 if (application_.get() != NULL)
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 OrthancStone::DicomSource source;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143 application_->LoadOrthancFrame(source, instance, frame);
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 }
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 EXTERN_CATCH_EXCEPTIONS;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147 }
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 EMSCRIPTEN_KEEPALIVE
1388
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
151 void LoadFromDicomWeb(const char* server,
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
152 const char* studyInstanceUid,
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
153 const char* seriesInstanceUid,
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
154 const char* sopInstanceUid,
240531afdd2d Dead code removal + removed untested Dicomweb + SingleFrameViewer wasm fixes
Benjamin Golinvaux <bgo@osimis.io>
parents: 1377
diff changeset
155 int frame)
1377
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 try
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 {
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 if (application_.get() != NULL)
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 OrthancStone::DicomSource source;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
162 source.SetDicomWebThroughOrthancSource(server);
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
163 application_->LoadDicomWebFrame(source, studyInstanceUid, seriesInstanceUid,
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 sopInstanceUid, frame);
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 }
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166 }
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 EXTERN_CATCH_EXCEPTIONS;
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 }
458ab069f313 Fixed missing file in WASM sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 }