Mercurial > hg > orthanc-stone
comparison Applications/Samples/SingleFrameApplication.h @ 89:f244018a4e4b wasm
BUGGY- trying to remove IVolumeSlicesObserver
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 May 2017 18:27:59 +0200 |
parents | bd48431ac285 |
children | 64e60018943f |
comparison
equal
deleted
inserted
replaced
88:90bf4116a23c | 89:f244018a4e4b |
---|---|
32 { | 32 { |
33 namespace Samples | 33 namespace Samples |
34 { | 34 { |
35 class SingleFrameApplication : | 35 class SingleFrameApplication : |
36 public SampleApplicationBase, | 36 public SampleApplicationBase, |
37 public IVolumeSlicesObserver | 37 private ILayerSource::IObserver |
38 { | 38 { |
39 private: | 39 private: |
40 class Interactor : public IWorldSceneInteractor | 40 class Interactor : public IWorldSceneInteractor |
41 { | 41 { |
42 public: | 42 public: |
90 break; | 90 break; |
91 } | 91 } |
92 } | 92 } |
93 }; | 93 }; |
94 | 94 |
95 LayerWidget* widget_; | 95 virtual void NotifyGeometryReady(const ILayerSource& source) |
96 { | |
97 } | |
98 | |
99 virtual void NotifyGeometryError(const ILayerSource& source) | |
100 { | |
101 } | |
102 | |
103 virtual void NotifyContentChange(const ILayerSource& source) | |
104 { | |
105 } | |
106 | |
107 virtual void NotifySliceChange(const ILayerSource& source, | |
108 const Slice& slice) | |
109 { | |
110 } | |
111 | |
112 virtual void NotifyLayerReady(ILayerRenderer *layer, | |
113 const ILayerSource& source, | |
114 const Slice& slice) | |
115 { | |
116 } | |
117 | |
118 virtual void NotifyLayerError(const ILayerSource& source, | |
119 const SliceGeometry& slice) | |
120 { | |
121 } | |
122 | |
123 LayerWidget* widget_; | |
96 | 124 |
97 public: | 125 public: |
98 SingleFrameApplication() : widget_(NULL) | 126 SingleFrameApplication() : |
99 { | 127 widget_(NULL) |
100 } | 128 { |
101 | |
102 virtual void NotifySlicesAvailable(const ParallelSlices& slices) | |
103 { | |
104 if (widget_ != NULL && | |
105 slices.GetSliceCount() > 0) | |
106 { | |
107 widget_->SetSlice(slices.GetSlice(0)); | |
108 widget_->SetDefaultView(); | |
109 } | |
110 } | 129 } |
111 | 130 |
112 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) | 131 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) |
113 { | 132 { |
114 boost::program_options::options_description generic("Sample options"); | 133 boost::program_options::options_description generic("Sample options"); |
144 std::auto_ptr<LayerWidget> widget(new LayerWidget); | 163 std::auto_ptr<LayerWidget> widget(new LayerWidget); |
145 | 164 |
146 #if 1 | 165 #if 1 |
147 std::auto_ptr<OrthancFrameLayerSource> layer | 166 std::auto_ptr<OrthancFrameLayerSource> layer |
148 (new OrthancFrameLayerSource(context.GetWebService(), instance, frame)); | 167 (new OrthancFrameLayerSource(context.GetWebService(), instance, frame)); |
149 layer->SetObserver(*this); | |
150 widget->AddLayer(layer.release()); | 168 widget->AddLayer(layer.release()); |
151 | 169 |
152 if (parameters["smooth"].as<bool>()) | 170 if (parameters["smooth"].as<bool>()) |
153 { | 171 { |
154 RenderStyle s; | 172 RenderStyle s; |
155 s.interpolation_ = ImageInterpolation_Linear; | 173 s.interpolation_ = ImageInterpolation_Linear; |
156 widget->SetLayerStyle(0, s); | 174 widget->SetLayerStyle(0, s); |
157 } | 175 } |
158 #else | 176 #else |
159 // 0178023P** | 177 // 0178023P** |
160 std::auto_ptr<OrthancFrameLayerSource> layer; | 178 std::auto_ptr<OrthancFrameLayerSource> ct; |
161 layer.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0)); | 179 ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0)); |
162 //layer.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0)); // BAD SLICE | 180 //ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0)); // BAD SLICE |
163 layer->SetObserver(*this); | 181 widget->AddLayer(ct.release()); |
164 widget->AddLayer(layer.release()); | 182 |
165 | 183 std::auto_ptr<OrthancFrameLayerSource> pet; |
166 widget->AddLayer(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0)); | 184 pet.reset(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0)); |
185 widget->AddLayer(pet.release()); | |
167 | 186 |
168 { | 187 { |
169 RenderStyle s; | 188 RenderStyle s; |
170 s.alpha_ = 1; | 189 s.alpha_ = 1; |
171 widget->SetLayerStyle(0, s); | 190 widget->SetLayerStyle(0, s); |
172 } | 191 } |
173 | 192 |
174 { | 193 { |
175 RenderStyle s; | 194 RenderStyle s; |
176 s.drawGrid_ = true; | 195 //s.drawGrid_ = true; |
177 s.SetColor(255, 0, 0); // Draw missing PET layer in red | 196 s.SetColor(255, 0, 0); // Draw missing PET layer in red |
178 s.alpha_ = 0.5; | 197 s.alpha_ = 0.5; |
179 s.applyLut_ = true; | 198 s.applyLut_ = true; |
180 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; | 199 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; |
181 widget->SetLayerStyle(1, s); | 200 widget->SetLayerStyle(1, s); |