annotate Applications/Samples/SimpleViewerApplicationSingleFile.h @ 1307:8a28a9bf8876 broker

ViewportController now gets a ref to its parent viewport for proper lock usage
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 04 Mar 2020 10:07:37 +0100
parents 7ec8fea061b9
children c38c89684d83
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
1 /**
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
6 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
11 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
16 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
19 **/
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
20
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
21
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
22 #pragma once
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
23
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
24 #include "SampleApplicationBase.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
25
732
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
26 #include "../../Framework/Deprecated/Layers/CircleMeasureTracker.h"
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
27 #include "../../Framework/Deprecated/Layers/LineMeasureTracker.h"
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
28 #include "../../Framework/Deprecated/SmartLoader.h"
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
29 #include "../../Framework/Deprecated/Widgets/LayoutWidget.h"
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
30 #include "../../Framework/Deprecated/Widgets/SliceViewerWidget.h"
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
31 #include "../../Framework/Messages/IObserver.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
32
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
33 #if ORTHANC_ENABLE_WASM==1
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
34 #include "../../Platforms/Wasm/WasmPlatformApplicationAdapter.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
35 #include "../../Platforms/Wasm/Defaults.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
36 #endif
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
37
365
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
38 #include <Core/Images/Font.h>
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
39 #include <Core/Logging.h>
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
40
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
41 namespace OrthancStone
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
42 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
43 namespace Samples
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
44 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
45 class SimpleViewerApplication :
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
46 public SampleSingleCanvasWithButtonsApplicationBase,
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
47 public ObserverBase<SimpleViewerApplication>
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
48 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
49 private:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
50 class ThumbnailInteractor : public Deprecated::IWorldSceneInteractor
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
51 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
52 private:
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
53 SimpleViewerApplication& application_;
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
54
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
55 public:
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
56 ThumbnailInteractor(SimpleViewerApplication& application) :
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
57 application_(application)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
58 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
59 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
60
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
61 virtual Deprecated::IWorldSceneMouseTracker* CreateMouseTracker(Deprecated::WorldSceneWidget& widget,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
62 const Deprecated::ViewportGeometry& view,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
63 MouseButton button,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
64 KeyboardModifiers modifiers,
356
885f0a5eaa49 mouse tracker to set windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 336
diff changeset
65 int viewportX,
885f0a5eaa49 mouse tracker to set windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 336
diff changeset
66 int viewportY,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
67 double x,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
68 double y,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
69 Deprecated::IStatusBar* statusBar,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
70 const std::vector<Deprecated::Touch>& displayTouches)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
71 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
72 if (button == MouseButton_Left)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
73 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
74 statusBar->SetMessage("selected thumbnail " + widget.GetName());
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
75 std::string seriesId = widget.GetName().substr(strlen("thumbnail-series-"));
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
76 application_.SelectSeriesInMainViewport(seriesId);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
77 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
78 return NULL;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
79 }
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
80
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
81 virtual void MouseOver(CairoContext& context,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
82 Deprecated::WorldSceneWidget& widget,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
83 const Deprecated::ViewportGeometry& view,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
84 double x,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
85 double y,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
86 Deprecated::IStatusBar* statusBar)
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
87 {
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
88 }
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
89
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
90 virtual void MouseWheel(Deprecated::WorldSceneWidget& widget,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
91 MouseWheelDirection direction,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
92 KeyboardModifiers modifiers,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
93 Deprecated::IStatusBar* statusBar)
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
94 {
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
95 }
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
96
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
97 virtual void KeyPressed(Deprecated::WorldSceneWidget& widget,
327
8716176ff7f0 added support for arrow keys
am@osimis.io
parents: 326
diff changeset
98 KeyboardKeys key,
8716176ff7f0 added support for arrow keys
am@osimis.io
parents: 326
diff changeset
99 char keyChar,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
100 KeyboardModifiers modifiers,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
101 Deprecated::IStatusBar* statusBar)
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
102 {
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
103 }
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
104 };
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
105
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
106 class MainWidgetInteractor : public Deprecated::IWorldSceneInteractor
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
107 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
108 private:
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
109 SimpleViewerApplication& application_;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
110
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
111 public:
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
112 MainWidgetInteractor(SimpleViewerApplication& application) :
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
113 application_(application)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
114 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
115 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
116
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
117 virtual Deprecated::IWorldSceneMouseTracker* CreateMouseTracker(Deprecated::WorldSceneWidget& widget,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
118 const Deprecated::ViewportGeometry& view,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
119 MouseButton button,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
120 KeyboardModifiers modifiers,
356
885f0a5eaa49 mouse tracker to set windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 336
diff changeset
121 int viewportX,
885f0a5eaa49 mouse tracker to set windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 336
diff changeset
122 int viewportY,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
123 double x,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
124 double y,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
125 Deprecated::IStatusBar* statusBar,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
126 const std::vector<Deprecated::Touch>& displayTouches)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
127 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
128 if (button == MouseButton_Left)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
129 {
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
130 if (application_.currentTool_ == Tool_LineMeasure)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
131 {
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
132 return new Deprecated::LineMeasureTracker(statusBar, dynamic_cast<Deprecated::SliceViewerWidget&>(widget).GetSlice(),
367
face7b7008de line and circle measure tools are now compatible with WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 366
diff changeset
133 x, y, 255, 0, 0, application_.GetFont());
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
134 }
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
135 else if (application_.currentTool_ == Tool_CircleMeasure)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
136 {
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
137 return new Deprecated::CircleMeasureTracker(statusBar, dynamic_cast<Deprecated::SliceViewerWidget&>(widget).GetSlice(),
365
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
138 x, y, 255, 0, 0, application_.GetFont());
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
139 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
140 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
141 return NULL;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
142 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
143
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
144 virtual void MouseOver(CairoContext& context,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
145 Deprecated::WorldSceneWidget& widget,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
146 const Deprecated::ViewportGeometry& view,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
147 double x,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
148 double y,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
149 Deprecated::IStatusBar* statusBar)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
150 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
151 if (statusBar != NULL)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
152 {
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
153 Vector p = dynamic_cast<Deprecated::SliceViewerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
154
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
155 char buf[64];
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
156 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)",
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
157 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
158 statusBar->SetMessage(buf);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
159 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
160 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
161
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
162 virtual void MouseWheel(Deprecated::WorldSceneWidget& widget,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
163 MouseWheelDirection direction,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
164 KeyboardModifiers modifiers,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
165 Deprecated::IStatusBar* statusBar)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
166 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
167 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
168
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
169 virtual void KeyPressed(Deprecated::WorldSceneWidget& widget,
327
8716176ff7f0 added support for arrow keys
am@osimis.io
parents: 326
diff changeset
170 KeyboardKeys key,
8716176ff7f0 added support for arrow keys
am@osimis.io
parents: 326
diff changeset
171 char keyChar,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
172 KeyboardModifiers modifiers,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
173 Deprecated::IStatusBar* statusBar)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
174 {
327
8716176ff7f0 added support for arrow keys
am@osimis.io
parents: 326
diff changeset
175 switch (keyChar)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
176 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
177 case 's':
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
178 widget.FitContent();
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
179 break;
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
180
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
181 case 'l':
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
182 application_.currentTool_ = Tool_LineMeasure;
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
183 break;
366
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 365
diff changeset
184
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
185 case 'c':
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
186 application_.currentTool_ = Tool_CircleMeasure;
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
187 break;
366
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 365
diff changeset
188
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
189 default:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
190 break;
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
191 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
192 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
193 };
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
194
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
195
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
196 #if ORTHANC_ENABLE_WASM==1
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
197 class SimpleViewerApplicationAdapter : public WasmPlatformApplicationAdapter
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
198 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
199 SimpleViewerApplication& viewerApplication_;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
200
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
201 public:
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
202 SimpleViewerApplicationAdapter(SimpleViewerApplication& application)
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
203 : WasmPlatformApplicationAdapter(application),
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
204 viewerApplication_(application)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
205 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
206 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
207
508
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
208 virtual void HandleSerializedMessageFromWeb(std::string& output, const std::string& input)
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
209 {
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
210 if (input == "select-tool:line-measure")
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
211 {
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
212 viewerApplication_.currentTool_ = Tool_LineMeasure;
522
700aa66f2f29 Removed deleted file from cmakelists + fixed renames in compilation. Samples build OK in WAS but still not fully functional
Benjamin Golinvaux <bgo@osimis.io>
parents: 508
diff changeset
213 NotifyStatusUpdateFromCppToWebWithString("currentTool=line-measure");
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
214 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
215 else if (input == "select-tool:circle-measure")
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
216 {
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
217 viewerApplication_.currentTool_ = Tool_CircleMeasure;
522
700aa66f2f29 Removed deleted file from cmakelists + fixed renames in compilation. Samples build OK in WAS but still not fully functional
Benjamin Golinvaux <bgo@osimis.io>
parents: 508
diff changeset
218 NotifyStatusUpdateFromCppToWebWithString("currentTool=circle-measure");
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
219 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
220
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
221 output = "ok";
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
222 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
223
508
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
224 virtual void NotifySerializedMessageFromCppToWeb(const std::string& statusUpdateMessage)
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
225 {
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
226 UpdateStoneApplicationStatusFromCppWithSerializedMessage(statusUpdateMessage.c_str());
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
227 }
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
228
522
700aa66f2f29 Removed deleted file from cmakelists + fixed renames in compilation. Samples build OK in WAS but still not fully functional
Benjamin Golinvaux <bgo@osimis.io>
parents: 508
diff changeset
229 virtual void NotifyStatusUpdateFromCppToWebWithString(const std::string& statusUpdateMessage)
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
230 {
508
7105a0bad250 - Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents: 467
diff changeset
231 UpdateStoneApplicationStatusFromCppWithString(statusUpdateMessage.c_str());
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
232 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
233
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
234 };
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
235 #endif
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
236 enum Tool {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
237 Tool_LineMeasure,
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
238 Tool_CircleMeasure
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
239 };
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
240
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
241 Tool currentTool_;
334
c34784e5f299 compatibility fixes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 330
diff changeset
242 std::auto_ptr<MainWidgetInteractor> mainWidgetInteractor_;
c34784e5f299 compatibility fixes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 330
diff changeset
243 std::auto_ptr<ThumbnailInteractor> thumbnailInteractor_;
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
244 Deprecated::LayoutWidget* mainLayout_;
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
245 Deprecated::LayoutWidget* thumbnailsLayout_;
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
246 std::vector<boost::shared_ptr<Deprecated::SliceViewerWidget> > thumbnails_;
334
c34784e5f299 compatibility fixes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 330
diff changeset
247
c34784e5f299 compatibility fixes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 330
diff changeset
248 std::map<std::string, std::vector<std::string> > instancesIdsPerSeriesId_;
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
249 std::map<std::string, Json::Value> seriesTags_;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
250
334
c34784e5f299 compatibility fixes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 330
diff changeset
251 unsigned int currentInstanceIndex_;
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
252 Deprecated::WidgetViewport* wasmViewport1_;
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
253 Deprecated::WidgetViewport* wasmViewport2_;
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
254
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
255 Deprecated::IStatusBar* statusBar_;
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
256 std::auto_ptr<Deprecated::SmartLoader> smartLoader_;
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
257
365
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
258 Orthanc::Font font_;
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
259
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
260 public:
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
261 SimpleViewerApplication() :
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
262 currentTool_(Tool_LineMeasure),
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
263 mainLayout_(NULL),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
264 currentInstanceIndex_(0),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
265 wasmViewport1_(NULL),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
266 wasmViewport2_(NULL)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
267 {
365
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
268 font_.LoadFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
269 // DeclareIgnoredMessage(MessageType_Widget_ContentChanged);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
270 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
271
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
272 virtual void DeclareStartupOptions(boost::program_options::options_description& options)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
273 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
274 boost::program_options::options_description generic("Sample options");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
275 generic.add_options()
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
276 ("studyId", boost::program_options::value<std::string>(),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
277 "Orthanc ID of the study")
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
278 ;
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
279
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
280 options.add(generic);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
281 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
282
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
283 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
284 Deprecated::IStatusBar& statusBar,
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
285 const boost::program_options::variables_map& parameters)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
286 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
287 using namespace OrthancStone;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
288
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
289 context_ = context;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
290 statusBar_ = &statusBar;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
291
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
292 {// initialize viewports and layout
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
293 mainLayout_ = new Deprecated::LayoutWidget("main-layout");
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
294 mainLayout_->SetPadding(10);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
295 mainLayout_->SetBackgroundCleared(true);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
296 mainLayout_->SetBackgroundColor(0, 0, 0);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
297 mainLayout_->SetHorizontal();
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
298
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
299 boost::shared_ptr<Deprecated::LayoutWidget> thumbnailsLayout_(new Deprecated::LayoutWidget("thumbnail-layout"));
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
300 thumbnailsLayout_->SetPadding(10);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
301 thumbnailsLayout_->SetBackgroundCleared(true);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
302 thumbnailsLayout_->SetBackgroundColor(50, 50, 50);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
303 thumbnailsLayout_->SetVertical();
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
304
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
305 boost::shared_ptr<Deprecated::SliceViewerWidget> widget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
306 (new Deprecated::SliceViewerWidget("main-viewport"));
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
307 SetCentralWidget(widget);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
308 //mainWidget_->RegisterObserver(*this);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
309
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
310 // hierarchy
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
311 mainLayout_->AddWidget(thumbnailsLayout_);
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
312 mainLayout_->AddWidget(widget);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
313
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
314 // sources
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
315 smartLoader_.reset(new Deprecated::SmartLoader(context->GetOrthancApiClient()));
739
be9c1530d40a deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
316 smartLoader_->SetImageQuality(Deprecated::SliceImageQuality_FullPam);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
317
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
318 mainLayout_->SetTransmitMouseOver(true);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
319 mainWidgetInteractor_.reset(new MainWidgetInteractor(*this));
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
320 widget->SetInteractor(*mainWidgetInteractor_);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
321 thumbnailInteractor_.reset(new ThumbnailInteractor(*this));
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
322 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
323
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
324 statusBar.SetMessage("Use the key \"s\" to reinitialize the layout");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
325 statusBar.SetMessage("Use the key \"n\" to go to next image in the main viewport");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
326
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
327
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
328 if (parameters.count("studyId") < 1)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
329 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
330 LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc";
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
331 context->GetOrthancApiClient()->GetJsonAsync(
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
332 "/studies",
1222
21c2b0eee53c deprecating MessageHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1070
diff changeset
333 new Deprecated::DeprecatedCallable<SimpleViewerApplication, Deprecated::OrthancApiClient::JsonResponseReadyMessage>
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
334 (GetSharedObserver(), &SimpleViewerApplication::OnStudyListReceived));
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
335 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
336 else
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
337 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
338 SelectStudy(parameters["studyId"].as<std::string>());
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
339 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
340 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
341
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
342 void OnStudyListReceived(const Deprecated::OrthancApiClient::JsonResponseReadyMessage& message)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
343 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
344 const Json::Value& response = message.GetJson();
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
345
411
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 406
diff changeset
346 if (response.isArray() &&
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 406
diff changeset
347 response.size() >= 1)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
348 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
349 SelectStudy(response[0].asString());
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
350 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
351 }
411
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 406
diff changeset
352
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
353 void OnStudyReceived(const Deprecated::OrthancApiClient::JsonResponseReadyMessage& message)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
354 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
355 const Json::Value& response = message.GetJson();
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
356
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
357 if (response.isObject() && response["Series"].isArray())
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
358 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
359 for (size_t i=0; i < response["Series"].size(); i++)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
360 {
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
361 context_->GetOrthancApiClient()->GetJsonAsync(
388
20f149669c1f renamed LayerWidget as SliceViewerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
362 "/series/" + response["Series"][(int)i].asString(),
1222
21c2b0eee53c deprecating MessageHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1070
diff changeset
363 new Deprecated::DeprecatedCallable<SimpleViewerApplication, Deprecated::OrthancApiClient::JsonResponseReadyMessage>
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
364 (GetSharedObserver(), &SimpleViewerApplication::OnSeriesReceived));
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
365 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
366 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
367 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
368
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
369 void OnSeriesReceived(const Deprecated::OrthancApiClient::JsonResponseReadyMessage& message)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
370 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
371 const Json::Value& response = message.GetJson();
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
372
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
373 if (response.isObject() &&
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
374 response["Instances"].isArray() &&
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
375 response["Instances"].size() > 0)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
376 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
377 // keep track of all instances IDs
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
378 const std::string& seriesId = response["ID"].asString();
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
379 seriesTags_[seriesId] = response;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
380 instancesIdsPerSeriesId_[seriesId] = std::vector<std::string>();
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
381 for (size_t i = 0; i < response["Instances"].size(); i++)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
382 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
383 const std::string& instanceId = response["Instances"][static_cast<int>(i)].asString();
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
384 instancesIdsPerSeriesId_[seriesId].push_back(instanceId);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
385 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
386
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
387 // load the first instance in the thumbnail
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
388 LoadThumbnailForSeries(seriesId, instancesIdsPerSeriesId_[seriesId][0]);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
389
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
390 // if this is the first thumbnail loaded, load the first instance in the mainWidget
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
391 Deprecated::SliceViewerWidget& widget = dynamic_cast<Deprecated::SliceViewerWidget&>(*GetCentralWidget());
336
c7fdc8bac581 creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 334
diff changeset
392 if (widget.GetLayerCount() == 0)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
393 {
336
c7fdc8bac581 creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 334
diff changeset
394 smartLoader_->SetFrameInWidget(widget, 0, instancesIdsPerSeriesId_[seriesId][0], 0);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
395 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
396 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
397 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
398
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
399 void LoadThumbnailForSeries(const std::string& seriesId, const std::string& instanceId)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
400 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
401 LOG(INFO) << "Loading thumbnail for series " << seriesId;
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
402 boost::shared_ptr<Deprecated::SliceViewerWidget> thumbnailWidget(new Deprecated::SliceViewerWidget("thumbnail-series-" + seriesId));
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
403 thumbnails_.push_back(thumbnailWidget);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
404 thumbnailsLayout_->AddWidget(thumbnailWidget);
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
405 Register<Deprecated::SliceViewerWidget::GeometryChangedMessage>(*thumbnailWidget, &SimpleViewerApplication::OnWidgetGeometryChanged);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
406 smartLoader_->SetFrameInWidget(*thumbnailWidget, 0, instanceId, 0);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
407 thumbnailWidget->SetInteractor(*thumbnailInteractor_);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
408 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
409
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
410 void SelectStudy(const std::string& studyId)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
411 {
411
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 406
diff changeset
412 LOG(INFO) << "Selecting study: " << studyId;
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
413 context_->GetOrthancApiClient()->GetJsonAsync(
1222
21c2b0eee53c deprecating MessageHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1070
diff changeset
414 "/studies/" + studyId, new Deprecated::DeprecatedCallable<SimpleViewerApplication, Deprecated::OrthancApiClient::JsonResponseReadyMessage>
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
415 (GetSharedObserver(), &SimpleViewerApplication::OnStudyReceived));
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
416 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
417
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
418 void OnWidgetGeometryChanged(const Deprecated::SliceViewerWidget::GeometryChangedMessage& message)
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
419 {
406
5d359b115b29 use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 396
diff changeset
420 // TODO: The "const_cast" could probably be replaced by "mainWidget"
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
421 const_cast<Deprecated::SliceViewerWidget&>(message.GetOrigin()).FitContent();
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
422 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
423
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
424 void SelectSeriesInMainViewport(const std::string& seriesId)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
425 {
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
426 Deprecated::SliceViewerWidget& widget = dynamic_cast<Deprecated::SliceViewerWidget&>(*GetCentralWidget());
336
c7fdc8bac581 creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 334
diff changeset
427 smartLoader_->SetFrameInWidget(widget, 0, instancesIdsPerSeriesId_[seriesId][0], 0);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
428 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
429
365
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
430 const Orthanc::Font& GetFont() const
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
431 {
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
432 return font_;
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
433 }
ef31240a73f6 no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
434
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
435 virtual void OnPushButton1Clicked() {}
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
436 virtual void OnPushButton2Clicked() {}
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
437 virtual void OnTool1Clicked() { currentTool_ = Tool_LineMeasure;}
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents: 522
diff changeset
438 virtual void OnTool2Clicked() { currentTool_ = Tool_CircleMeasure;}
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
439
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
440 virtual void GetButtonNames(std::string& pushButton1,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
441 std::string& pushButton2,
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
442 std::string& tool1,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
443 std::string& tool2)
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
444 {
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
445 tool1 = "line";
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
446 tool2 = "circle";
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
447 pushButton1 = "action1";
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
448 pushButton2 = "action2";
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
449 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
450
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
451 #if ORTHANC_ENABLE_WASM==1
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
452 virtual void InitializeWasm()
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 367
diff changeset
453 {
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
454 AttachWidgetToWasmViewport("canvas", thumbnailsLayout_);
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
455 AttachWidgetToWasmViewport("canvas2", widget);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
456 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
457 #endif
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
458
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
459 };
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
460 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
461 }