annotate Applications/Samples/SampleApplicationBase.h @ 1327:4f8db2d202c8 broker

OrthancSeriesProgressiveLoader now has two modes that can be selected at object creation : - progressive (will first load jpeg50, then jpeg90 then PAM) - non-progressive (will directly load PAM (uncompressed)) Please note that the slice loading order remains dynamic and depending upon the slice that the client code wishes to extract from the volume.
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 25 Mar 2020 14:34:27 +0100
parents 7ec8fea061b9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
15 * Affero General Public License for more details.
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
16 *
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
288
8c8da145fefa renamings and doc
am@osimis.io
parents: 285
diff changeset
24 #include "../../Applications/IStoneApplication.h"
732
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
25 #include "../../Framework/Deprecated/Widgets/WorldSceneWidget.h"
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
26
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
27 #if ORTHANC_ENABLE_WASM==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
28 #include "../../Platforms/Wasm/WasmPlatformApplicationAdapter.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
29 #include "../../Platforms/Wasm/Defaults.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
30 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
31
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
32 #if ORTHANC_ENABLE_QT==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
33 #include "Qt/SampleMainWindow.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
34 #include "Qt/SampleMainWindowWithButtons.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
35 #endif
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 namespace OrthancStone
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Samples
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
288
8c8da145fefa renamings and doc
am@osimis.io
parents: 285
diff changeset
41 class SampleApplicationBase : public IStoneApplication
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
1069
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
43 private:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
44 boost::shared_ptr<Deprecated::IWidget> mainWidget_;
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
45
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 public:
288
8c8da145fefa renamings and doc
am@osimis.io
parents: 285
diff changeset
47 virtual void Initialize(StoneApplicationContext* context,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
48 Deprecated::IStatusBar& statusBar,
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
49 const boost::program_options::variables_map& parameters) ORTHANC_OVERRIDE
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
50 {
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
51 }
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
52
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
53 virtual std::string GetTitle() const ORTHANC_OVERRIDE
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 return "Stone of Orthanc - Sample";
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 }
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
57
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
58 /**
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
59 * In the basic samples, the commands are handled by the platform adapter and NOT
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
60 * by the application handler
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
61 */
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
62 virtual void HandleSerializedMessage(const char* data) ORTHANC_OVERRIDE {};
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
63
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
64
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
65 virtual void Finalize() ORTHANC_OVERRIDE {}
1069
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
67 virtual void SetCentralWidget(boost::shared_ptr<Deprecated::IWidget> widget) ORTHANC_OVERRIDE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
68 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
69 mainWidget_ = widget;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
70 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
71
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
72 virtual boost::shared_ptr<Deprecated::IWidget> GetCentralWidget() ORTHANC_OVERRIDE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
73 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
74 return mainWidget_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
75 }
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
76
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
77 #if ORTHANC_ENABLE_WASM==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
78 // default implementations for a single canvas named "canvas" in the HTML and an emtpy WasmApplicationAdapter
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
79
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
80 virtual void InitializeWasm() ORTHANC_OVERRIDE
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
81 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
82 AttachWidgetToWasmViewport("canvas", mainWidget_);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
83 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
84
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
85 virtual WasmPlatformApplicationAdapter* CreateWasmApplicationAdapter(MessageBroker& broker)
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
86 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
87 return new WasmPlatformApplicationAdapter(broker, *this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
88 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
89 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
90
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
91 };
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
92
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
93 // this application actually works in Qt and WASM
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
94 class SampleSingleCanvasWithButtonsApplicationBase : public SampleApplicationBase
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
95 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
96 public:
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
97 virtual void OnPushButton1Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
98 virtual void OnPushButton2Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
99 virtual void OnTool1Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
100 virtual void OnTool2Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
101
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
102 virtual void GetButtonNames(std::string& pushButton1,
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
103 std::string& pushButton2,
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
104 std::string& tool1,
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
105 std::string& tool2
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
106 ) {
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
107 pushButton1 = "action1";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
108 pushButton2 = "action2";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
109 tool1 = "tool1";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
110 tool2 = "tool2";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
111 }
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
112
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
113 #if ORTHANC_ENABLE_QT==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
114 virtual QStoneMainWindow* CreateQtMainWindow() {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
115 return new SampleMainWindowWithButtons(dynamic_cast<OrthancStone::NativeStoneApplicationContext&>(*context_), *this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
116 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
117 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
118
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
119 };
307
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 295
diff changeset
120
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
121 // this application actually works in SDL and WASM
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
122 class SampleSingleCanvasApplicationBase : public SampleApplicationBase
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
123 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
124 public:
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
125
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
126 #if ORTHANC_ENABLE_QT==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
127 virtual QStoneMainWindow* CreateQtMainWindow() {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
128 return new SampleMainWindow(dynamic_cast<OrthancStone::NativeStoneApplicationContext&>(*context_), *this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
129 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
130 #endif
221
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents: 134
diff changeset
131 };
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }