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