Mercurial > hg > orthanc-stone
annotate Applications/Samples/SingleFrameEditorApplication.h @ 1138:1a73f852810a broker
integration mainline->broker
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 Nov 2019 07:28:39 +0100 |
parents | f7759637cdfb |
children | bdc6837d5917 |
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 | 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" |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
27 #include "../../Framework/Radiography/RadiographyLayerMaskTracker.h" |
414 | 28 #include "../../Framework/Radiography/RadiographyLayerMoveTracker.h" |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
414
diff
changeset
|
29 #include "../../Framework/Radiography/RadiographyLayerResizeTracker.h" |
414 | 30 #include "../../Framework/Radiography/RadiographyLayerRotateTracker.h" |
1089 | 31 #include "../../Framework/Radiography/RadiographyMaskLayer.h" |
408 | 32 #include "../../Framework/Radiography/RadiographyScene.h" |
414 | 33 #include "../../Framework/Radiography/RadiographySceneCommand.h" |
1089 | 34 #include "../../Framework/Radiography/RadiographySceneReader.h" |
35 #include "../../Framework/Radiography/RadiographySceneWriter.h" | |
413 | 36 #include "../../Framework/Radiography/RadiographyWidget.h" |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
414
diff
changeset
|
37 #include "../../Framework/Radiography/RadiographyWindowingTracker.h" |
1101
141593f1aa88
fix build on ubuntu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1086
diff
changeset
|
38 #include "../../Framework/Toolbox/TextRenderer.h" |
1085 | 39 |
418 | 40 #include <Core/HttpClient.h> |
343 | 41 #include <Core/Images/FontRegistry.h> |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
42 #include <Core/Logging.h> |
403 | 43 #include <Core/OrthancException.h> |
1085 | 44 #include <Core/Images/PngWriter.h> |
45 #include <Core/Images/PngReader.h> | |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
46 |
407 | 47 |
48 // Export using PAM is faster than using PNG, but requires Orthanc | |
49 // core >= 1.4.3 | |
362
12cec26d08ce
export of a valid DICOM CR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
361
diff
changeset
|
50 #define EXPORT_USING_PAM 1 |
12cec26d08ce
export of a valid DICOM CR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
361
diff
changeset
|
51 |
340
f5d5814a41a0
rendering BitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
339
diff
changeset
|
52 |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
53 namespace OrthancStone |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
54 { |
407 | 55 namespace Samples |
358 | 56 { |
408 | 57 class RadiographyEditorInteractor : |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
58 public Deprecated::IWorldSceneInteractor, |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
59 public ObserverBase<RadiographyEditorInteractor> |
358 | 60 { |
407 | 61 private: |
62 enum Tool | |
63 { | |
64 Tool_Move, | |
65 Tool_Rotate, | |
66 Tool_Crop, | |
67 Tool_Resize, | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
68 Tool_Mask, |
407 | 69 Tool_Windowing |
70 }; | |
430 | 71 |
358 | 72 |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
73 StoneApplicationContext* context_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
74 UndoRedoStack undoRedoStack_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
75 Tool tool_; |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
76 RadiographyMaskLayer* maskLayer_; |
407 | 77 |
78 | |
79 static double GetHandleSize() | |
80 { | |
81 return 10.0; | |
82 } | |
430 | 83 |
84 | |
407 | 85 public: |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
86 RadiographyEditorInteractor() : |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
87 context_(NULL), |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
88 tool_(Tool_Move), |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
89 maskLayer_(NULL) |
407 | 90 { |
91 } | |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
92 |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
93 void SetContext(StoneApplicationContext& context) |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
94 { |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
95 context_ = &context; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
96 } |
430 | 97 |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
98 void SetMaskLayer(RadiographyMaskLayer* maskLayer) |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
99 { |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
100 maskLayer_ = maskLayer; |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
101 } |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
102 virtual Deprecated::IWorldSceneMouseTracker* CreateMouseTracker(Deprecated::WorldSceneWidget& worldWidget, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
103 const Deprecated::ViewportGeometry& view, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
104 MouseButton button, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
105 KeyboardModifiers modifiers, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
106 int viewportX, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
107 int viewportY, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
108 double x, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
109 double y, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
110 Deprecated::IStatusBar* statusBar, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
111 const std::vector<Deprecated::Touch>& displayTouches) |
357
ec4ad6c5eb99
avoid breaking class hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
356
diff
changeset
|
112 { |
408 | 113 RadiographyWidget& widget = dynamic_cast<RadiographyWidget&>(worldWidget); |
407 | 114 |
115 if (button == MouseButton_Left) | |
358 | 116 { |
407 | 117 size_t selected; |
430 | 118 |
407 | 119 if (tool_ == Tool_Windowing) |
358 | 120 { |
408 | 121 return new RadiographyWindowingTracker( |
1085 | 122 undoRedoStack_, |
123 widget.GetScene(), | |
124 widget, | |
125 OrthancStone::ImageInterpolation_Nearest, | |
126 viewportX, viewportY, | |
127 RadiographyWindowingTracker::Action_DecreaseWidth, | |
128 RadiographyWindowingTracker::Action_IncreaseWidth, | |
129 RadiographyWindowingTracker::Action_DecreaseCenter, | |
130 RadiographyWindowingTracker::Action_IncreaseCenter); | |
358 | 131 } |
407 | 132 else if (!widget.LookupSelectedLayer(selected)) |
358 | 133 { |
407 | 134 // No layer is currently selected |
135 size_t layer; | |
136 if (widget.GetScene().LookupLayer(layer, x, y)) | |
358 | 137 { |
407 | 138 widget.Select(layer); |
358 | 139 } |
407 | 140 |
141 return NULL; | |
358 | 142 } |
407 | 143 else if (tool_ == Tool_Crop || |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
144 tool_ == Tool_Resize || |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
145 tool_ == Tool_Mask) |
358 | 146 { |
408 | 147 RadiographyScene::LayerAccessor accessor(widget.GetScene(), selected); |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
408
diff
changeset
|
148 |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
149 ControlPoint controlPoint; |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
150 if (accessor.GetLayer().LookupControlPoint(controlPoint, x, y, view.GetZoom(), GetHandleSize())) |
358 | 151 { |
407 | 152 switch (tool_) |
153 { | |
430 | 154 case Tool_Crop: |
155 return new RadiographyLayerCropTracker | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
156 (undoRedoStack_, widget.GetScene(), view, selected, controlPoint); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
157 |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
158 case Tool_Mask: |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
159 return new RadiographyLayerMaskTracker |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
160 (undoRedoStack_, widget.GetScene(), view, selected, controlPoint); |
407 | 161 |
430 | 162 case Tool_Resize: |
163 return new RadiographyLayerResizeTracker | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
164 (undoRedoStack_, widget.GetScene(), selected, controlPoint, |
408 | 165 (modifiers & KeyboardModifiers_Shift)); |
407 | 166 |
430 | 167 default: |
168 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
407 | 169 } |
384
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
170 } |
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
171 else |
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
172 { |
407 | 173 size_t layer; |
430 | 174 |
407 | 175 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
|
176 { |
407 | 177 widget.Select(layer); |
384
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
178 } |
407 | 179 else |
180 { | |
181 widget.Unselect(); | |
182 } | |
430 | 183 |
384
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
184 return NULL; |
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
185 } |
358 | 186 } |
187 else | |
188 { | |
407 | 189 size_t layer; |
190 | |
191 if (widget.GetScene().LookupLayer(layer, x, y)) | |
192 { | |
193 if (layer == selected) | |
194 { | |
195 switch (tool_) | |
196 { | |
430 | 197 case Tool_Move: |
198 return new RadiographyLayerMoveTracker | |
408 | 199 (undoRedoStack_, widget.GetScene(), layer, x, y, |
200 (modifiers & KeyboardModifiers_Shift)); | |
407 | 201 |
430 | 202 case Tool_Rotate: |
203 return new RadiographyLayerRotateTracker | |
408 | 204 (undoRedoStack_, widget.GetScene(), view, layer, x, y, |
205 (modifiers & KeyboardModifiers_Shift)); | |
430 | 206 |
207 default: | |
208 break; | |
407 | 209 } |
210 | |
211 return NULL; | |
212 } | |
213 else | |
214 { | |
215 widget.Select(layer); | |
216 return NULL; | |
217 } | |
218 } | |
219 else | |
220 { | |
221 widget.Unselect(); | |
222 return NULL; | |
223 } | |
224 } | |
225 } | |
226 else | |
227 { | |
228 return NULL; | |
229 } | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
230 return NULL; |
407 | 231 } |
232 | |
233 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
|
234 Deprecated::WorldSceneWidget& worldWidget, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
235 const Deprecated::ViewportGeometry& view, |
407 | 236 double x, |
237 double y, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
238 Deprecated::IStatusBar* statusBar) |
407 | 239 { |
408 | 240 RadiographyWidget& widget = dynamic_cast<RadiographyWidget&>(worldWidget); |
407 | 241 |
242 #if 0 | |
243 if (statusBar != NULL) | |
244 { | |
245 char buf[64]; | |
246 sprintf(buf, "X = %.02f Y = %.02f (in cm)", x / 10.0, y / 10.0); | |
247 statusBar->SetMessage(buf); | |
248 } | |
249 #endif | |
250 | |
251 size_t selected; | |
252 | |
253 if (widget.LookupSelectedLayer(selected) && | |
254 (tool_ == Tool_Crop || | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
255 tool_ == Tool_Resize || |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
256 tool_ == Tool_Mask)) |
407 | 257 { |
408 | 258 RadiographyScene::LayerAccessor accessor(widget.GetScene(), selected); |
430 | 259 |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
260 ControlPoint controlPoint; |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
261 if (accessor.GetLayer().LookupControlPoint(controlPoint, x, y, view.GetZoom(), GetHandleSize())) |
407 | 262 { |
263 double z = 1.0 / view.GetZoom(); | |
430 | 264 |
407 | 265 context.SetSourceColor(255, 0, 0); |
266 cairo_t* cr = context.GetObject(); | |
267 cairo_set_line_width(cr, 2.0 * z); | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
268 cairo_move_to(cr, controlPoint.x - GetHandleSize() * z, controlPoint.y - GetHandleSize() * z); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
269 cairo_line_to(cr, controlPoint.x + GetHandleSize() * z, controlPoint.y - GetHandleSize() * z); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
270 cairo_line_to(cr, controlPoint.x + GetHandleSize() * z, controlPoint.y + GetHandleSize() * z); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
271 cairo_line_to(cr, controlPoint.x - GetHandleSize() * z, controlPoint.y + GetHandleSize() * z); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
272 cairo_line_to(cr, controlPoint.x - GetHandleSize() * z, controlPoint.y - GetHandleSize() * z); |
407 | 273 cairo_stroke(cr); |
358 | 274 } |
275 } | |
339 | 276 } |
407 | 277 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
278 virtual void MouseWheel(Deprecated::WorldSceneWidget& widget, |
407 | 279 MouseWheelDirection direction, |
280 KeyboardModifiers modifiers, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
281 Deprecated::IStatusBar* statusBar) |
344
fdec8e6893cb
ordering of bitmap layers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
343
diff
changeset
|
282 { |
358 | 283 } |
407 | 284 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
285 virtual void KeyPressed(Deprecated::WorldSceneWidget& worldWidget, |
407 | 286 KeyboardKeys key, |
287 char keyChar, | |
288 KeyboardModifiers modifiers, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
289 Deprecated::IStatusBar* statusBar) |
345 | 290 { |
408 | 291 RadiographyWidget& widget = dynamic_cast<RadiographyWidget&>(worldWidget); |
407 | 292 |
293 switch (keyChar) | |
358 | 294 { |
430 | 295 case 'a': |
296 widget.FitContent(); | |
297 break; | |
298 | |
299 case 'c': | |
300 tool_ = Tool_Crop; | |
301 break; | |
407 | 302 |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
303 case 'm': |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
304 tool_ = Tool_Mask; |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
305 widget.Select(1); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
306 break; |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
307 |
430 | 308 case 'd': |
309 { | |
310 // dump to json and reload | |
311 Json::Value snapshot; | |
312 RadiographySceneWriter writer; | |
313 writer.Write(snapshot, widget.GetScene()); | |
407 | 314 |
430 | 315 LOG(INFO) << "JSON export was successful: " |
316 << snapshot.toStyledString(); | |
317 | |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
318 boost::shared_ptr<RadiographyScene> scene(new RadiographyScene); |
430 | 319 RadiographySceneReader reader(*scene, context_->GetOrthancApiClient()); |
320 | |
321 Orthanc::FontRegistry fontRegistry; | |
322 fontRegistry.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16); | |
323 | |
324 reader.SetFontRegistry(fontRegistry); | |
325 reader.Read(snapshot); | |
407 | 326 |
430 | 327 widget.SetScene(scene); |
328 };break; | |
329 | |
330 case 'e': | |
331 { | |
332 Orthanc::DicomMap tags; | |
407 | 333 |
430 | 334 // Minimal set of tags to generate a valid CR image |
335 tags.SetValue(Orthanc::DICOM_TAG_ACCESSION_NUMBER, "NOPE", false); | |
336 tags.SetValue(Orthanc::DICOM_TAG_BODY_PART_EXAMINED, "PELVIS", false); | |
337 tags.SetValue(Orthanc::DICOM_TAG_INSTANCE_NUMBER, "1", false); | |
338 //tags.SetValue(Orthanc::DICOM_TAG_LATERALITY, "", false); | |
339 tags.SetValue(Orthanc::DICOM_TAG_MANUFACTURER, "OSIMIS", false); | |
340 tags.SetValue(Orthanc::DICOM_TAG_MODALITY, "CR", false); | |
341 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_BIRTH_DATE, "20000101", false); | |
342 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_ID, "hello", false); | |
343 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_NAME, "HELLO^WORLD", false); | |
344 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_ORIENTATION, "", false); | |
345 tags.SetValue(Orthanc::DICOM_TAG_PATIENT_SEX, "M", false); | |
346 tags.SetValue(Orthanc::DICOM_TAG_REFERRING_PHYSICIAN_NAME, "HOUSE^MD", false); | |
347 tags.SetValue(Orthanc::DICOM_TAG_SERIES_NUMBER, "1", false); | |
348 tags.SetValue(Orthanc::DICOM_TAG_SOP_CLASS_UID, "1.2.840.10008.5.1.4.1.1.1", false); | |
349 tags.SetValue(Orthanc::DICOM_TAG_STUDY_ID, "STUDY", false); | |
350 tags.SetValue(Orthanc::DICOM_TAG_VIEW_POSITION, "", false); | |
351 | |
352 if (context_ != NULL) | |
353 { | |
1070 | 354 widget.GetScene().ExportDicom(*context_->GetOrthancApiClient(), |
430 | 355 tags, std::string(), 0.1, 0.1, widget.IsInverted(), |
356 widget.GetInterpolation(), EXPORT_USING_PAM); | |
407 | 357 } |
358 | |
430 | 359 break; |
360 } | |
361 | |
362 case 'i': | |
363 widget.SwitchInvert(); | |
364 break; | |
365 | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
366 case 't': |
430 | 367 tool_ = Tool_Move; |
368 break; | |
369 | |
370 case 'n': | |
371 { | |
372 switch (widget.GetInterpolation()) | |
373 { | |
374 case ImageInterpolation_Nearest: | |
375 LOG(INFO) << "Switching to bilinear interpolation"; | |
376 widget.SetInterpolation(ImageInterpolation_Bilinear); | |
407 | 377 break; |
378 | |
430 | 379 case ImageInterpolation_Bilinear: |
380 LOG(INFO) << "Switching to nearest neighbor interpolation"; | |
381 widget.SetInterpolation(ImageInterpolation_Nearest); | |
407 | 382 break; |
383 | |
430 | 384 default: |
385 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | |
386 } | |
387 | |
388 break; | |
389 } | |
407 | 390 |
430 | 391 case 'r': |
392 tool_ = Tool_Rotate; | |
393 break; | |
394 | |
395 case 's': | |
396 tool_ = Tool_Resize; | |
397 break; | |
398 | |
399 case 'w': | |
400 tool_ = Tool_Windowing; | |
401 break; | |
407 | 402 |
430 | 403 case 'y': |
404 if (modifiers & KeyboardModifiers_Control) | |
405 { | |
406 undoRedoStack_.Redo(); | |
407 widget.NotifyContentChanged(); | |
408 } | |
409 break; | |
407 | 410 |
430 | 411 case 'z': |
412 if (modifiers & KeyboardModifiers_Control) | |
413 { | |
414 undoRedoStack_.Undo(); | |
415 widget.NotifyContentChanged(); | |
416 } | |
417 break; | |
418 | |
419 default: | |
420 break; | |
358 | 421 } |
345 | 422 } |
407 | 423 }; |
336
c7fdc8bac581
creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
334
diff
changeset
|
424 |
430 | 425 |
426 | |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
427 class SingleFrameEditorApplication : |
430 | 428 public SampleSingleCanvasApplicationBase, |
429 public IObserver | |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
430 { |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
431 private: |
430 | 432 boost::shared_ptr<RadiographyScene> scene_; |
433 RadiographyEditorInteractor interactor_; | |
434 Orthanc::FontRegistry fontRegistry_; | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
435 RadiographyMaskLayer* maskLayer_; |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
436 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
437 public: |
384
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
438 virtual ~SingleFrameEditorApplication() |
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
439 { |
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
440 LOG(WARNING) << "Destroying the application"; |
d20d75f20c5d
better following of the MVC design pattern
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
441 } |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
442 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
443 virtual void DeclareStartupOptions(boost::program_options::options_description& options) |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
444 { |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
445 boost::program_options::options_description generic("Sample options"); |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
446 generic.add_options() |
430 | 447 ("instance", boost::program_options::value<std::string>(), |
448 "Orthanc ID of the instance") | |
449 ("frame", boost::program_options::value<unsigned int>()->default_value(0), | |
450 "Number of the frame, for multi-frame DICOM instances") | |
451 ; | |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
452 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
453 options.add(generic); |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
454 } |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
455 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
456 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
|
457 Deprecated::IStatusBar& statusBar, |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
458 const boost::program_options::variables_map& parameters) |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
459 { |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
460 using namespace OrthancStone; |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
461 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
462 context_ = context; |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
463 interactor_.SetContext(*context); |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
464 |
358 | 465 statusBar.SetMessage("Use the key \"a\" to reinitialize the layout"); |
466 statusBar.SetMessage("Use the key \"c\" to crop"); | |
359
100df90bf0ea
preparing to implement Export
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
467 statusBar.SetMessage("Use the key \"e\" to export DICOM to the Orthanc server"); |
358 | 468 statusBar.SetMessage("Use the key \"f\" to switch full screen"); |
469 statusBar.SetMessage("Use the key \"i\" to invert contrast"); | |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
470 statusBar.SetMessage("Use the key \"m\" to modify the mask"); |
359
100df90bf0ea
preparing to implement Export
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
471 statusBar.SetMessage("Use the key \"n\" to switch between nearest neighbor and bilinear interpolation"); |
358 | 472 statusBar.SetMessage("Use the key \"r\" to rotate objects"); |
407 | 473 statusBar.SetMessage("Use the key \"s\" to resize objects (not applicable to DICOM layers)"); |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
474 statusBar.SetMessage("Use the key \"t\" to move (translate) objects"); |
358 | 475 statusBar.SetMessage("Use the key \"w\" to change windowing"); |
476 | |
477 statusBar.SetMessage("Use the key \"ctrl-z\" to undo action"); | |
478 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
|
479 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
480 if (parameters.count("instance") != 1) |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
481 { |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
482 LOG(ERROR) << "The instance ID is missing"; |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
483 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
484 } |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
485 |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
486 std::string instance = parameters["instance"].as<std::string>(); |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
535
diff
changeset
|
487 //int frame = parameters["frame"].as<unsigned int>(); |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
488 |
430 | 489 fontRegistry_.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16); |
343 | 490 |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
491 scene_.reset(new RadiographyScene); |
535
79bb0a02d1cc
- Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents:
518
diff
changeset
|
492 |
1070 | 493 RadiographyLayer& dicomLayer = scene_->LoadDicomFrame(*context->GetOrthancApiClient(), instance, 0, false, NULL); |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
494 //scene_->LoadDicomFrame(instance, frame, false); //.SetPan(200, 0); |
535
79bb0a02d1cc
- Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents:
518
diff
changeset
|
495 // = scene_->LoadDicomFrame(context->GetOrthancApiClient(), "61f3143e-96f34791-ad6bbb8d-62559e75-45943e1b", 0, false, NULL); |
418 | 496 |
497 #if !defined(ORTHANC_ENABLE_WASM) || ORTHANC_ENABLE_WASM != 1 | |
498 Orthanc::HttpClient::ConfigureSsl(true, "/etc/ssl/certs/ca-certificates.crt"); | |
499 #endif | |
500 | |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
501 //scene_->LoadDicomWebFrame(context->GetWebService()); |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
502 |
518
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
503 std::vector<Orthanc::ImageProcessing::ImagePoint> mask; |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
504 mask.push_back(Orthanc::ImageProcessing::ImagePoint(1100, 100)); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
505 mask.push_back(Orthanc::ImageProcessing::ImagePoint(1100, 1000)); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
506 mask.push_back(Orthanc::ImageProcessing::ImagePoint(2000, 1000)); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
507 mask.push_back(Orthanc::ImageProcessing::ImagePoint(2200, 150)); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
508 mask.push_back(Orthanc::ImageProcessing::ImagePoint(1500, 550)); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
509 maskLayer_ = dynamic_cast<RadiographyMaskLayer*>(&(scene_->LoadMask(mask, dynamic_cast<RadiographyDicomLayer&>(dicomLayer), 128.0f, NULL))); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
510 interactor_.SetMaskLayer(maskLayer_); |
40bb5eb247a5
Reverted a couple of files to AM version (wrong changes on my end)
Benjamin Golinvaux <bgo@osimis.io>
parents:
516
diff
changeset
|
511 |
354 | 512 { |
1086 | 513 std::auto_ptr<Orthanc::ImageAccessor> renderedTextAlpha(TextRenderer::Render(Orthanc::EmbeddedResources::UBUNTU_FONT, 100, |
1085 | 514 "%öÇaA&#")); |
515 RadiographyLayer& layer = scene_->LoadAlphaBitmap(renderedTextAlpha.release(), NULL); | |
516 dynamic_cast<RadiographyAlphaLayer&>(layer).SetForegroundValue(200); | |
517 } | |
518 | |
519 { | |
430 | 520 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
|
521 layer.SetResizeable(true); |
354 | 522 } |
523 | |
524 { | |
430 | 525 RadiographyLayer& layer = scene_->LoadTestBlock(100, 50, NULL); |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
408
diff
changeset
|
526 layer.SetResizeable(true); |
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
408
diff
changeset
|
527 layer.SetPan(0, 200); |
354 | 528 } |
529 | |
1070 | 530 boost::shared_ptr<RadiographyWidget> widget(new RadiographyWidget(scene_, "main-widget")); |
531 widget->SetTransmitMouseOver(true); | |
532 widget->SetInteractor(interactor_); | |
533 SetCentralWidget(widget); | |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
534 |
407 | 535 //scene_->SetWindowing(128, 256); |
325
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
536 } |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
537 }; |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
538 } |
37ab9d83dc9b
reactivate SingleFrameApplication sample + Added SingleFrameEditorApplication (SDL only)
am@osimis.io
parents:
diff
changeset
|
539 } |