comparison Applications/Samples/SingleFrameApplication.h @ 336:c7fdc8bac581 am-2

creating GrayscaleBitmapStack
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Oct 2018 19:29:14 +0200
parents c34784e5f299
children 885f0a5eaa49
comparison
equal deleted inserted replaced
335:3e42fc27eb91 336:c7fdc8bac581
138 { 138 {
139 SetSlice(slice); 139 SetSlice(slice);
140 } 140 }
141 } 141 }
142 } 142 }
143
144
145 LayerWidget& GetMainWidget()
146 {
147 return *dynamic_cast<LayerWidget*>(mainWidget_);
148 }
143 149
144 150
145 void SetSlice(size_t index) 151 void SetSlice(size_t index)
146 { 152 {
147 if (source_ != NULL && 153 if (source_ != NULL &&
148 index < source_->GetSliceCount()) 154 index < source_->GetSliceCount())
149 { 155 {
150 slice_ = index; 156 slice_ = index;
151 157
152 #if 1 158 #if 1
153 mainWidget_->SetSlice(source_->GetSlice(slice_).GetGeometry()); 159 GetMainWidget().SetSlice(source_->GetSlice(slice_).GetGeometry());
154 #else 160 #else
155 // TEST for scene extents - Rotate the axes 161 // TEST for scene extents - Rotate the axes
156 double a = 15.0 / 180.0 * M_PI; 162 double a = 15.0 / 180.0 * M_PI;
157 163
158 #if 1 164 #if 1
179 if (source_ == &message.origin_) 185 if (source_ == &message.origin_)
180 { 186 {
181 SetSlice(source_->GetSliceCount() / 2); 187 SetSlice(source_->GetSliceCount() / 2);
182 } 188 }
183 189
184 mainWidget_->FitContent(); 190 GetMainWidget().FitContent();
185 } 191 }
186 192
187 std::auto_ptr<Interactor> mainWidgetInteractor_; 193 std::auto_ptr<Interactor> mainWidgetInteractor_;
188 std::auto_ptr<OrthancApiClient> orthancApiClient_; 194 std::auto_ptr<OrthancApiClient> orthancApiClient_;
189 const OrthancFrameLayerSource* source_; 195 const OrthancFrameLayerSource* source_;
236 242
237 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(broker_, *orthancApiClient_)); 243 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(broker_, *orthancApiClient_));
238 source_ = layer.get(); 244 source_ = layer.get();
239 layer->LoadFrame(instance, frame); 245 layer->LoadFrame(instance, frame);
240 layer->RegisterObserverCallback(new Callable<SingleFrameApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady)); 246 layer->RegisterObserverCallback(new Callable<SingleFrameApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady));
241 mainWidget_->AddLayer(layer.release()); 247 GetMainWidget().AddLayer(layer.release());
242 248
243 RenderStyle s; 249 RenderStyle s;
244 250
245 if (parameters["smooth"].as<bool>()) 251 if (parameters["smooth"].as<bool>())
246 { 252 {
247 s.interpolation_ = ImageInterpolation_Bilinear; 253 s.interpolation_ = ImageInterpolation_Bilinear;
248 } 254 }
249 255
250 mainWidget_->SetLayerStyle(0, s); 256 GetMainWidget().SetLayerStyle(0, s);
251 mainWidget_->SetTransmitMouseOver(true); 257 GetMainWidget().SetTransmitMouseOver(true);
252 258
253 mainWidgetInteractor_.reset(new Interactor(*this)); 259 mainWidgetInteractor_.reset(new Interactor(*this));
254 mainWidget_->SetInteractor(*mainWidgetInteractor_); 260 GetMainWidget().SetInteractor(*mainWidgetInteractor_);
255 } 261 }
256 }; 262 };
257 263
258 264
259 } 265 }