Mercurial > hg > orthanc-stone
annotate Applications/Samples/SingleFrameApplication.h @ 100:166a555becbf wasm
fix jpeg decoding in wasm
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 May 2017 22:22:04 +0200 |
parents | a33abae66344 |
children | af312ce4fe59 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
40
7207a407bcd8
shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
16
diff
changeset
|
5 * Copyright (C) 2017 Osimis, Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 8 * modify it under the terms of the GNU Affero General Public License |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
0 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "SampleApplicationBase.h" | |
85 | 25 #include "SampleInteractor.h" |
0 | 26 |
79 | 27 #include "../../Framework/Layers/OrthancFrameLayerSource.h" |
28 #include "../../Framework/Widgets/LayerWidget.h" | |
51 | 29 #include "../../Resources/Orthanc/Core/Logging.h" |
0 | 30 |
31 namespace OrthancStone | |
32 { | |
33 namespace Samples | |
34 { | |
66 | 35 class SingleFrameApplication : |
36 public SampleApplicationBase, | |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
37 private ILayerSource::IObserver |
0 | 38 { |
66 | 39 private: |
85 | 40 class Interactor : public IWorldSceneInteractor |
41 { | |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
42 private: |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
43 SingleFrameApplication& application_; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
44 |
85 | 45 public: |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
46 Interactor(SingleFrameApplication& application) : |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
47 application_(application) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
48 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
49 } |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
50 |
85 | 51 virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& widget, |
52 const ViewportGeometry& view, | |
53 MouseButton button, | |
54 double x, | |
55 double y, | |
56 IStatusBar* statusBar) | |
57 { | |
58 return NULL; | |
59 } | |
60 | |
61 virtual void MouseOver(CairoContext& context, | |
62 WorldSceneWidget& widget, | |
63 const ViewportGeometry& view, | |
64 double x, | |
65 double y, | |
66 IStatusBar* statusBar) | |
67 { | |
68 if (statusBar != NULL) | |
69 { | |
70 Vector p = dynamic_cast<LayerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y); | |
71 | |
72 char buf[64]; | |
73 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)", | |
74 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0); | |
75 statusBar->SetMessage(buf); | |
76 } | |
77 } | |
78 | |
79 virtual void MouseWheel(WorldSceneWidget& widget, | |
80 MouseWheelDirection direction, | |
81 KeyboardModifiers modifiers, | |
82 IStatusBar* statusBar) | |
83 { | |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
84 unsigned int scale = (modifiers & KeyboardModifiers_Control ? 10 : 1); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
85 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
86 switch (direction) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
87 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
88 case MouseWheelDirection_Up: |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
89 application_.OffsetSlice(-scale); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
90 break; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
91 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
92 case MouseWheelDirection_Down: |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
93 application_.OffsetSlice(scale); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
94 break; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
95 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
96 default: |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
97 break; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
98 } |
85 | 99 } |
100 | |
101 virtual void KeyPressed(WorldSceneWidget& widget, | |
102 char key, | |
103 KeyboardModifiers modifiers, | |
104 IStatusBar* statusBar) | |
105 { | |
106 switch (key) | |
107 { | |
108 case 's': | |
109 widget.SetDefaultView(); | |
110 break; | |
111 | |
112 default: | |
113 break; | |
114 } | |
115 } | |
116 }; | |
117 | |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
118 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
119 void OffsetSlice(int offset) |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
120 { |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
121 if (source_ != NULL) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
122 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
123 int slice = static_cast<int>(slice_) + offset; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
124 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
125 if (slice < 0) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
126 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
127 slice = 0; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
128 } |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
129 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
130 if (slice >= static_cast<int>(source_->GetSliceCount())) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
131 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
132 slice = source_->GetSliceCount() - 1; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
133 } |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
134 |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
135 if (slice != static_cast<int>(slice_)) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
136 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
137 SetSlice(slice); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
138 } |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
139 } |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
140 } |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
141 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
142 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
143 void SetSlice(size_t index) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
144 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
145 if (source_ != NULL && |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
146 index < source_->GetSliceCount()) |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
147 { |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
148 slice_ = index; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
149 |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
150 #if 1 |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
151 widget_->SetSlice(source_->GetSlice(slice_).GetGeometry()); |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
152 #else |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
153 // TEST for scene extents - Rotate the axes |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
154 double a = 15.0 / 180.0 * M_PI; |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
155 |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
156 Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
157 Vector y; GeometryToolbox::AssignVector(y, -sin(a), cos(a), 0); |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
158 SliceGeometry s(source_->GetSlice(slice_).GetGeometry().GetOrigin(), x, y); |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
159 widget_->SetSlice(s); |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
160 #endif |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
161 } |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
162 } |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
163 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
164 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
165 virtual void NotifyGeometryReady(const ILayerSource& source) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
166 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
167 // Once the geometry of the series is downloaded from Orthanc, |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
168 // display its first slice, and adapt the viewport to fit this |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
169 // slice |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
170 if (source_ == &source) |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
171 { |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
172 SetSlice(source_->GetSliceCount() / 2); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
173 } |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
174 |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
175 widget_->SetDefaultView(); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
176 } |
66 | 177 |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
178 virtual void NotifyGeometryError(const ILayerSource& source) |
66 | 179 { |
180 } | |
181 | |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
182 virtual void NotifyContentChange(const ILayerSource& source) |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
183 { |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
184 } |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
185 |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
186 virtual void NotifySliceChange(const ILayerSource& source, |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
187 const Slice& slice) |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
188 { |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
189 } |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
190 |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
191 virtual void NotifyLayerReady(std::auto_ptr<ILayerRenderer>& layer, |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
192 const ILayerSource& source, |
96
f8bce1bebe01
removal of the NotifyLayerError callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
94
diff
changeset
|
193 const Slice& slice, |
f8bce1bebe01
removal of the NotifyLayerError callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
94
diff
changeset
|
194 bool isError) |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
195 { |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
196 } |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
197 |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
198 LayerWidget* widget_; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
199 const OrthancFrameLayerSource* source_; |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
200 unsigned int slice_; |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
201 |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
202 public: |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
203 SingleFrameApplication() : |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
204 widget_(NULL), |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
205 source_(NULL), |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
206 slice_(0) |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
207 { |
66 | 208 } |
209 | |
0 | 210 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) |
211 { | |
212 boost::program_options::options_description generic("Sample options"); | |
213 generic.add_options() | |
214 ("instance", boost::program_options::value<std::string>(), | |
215 "Orthanc ID of the instance") | |
216 ("frame", boost::program_options::value<unsigned int>()->default_value(0), | |
217 "Number of the frame, for multi-frame DICOM instances") | |
218 ("smooth", boost::program_options::value<bool>()->default_value(true), | |
219 "Enable linear interpolation to smooth the image") | |
220 ; | |
221 | |
222 options.add(generic); | |
223 } | |
224 | |
225 virtual void Initialize(BasicApplicationContext& context, | |
226 IStatusBar& statusBar, | |
227 const boost::program_options::variables_map& parameters) | |
228 { | |
229 using namespace OrthancStone; | |
230 | |
85 | 231 statusBar.SetMessage("Use the key \"s\" to reinitialize the layout"); |
232 | |
0 | 233 if (parameters.count("instance") != 1) |
234 { | |
235 LOG(ERROR) << "The instance ID is missing"; | |
236 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
237 } | |
238 | |
239 std::string instance = parameters["instance"].as<std::string>(); | |
240 int frame = parameters["frame"].as<unsigned int>(); | |
241 | |
66 | 242 std::auto_ptr<LayerWidget> widget(new LayerWidget); |
243 | |
94 | 244 #if 1 |
66 | 245 std::auto_ptr<OrthancFrameLayerSource> layer |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
246 (new OrthancFrameLayerSource(context.GetWebService())); |
100
166a555becbf
fix jpeg decoding in wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
98
diff
changeset
|
247 //layer->SetImageQuality(SliceImageQuality_Jpeg50); |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
248 layer->LoadInstance(instance, frame); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
249 //layer->LoadSeries("6f1b492a-e181e200-44e51840-ef8db55e-af529ab6"); |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
250 layer->Register(*this); |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
251 source_ = layer.get(); |
66 | 252 widget->AddLayer(layer.release()); |
253 | |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
254 RenderStyle s; |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
255 |
66 | 256 if (parameters["smooth"].as<bool>()) |
257 { | |
258 s.interpolation_ = ImageInterpolation_Linear; | |
259 } | |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
260 |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
261 //s.drawGrid_ = true; |
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
262 widget->SetLayerStyle(0, s); |
66 | 263 #else |
264 // 0178023P** | |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
265 // Extent of the CT layer: (-35.068 -20.368) => (34.932 49.632) |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
266 std::auto_ptr<OrthancFrameLayerSource> ct; |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
267 ct.reset(new OrthancFrameLayerSource(context.GetWebService())); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
268 //ct->LoadInstance("c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
269 //ct->LoadInstance("4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0); // BAD SLICE |
100
166a555becbf
fix jpeg decoding in wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
98
diff
changeset
|
270 ct->SetImageQuality(SliceImageQuality_Jpeg50); |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
271 ct->LoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
272 |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
273 ct->Register(*this); |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
274 widget->AddLayer(ct.release()); |
66 | 275 |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
276 std::auto_ptr<OrthancFrameLayerSource> pet; |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
277 pet.reset(new OrthancFrameLayerSource(context.GetWebService())); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
278 //pet->LoadInstance("a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
279 pet->LoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e"); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
280 pet->Register(*this); |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
281 source_ = pet.get(); |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
282 widget->AddLayer(pet.release()); |
66 | 283 |
85 | 284 { |
285 RenderStyle s; | |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
286 //s.drawGrid_ = true; |
85 | 287 s.alpha_ = 1; |
288 widget->SetLayerStyle(0, s); | |
289 } | |
290 | |
291 { | |
292 RenderStyle s; | |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
85
diff
changeset
|
293 //s.drawGrid_ = true; |
85 | 294 s.SetColor(255, 0, 0); // Draw missing PET layer in red |
295 s.alpha_ = 0.5; | |
296 s.applyLut_ = true; | |
297 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; | |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
298 s.interpolation_ = ImageInterpolation_Linear; |
85 | 299 widget->SetLayerStyle(1, s); |
300 } | |
66 | 301 #endif |
85 | 302 |
66 | 303 widget_ = widget.get(); |
85 | 304 widget_->SetTransmitMouseOver(true); |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
97
diff
changeset
|
305 widget_->SetInteractor(context.AddInteractor(new Interactor(*this))); |
66 | 306 context.SetCentralWidget(widget.release()); |
0 | 307 } |
308 }; | |
309 } | |
310 } |