annotate Applications/Samples/SingleFrameEditorApplication.h @ 490:6470248790db bgo-commands-codegen

ongoing codegen work
author bgo-osimis
date Mon, 18 Feb 2019 15:38:05 +0100
parents ee41b6a017d7
children 801d2697a1b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
1 /**
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 418
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
6 *
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
11 *
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
16 *
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
19 **/
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
20
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
21
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
22 #pragma once
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
23
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
24 #include "SampleApplicationBase.h"
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
25
415
c0589c3173fd finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 414
diff changeset
26 #include "../../Framework/Radiography/RadiographyLayerCropTracker.h"
414
f7616c010056 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
27 #include "../../Framework/Radiography/RadiographyLayerMoveTracker.h"
415
c0589c3173fd finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 414
diff changeset
28 #include "../../Framework/Radiography/RadiographyLayerResizeTracker.h"
414
f7616c010056 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
29 #include "../../Framework/Radiography/RadiographyLayerRotateTracker.h"
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
30 #include "../../Framework/Radiography/RadiographyScene.h"
414
f7616c010056 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
31 #include "../../Framework/Radiography/RadiographySceneCommand.h"
413
18b707fb8620 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
32 #include "../../Framework/Radiography/RadiographyWidget.h"
415
c0589c3173fd finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 414
diff changeset
33 #include "../../Framework/Radiography/RadiographyWindowingTracker.h"
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
34 #include "../../Framework/Radiography/RadiographySceneWriter.h"
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
35 #include "../../Framework/Radiography/RadiographySceneReader.h"
359
100df90bf0ea preparing to implement Export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 358
diff changeset
36
418
c23df8b3433b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
37 #include <Core/HttpClient.h>
343
712acc87fa2e text layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 342
diff changeset
38 #include <Core/Images/FontRegistry.h>
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
39 #include <Core/Logging.h>
403
99e31898910e IObservable.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 393
diff changeset
40 #include <Core/OrthancException.h>
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
41
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
42
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
43 // Export using PAM is faster than using PNG, but requires Orthanc
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
44 // core >= 1.4.3
362
12cec26d08ce export of a valid DICOM CR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 361
diff changeset
45 #define EXPORT_USING_PAM 1
12cec26d08ce export of a valid DICOM CR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 361
diff changeset
46
340
f5d5814a41a0 rendering BitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 339
diff changeset
47
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
48 namespace OrthancStone
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
49 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
50 namespace Samples
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
51 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
52 class RadiographyEditorInteractor :
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
53 public IWorldSceneInteractor,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
54 public IObserver
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
55 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
56 private:
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
57 enum Tool
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
58 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
59 Tool_Move,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
60 Tool_Rotate,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
61 Tool_Crop,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
62 Tool_Resize,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
63 Tool_Windowing
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
64 };
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
65
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
66
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
67 StoneApplicationContext* context_;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
68 UndoRedoStack undoRedoStack_;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
69 Tool tool_;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
70
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
71
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
72 static double GetHandleSize()
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
73 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
74 return 10.0;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
75 }
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
76
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
77
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
78 public:
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
79 RadiographyEditorInteractor(MessageBroker& broker) :
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
80 IObserver(broker),
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
81 context_(NULL),
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
82 tool_(Tool_Move)
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
83 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
84 }
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
85
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
86 void SetContext(StoneApplicationContext& context)
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
87 {
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
88 context_ = &context;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
89 }
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
90
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
91 virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& worldWidget,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
92 const ViewportGeometry& view,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
93 MouseButton button,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
94 KeyboardModifiers modifiers,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
95 int viewportX,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
96 int viewportY,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
97 double x,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
98 double y,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
99 IStatusBar* statusBar)
357
ec4ad6c5eb99 avoid breaking class hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 356
diff changeset
100 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
101 RadiographyWidget& widget = dynamic_cast<RadiographyWidget&>(worldWidget);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
102
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
103 if (button == MouseButton_Left)
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
104 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
105 size_t selected;
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
106
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
107 if (tool_ == Tool_Windowing)
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
108 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
109 return new RadiographyWindowingTracker(
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
110 undoRedoStack_, widget.GetScene(),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
111 viewportX, viewportY,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
112 RadiographyWindowingTracker::Action_DecreaseWidth,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
113 RadiographyWindowingTracker::Action_IncreaseWidth,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
114 RadiographyWindowingTracker::Action_DecreaseCenter,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
115 RadiographyWindowingTracker::Action_IncreaseCenter);
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
116 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
117 else if (!widget.LookupSelectedLayer(selected))
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
118 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
119 // No layer is currently selected
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
120 size_t layer;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
121 if (widget.GetScene().LookupLayer(layer, x, y))
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
122 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
123 widget.Select(layer);
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
124 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
125
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
126 return NULL;
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
127 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
128 else if (tool_ == Tool_Crop ||
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
129 tool_ == Tool_Resize)
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
130 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
131 RadiographyScene::LayerAccessor accessor(widget.GetScene(), selected);
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
132
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
133 Corner corner;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
134 if (accessor.GetLayer().LookupCorner(corner, x, y, view.GetZoom(), GetHandleSize()))
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
135 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
136 switch (tool_)
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
137 {
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
138 case Tool_Crop:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
139 return new RadiographyLayerCropTracker
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
140 (undoRedoStack_, widget.GetScene(), view, selected, x, y, corner);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
141
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
142 case Tool_Resize:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
143 return new RadiographyLayerResizeTracker
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
144 (undoRedoStack_, widget.GetScene(), selected, x, y, corner,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
145 (modifiers & KeyboardModifiers_Shift));
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
146
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
147 default:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
148 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
149 }
384
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
150 }
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
151 else
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
152 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
153 size_t layer;
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
154
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
155 if (widget.GetScene().LookupLayer(layer, x, y))
384
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
156 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
157 widget.Select(layer);
384
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
158 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
159 else
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
160 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
161 widget.Unselect();
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
162 }
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
163
384
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
164 return NULL;
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
165 }
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
166 }
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
167 else
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
168 {
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
169 size_t layer;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
170
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
171 if (widget.GetScene().LookupLayer(layer, x, y))
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
172 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
173 if (layer == selected)
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
174 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
175 switch (tool_)
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
176 {
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
177 case Tool_Move:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
178 return new RadiographyLayerMoveTracker
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
179 (undoRedoStack_, widget.GetScene(), layer, x, y,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
180 (modifiers & KeyboardModifiers_Shift));
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
181
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
182 case Tool_Rotate:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
183 return new RadiographyLayerRotateTracker
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
184 (undoRedoStack_, widget.GetScene(), view, layer, x, y,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
185 (modifiers & KeyboardModifiers_Shift));
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
186
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
187 default:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
188 break;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
189 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
190
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
191 return NULL;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
192 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
193 else
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
194 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
195 widget.Select(layer);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
196 return NULL;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
197 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
198 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
199 else
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
200 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
201 widget.Unselect();
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
202 return NULL;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
203 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
204 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
205 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
206 else
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
207 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
208 return NULL;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
209 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
210 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
211
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
212 virtual void MouseOver(CairoContext& context,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
213 WorldSceneWidget& worldWidget,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
214 const ViewportGeometry& view,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
215 double x,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
216 double y,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
217 IStatusBar* statusBar)
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
218 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
219 RadiographyWidget& widget = dynamic_cast<RadiographyWidget&>(worldWidget);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
220
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
221 #if 0
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
222 if (statusBar != NULL)
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
223 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
224 char buf[64];
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
225 sprintf(buf, "X = %.02f Y = %.02f (in cm)", x / 10.0, y / 10.0);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
226 statusBar->SetMessage(buf);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
227 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
228 #endif
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
229
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
230 size_t selected;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
231
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
232 if (widget.LookupSelectedLayer(selected) &&
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
233 (tool_ == Tool_Crop ||
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
234 tool_ == Tool_Resize))
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
235 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
236 RadiographyScene::LayerAccessor accessor(widget.GetScene(), selected);
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
237
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
238 Corner corner;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
239 if (accessor.GetLayer().LookupCorner(corner, x, y, view.GetZoom(), GetHandleSize()))
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
240 {
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
241 accessor.GetLayer().GetCorner(x, y, corner);
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
242
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
243 double z = 1.0 / view.GetZoom();
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
244
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
245 context.SetSourceColor(255, 0, 0);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
246 cairo_t* cr = context.GetObject();
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
247 cairo_set_line_width(cr, 2.0 * z);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
248 cairo_move_to(cr, x - GetHandleSize() * z, y - GetHandleSize() * z);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
249 cairo_line_to(cr, x + GetHandleSize() * z, y - GetHandleSize() * z);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
250 cairo_line_to(cr, x + GetHandleSize() * z, y + GetHandleSize() * z);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
251 cairo_line_to(cr, x - GetHandleSize() * z, y + GetHandleSize() * z);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
252 cairo_line_to(cr, x - GetHandleSize() * z, y - GetHandleSize() * z);
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
253 cairo_stroke(cr);
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
254 }
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
255 }
339
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 338
diff changeset
256 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
257
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
258 virtual void MouseWheel(WorldSceneWidget& widget,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
259 MouseWheelDirection direction,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
260 KeyboardModifiers modifiers,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
261 IStatusBar* statusBar)
344
fdec8e6893cb ordering of bitmap layers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 343
diff changeset
262 {
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
263 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
264
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
265 virtual void KeyPressed(WorldSceneWidget& worldWidget,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
266 KeyboardKeys key,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
267 char keyChar,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
268 KeyboardModifiers modifiers,
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
269 IStatusBar* statusBar)
345
55438b1ca317 drawing borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 344
diff changeset
270 {
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
271 RadiographyWidget& widget = dynamic_cast<RadiographyWidget&>(worldWidget);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
272
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
273 switch (keyChar)
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
274 {
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
275 case 'a':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
276 widget.FitContent();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
277 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
278
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
279 case 'c':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
280 tool_ = Tool_Crop;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
281 break;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
282
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
283 case 'd':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
284 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
285 // dump to json and reload
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
286 Json::Value snapshot;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
287 RadiographySceneWriter writer;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
288 writer.Write(snapshot, widget.GetScene());
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
289
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
290 LOG(INFO) << "JSON export was successful: "
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
291 << snapshot.toStyledString();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
292
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
293 boost::shared_ptr<RadiographyScene> scene(new RadiographyScene(GetBroker()));
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
294 RadiographySceneReader reader(*scene, context_->GetOrthancApiClient());
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
295
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
296 Orthanc::FontRegistry fontRegistry;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
297 fontRegistry.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
298
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
299 reader.SetFontRegistry(fontRegistry);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
300 reader.Read(snapshot);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
301
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
302 widget.SetScene(scene);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
303 };break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
304
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
305 case 'e':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
306 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
307 Orthanc::DicomMap tags;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
308
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
309 // Minimal set of tags to generate a valid CR image
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
310 tags.SetValue(Orthanc::DICOM_TAG_ACCESSION_NUMBER, "NOPE", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
311 tags.SetValue(Orthanc::DICOM_TAG_BODY_PART_EXAMINED, "PELVIS", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
312 tags.SetValue(Orthanc::DICOM_TAG_INSTANCE_NUMBER, "1", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
313 //tags.SetValue(Orthanc::DICOM_TAG_LATERALITY, "", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
314 tags.SetValue(Orthanc::DICOM_TAG_MANUFACTURER, "OSIMIS", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
315 tags.SetValue(Orthanc::DICOM_TAG_MODALITY, "CR", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
316 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_BIRTH_DATE, "20000101", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
317 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_ID, "hello", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
318 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_NAME, "HELLO^WORLD", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
319 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_ORIENTATION, "", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
320 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_SEX, "M", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
321 tags.SetValue(Orthanc::DICOM_TAG_REFERRING_PHYSICIAN_NAME, "HOUSE^MD", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
322 tags.SetValue(Orthanc::DICOM_TAG_SERIES_NUMBER, "1", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
323 tags.SetValue(Orthanc::DICOM_TAG_SOP_CLASS_UID, "1.2.840.10008.5.1.4.1.1.1", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
324 tags.SetValue(Orthanc::DICOM_TAG_STUDY_ID, "STUDY", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
325 tags.SetValue(Orthanc::DICOM_TAG_VIEW_POSITION, "", false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
326
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
327 if (context_ != NULL)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
328 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
329 widget.GetScene().ExportDicom(context_->GetOrthancApiClient(),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
330 tags, std::string(), 0.1, 0.1, widget.IsInverted(),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
331 widget.GetInterpolation(), EXPORT_USING_PAM);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
332 }
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
333
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
334 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
335 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
336
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
337 case 'i':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
338 widget.SwitchInvert();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
339 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
340
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
341 case 'm':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
342 tool_ = Tool_Move;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
343 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
344
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
345 case 'n':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
346 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
347 switch (widget.GetInterpolation())
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
348 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
349 case ImageInterpolation_Nearest:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
350 LOG(INFO) << "Switching to bilinear interpolation";
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
351 widget.SetInterpolation(ImageInterpolation_Bilinear);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
352 break;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
353
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
354 case ImageInterpolation_Bilinear:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
355 LOG(INFO) << "Switching to nearest neighbor interpolation";
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
356 widget.SetInterpolation(ImageInterpolation_Nearest);
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
357 break;
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
358
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
359 default:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
360 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
361 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
362
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
363 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
364 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
365
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
366 case 'r':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
367 tool_ = Tool_Rotate;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
368 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
369
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
370 case 's':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
371 tool_ = Tool_Resize;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
372 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
373
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
374 case 'w':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
375 tool_ = Tool_Windowing;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
376 break;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
377
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
378 case 'y':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
379 if (modifiers & KeyboardModifiers_Control)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
380 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
381 undoRedoStack_.Redo();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
382 widget.NotifyContentChanged();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
383 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
384 break;
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
385
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
386 case 'z':
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
387 if (modifiers & KeyboardModifiers_Control)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
388 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
389 undoRedoStack_.Undo();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
390 widget.NotifyContentChanged();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
391 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
392 break;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
393
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
394 default:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
395 break;
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
396 }
345
55438b1ca317 drawing borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 344
diff changeset
397 }
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
398 };
336
c7fdc8bac581 creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 334
diff changeset
399
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
400
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
401
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
402 class SingleFrameEditorApplication :
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
403 public SampleSingleCanvasApplicationBase,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
404 public IObserver
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
405 {
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
406 private:
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
407 boost::shared_ptr<RadiographyScene> scene_;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
408 RadiographyEditorInteractor interactor_;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
409 Orthanc::FontRegistry fontRegistry_;
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
410
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
411 public:
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
412 SingleFrameEditorApplication(MessageBroker& broker) :
362
12cec26d08ce export of a valid DICOM CR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 361
diff changeset
413 IObserver(broker),
12cec26d08ce export of a valid DICOM CR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 361
diff changeset
414 interactor_(broker)
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
415 {
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
416 }
384
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
417
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
418 virtual ~SingleFrameEditorApplication()
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
419 {
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
420 LOG(WARNING) << "Destroying the application";
d20d75f20c5d better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
421 }
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
422
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
423 virtual void DeclareStartupOptions(boost::program_options::options_description& options)
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
424 {
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
425 boost::program_options::options_description generic("Sample options");
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
426 generic.add_options()
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
427 ("instance", boost::program_options::value<std::string>(),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
428 "Orthanc ID of the instance")
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
429 ("frame", boost::program_options::value<unsigned int>()->default_value(0),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
430 "Number of the frame, for multi-frame DICOM instances")
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
431 ;
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
432
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
433 options.add(generic);
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
434 }
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
435
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
436 virtual void Initialize(StoneApplicationContext* context,
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
437 IStatusBar& statusBar,
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
438 const boost::program_options::variables_map& parameters)
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
439 {
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
440 using namespace OrthancStone;
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
441
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
442 context_ = context;
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
443 interactor_.SetContext(*context);
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
444
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
445 statusBar.SetMessage("Use the key \"a\" to reinitialize the layout");
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
446 statusBar.SetMessage("Use the key \"c\" to crop");
359
100df90bf0ea preparing to implement Export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 358
diff changeset
447 statusBar.SetMessage("Use the key \"e\" to export DICOM to the Orthanc server");
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
448 statusBar.SetMessage("Use the key \"f\" to switch full screen");
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
449 statusBar.SetMessage("Use the key \"i\" to invert contrast");
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
450 statusBar.SetMessage("Use the key \"m\" to move objects");
359
100df90bf0ea preparing to implement Export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 358
diff changeset
451 statusBar.SetMessage("Use the key \"n\" to switch between nearest neighbor and bilinear interpolation");
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
452 statusBar.SetMessage("Use the key \"r\" to rotate objects");
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
453 statusBar.SetMessage("Use the key \"s\" to resize objects (not applicable to DICOM layers)");
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
454 statusBar.SetMessage("Use the key \"w\" to change windowing");
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
455
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
456 statusBar.SetMessage("Use the key \"ctrl-z\" to undo action");
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
457 statusBar.SetMessage("Use the key \"ctrl-y\" to redo action");
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
458
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
459 if (parameters.count("instance") != 1)
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
460 {
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
461 LOG(ERROR) << "The instance ID is missing";
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
462 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
463 }
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
464
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
465 std::string instance = parameters["instance"].as<std::string>();
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
466 int frame = parameters["frame"].as<unsigned int>();
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
467
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
468 fontRegistry_.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16);
343
712acc87fa2e text layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 342
diff changeset
469
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
470 scene_.reset(new RadiographyScene(GetBroker()));
445
ee41b6a017d7 dumb change
bgo-osimis
parents: 440
diff changeset
471 scene_->LoadDicomFrame(context->GetOrthancApiClient(), instance, 0, false, NULL);
418
c23df8b3433b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
472
c23df8b3433b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
473 #if !defined(ORTHANC_ENABLE_WASM) || ORTHANC_ENABLE_WASM != 1
c23df8b3433b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
474 Orthanc::HttpClient::ConfigureSsl(true, "/etc/ssl/certs/ca-certificates.crt");
c23df8b3433b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
475 #endif
c23df8b3433b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
476
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
477 //scene_->LoadDicomWebFrame(context->GetWebService());
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 415
diff changeset
478
354
f806779bd40f UndoRedoStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 353
diff changeset
479 {
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
480 RadiographyLayer& layer = scene_->LoadText(fontRegistry_.GetFont(0), "Hello\nworld", NULL);
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
481 layer.SetResizeable(true);
354
f806779bd40f UndoRedoStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 353
diff changeset
482 }
f806779bd40f UndoRedoStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 353
diff changeset
483
f806779bd40f UndoRedoStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 353
diff changeset
484 {
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 428
diff changeset
485 RadiographyLayer& layer = scene_->LoadTestBlock(100, 50, NULL);
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
486 layer.SetResizeable(true);
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
487 layer.SetPan(0, 200);
354
f806779bd40f UndoRedoStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 353
diff changeset
488 }
f806779bd40f UndoRedoStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 353
diff changeset
489
337
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 336
diff changeset
490
428
751fb354149e ability to change the scene of the RadiographyWidget
am@osimis.io
parents: 418
diff changeset
491 mainWidget_ = new RadiographyWidget(GetBroker(), scene_, "main-widget");
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
492 mainWidget_->SetTransmitMouseOver(true);
358
b8eeb49f3e65 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
493 mainWidget_->SetInteractor(interactor_);
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
494
407
842a3c7cfdc0 renames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 403
diff changeset
495 //scene_->SetWindowing(128, 256);
325
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
496 }
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
497 };
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
498 }
37ab9d83dc9b reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff changeset
499 }