Mercurial > hg > orthanc-stone
comparison Applications/Samples/SingleFrameApplication.h @ 97:d18dcc963930 wasm
separation of the renderers vs. viewport slice
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 May 2017 14:09:11 +0200 |
parents | f8bce1bebe01 |
children | a33abae66344 |
comparison
equal
deleted
inserted
replaced
96:f8bce1bebe01 | 97:d18dcc963930 |
---|---|
101 const OrthancFrameLayerSource& frame = | 101 const OrthancFrameLayerSource& frame = |
102 dynamic_cast<const OrthancFrameLayerSource&>(source); | 102 dynamic_cast<const OrthancFrameLayerSource&>(source); |
103 | 103 |
104 if (frame.GetSliceCount() > 0) | 104 if (frame.GetSliceCount() > 0) |
105 { | 105 { |
106 #if 1 | |
107 GeometryToolbox::Print(frame.GetSlice(0).GetGeometry().GetOrigin()); | |
106 widget_->SetSlice(frame.GetSlice(0).GetGeometry()); | 108 widget_->SetSlice(frame.GetSlice(0).GetGeometry()); |
109 #else | |
110 // TEST for scene extents - Rotate the axes | |
111 double a = 15.0 / 180.0 * M_PI; | |
112 | |
113 Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); | |
114 Vector y; GeometryToolbox::AssignVector(y, -sin(a), cos(a), 0); | |
115 GeometryToolbox::Print(frame.GetSlice(0).GetGeometry().GetOrigin()); | |
116 GeometryToolbox::Print(x); | |
117 GeometryToolbox::Print(y); | |
118 SliceGeometry s(frame.GetSlice(0).GetGeometry().GetOrigin(), x, y); | |
119 widget_->SetSlice(s); | |
120 #endif | |
121 | |
107 widget_->SetDefaultView(); | 122 widget_->SetDefaultView(); |
108 } | 123 } |
109 } | 124 } |
110 | 125 |
111 virtual void NotifyGeometryError(const ILayerSource& source) | 126 virtual void NotifyGeometryError(const ILayerSource& source) |
174 std::auto_ptr<OrthancFrameLayerSource> layer | 189 std::auto_ptr<OrthancFrameLayerSource> layer |
175 (new OrthancFrameLayerSource(context.GetWebService(), instance, frame)); | 190 (new OrthancFrameLayerSource(context.GetWebService(), instance, frame)); |
176 layer->Register(*this); | 191 layer->Register(*this); |
177 widget->AddLayer(layer.release()); | 192 widget->AddLayer(layer.release()); |
178 | 193 |
194 RenderStyle s; | |
195 | |
179 if (parameters["smooth"].as<bool>()) | 196 if (parameters["smooth"].as<bool>()) |
180 { | 197 { |
181 RenderStyle s; | |
182 s.interpolation_ = ImageInterpolation_Linear; | 198 s.interpolation_ = ImageInterpolation_Linear; |
183 widget->SetLayerStyle(0, s); | 199 } |
184 } | 200 |
201 //s.drawGrid_ = true; | |
202 widget->SetLayerStyle(0, s); | |
185 #else | 203 #else |
186 // 0178023P** | 204 // 0178023P** |
205 // Extent of the CT layer: (-35.068 -20.368) => (34.932 49.632) | |
187 std::auto_ptr<OrthancFrameLayerSource> ct; | 206 std::auto_ptr<OrthancFrameLayerSource> ct; |
188 ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0)); | 207 ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0)); |
189 //ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0)); // BAD SLICE | 208 //ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0)); // BAD SLICE |
190 ct->Register(*this); | 209 ct->Register(*this); |
191 widget->AddLayer(ct.release()); | 210 widget->AddLayer(ct.release()); |
194 pet.reset(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0)); | 213 pet.reset(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0)); |
195 widget->AddLayer(pet.release()); | 214 widget->AddLayer(pet.release()); |
196 | 215 |
197 { | 216 { |
198 RenderStyle s; | 217 RenderStyle s; |
218 //s.drawGrid_ = true; | |
199 s.alpha_ = 1; | 219 s.alpha_ = 1; |
200 widget->SetLayerStyle(0, s); | 220 widget->SetLayerStyle(0, s); |
201 } | 221 } |
202 | 222 |
203 { | 223 { |