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