Mercurial > hg > orthanc-stone
comparison Applications/Samples/SingleVolumeApplication.h @ 119:ba83e38cf3ff wasm
rendering of rt-dose
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Oct 2017 22:01:41 +0200 |
parents | 42c05a3baee3 |
children | 063f7f3d9f14 |
comparison
equal
deleted
inserted
replaced
118:a4d0b6c82b29 | 119:ba83e38cf3ff |
---|---|
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "SampleApplicationBase.h" | 24 #include "SampleApplicationBase.h" |
25 #include "../../Framework/dev.h" | 25 #include "../../Framework/dev.h" |
26 //#include "SampleInteractor.h" | 26 #include "../../Framework/Layers/ILayerSource.h" |
27 #include "../../Framework/Widgets/LayerWidget.h" | |
28 #include "../../Framework/Layers/LineMeasureTracker.h" | 27 #include "../../Framework/Layers/LineMeasureTracker.h" |
29 #include "../../Framework/Layers/CircleMeasureTracker.h" | 28 #include "../../Framework/Layers/CircleMeasureTracker.h" |
30 | 29 |
31 #include <Core/Toolbox.h> | 30 #include <Core/Toolbox.h> |
32 #include <Core/Logging.h> | 31 #include <Core/Logging.h> |
33 | 32 |
34 namespace OrthancStone | 33 namespace OrthancStone |
35 { | 34 { |
36 namespace Samples | 35 namespace Samples |
37 { | 36 { |
38 class SingleVolumeApplication : | 37 class SingleVolumeApplication : public SampleApplicationBase |
39 public SampleApplicationBase | |
40 { | 38 { |
39 private: | |
40 class Interactor : public VolumeImageInteractor | |
41 { | |
42 private: | |
43 LayerWidget& widget_; | |
44 size_t layer_; | |
45 | |
46 protected: | |
47 virtual void NotifySliceChange(const ISlicedVolume& volume, | |
48 const size_t& sliceIndex, | |
49 const Slice& slice) | |
50 { | |
51 const OrthancVolumeImage& image = dynamic_cast<const OrthancVolumeImage&>(volume); | |
52 | |
53 RenderStyle s = widget_.GetLayerStyle(layer_); | |
54 | |
55 if (image.FitWindowingToRange(s, slice.GetConverter())) | |
56 { | |
57 //printf("ICI: %f => %f\n", s.customWindowCenter_, s.customWindowWidth_); | |
58 widget_.SetLayerStyle(layer_, s); | |
59 } | |
60 } | |
61 | |
62 public: | |
63 Interactor(OrthancVolumeImage& volume, | |
64 LayerWidget& widget, | |
65 VolumeProjection projection, | |
66 size_t layer) : | |
67 VolumeImageInteractor(volume, widget, projection), | |
68 widget_(widget), | |
69 layer_(layer) | |
70 { | |
71 printf("OOO\n"); | |
72 } | |
73 }; | |
74 | |
41 public: | 75 public: |
42 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) | 76 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) |
43 { | 77 { |
44 boost::program_options::options_description generic("Sample options"); | 78 boost::program_options::options_description generic("Sample options"); |
45 generic.add_options() | 79 generic.add_options() |
122 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 156 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
123 } | 157 } |
124 | 158 |
125 std::auto_ptr<LayerWidget> widget(new LayerWidget); | 159 std::auto_ptr<LayerWidget> widget(new LayerWidget); |
126 | 160 |
127 #if 1 | 161 #if 0 |
128 std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context.GetWebService())); | 162 std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context.GetWebService(), true)); |
129 if (series.empty()) | 163 if (series.empty()) |
130 { | 164 { |
131 volume->ScheduleLoadInstance(instance); | 165 volume->ScheduleLoadInstance(instance); |
132 } | 166 } |
133 else | 167 else |
135 volume->ScheduleLoadSeries(series); | 169 volume->ScheduleLoadSeries(series); |
136 } | 170 } |
137 | 171 |
138 widget->AddLayer(new VolumeImageSource(*volume)); | 172 widget->AddLayer(new VolumeImageSource(*volume)); |
139 | 173 |
140 context.AddInteractor(new VolumeImageInteractor(*volume, *widget, projection)); | 174 context.AddInteractor(new Interactor(*volume, *widget, projection, 0)); |
141 context.AddVolume(volume.release()); | 175 context.AddVolume(volume.release()); |
176 | |
177 { | |
178 RenderStyle s; | |
179 s.alpha_ = 1; | |
180 s.applyLut_ = true; | |
181 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; | |
182 s.interpolation_ = ImageInterpolation_Linear; | |
183 widget->SetLayerStyle(0, s); | |
184 } | |
142 #else | 185 #else |
143 std::auto_ptr<OrthancVolumeImage> ct(new OrthancVolumeImage(context.GetWebService())); | 186 std::auto_ptr<OrthancVolumeImage> ct(new OrthancVolumeImage(context.GetWebService(), false)); |
144 ct->ScheduleLoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); | 187 //ct->ScheduleLoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); |
145 | 188 //ct->ScheduleLoadSeries("3025d8df-a82f3b00-83942fa3-ee6a6be3-a8bf32e8"); |
146 std::auto_ptr<OrthancVolumeImage> pet(new OrthancVolumeImage(context.GetWebService())); | 189 ct->ScheduleLoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); |
147 pet->ScheduleLoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e"); | 190 |
191 std::auto_ptr<OrthancVolumeImage> pet(new OrthancVolumeImage(context.GetWebService(), true)); | |
192 //pet->ScheduleLoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e"); | |
193 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); | |
194 //pet->ScheduleLoadInstance("337876a1-a68a9718-f15abccd-38faafa1-b99b496a"); | |
195 pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); | |
148 | 196 |
149 widget->AddLayer(new VolumeImageSource(*ct)); | 197 widget->AddLayer(new VolumeImageSource(*ct)); |
150 widget->AddLayer(new VolumeImageSource(*pet)); | 198 widget->AddLayer(new VolumeImageSource(*pet)); |
151 | 199 |
152 context.AddInteractor(new VolumeImageInteractor(*pet, *widget, projection)); | 200 context.AddInteractor(new Interactor(*pet, *widget, projection, 1)); |
153 context.AddVolume(ct.release()); | 201 context.AddVolume(ct.release()); |
154 context.AddVolume(pet.release()); | 202 context.AddVolume(pet.release()); |
155 | 203 |
156 { | 204 { |
157 RenderStyle s; | 205 RenderStyle s; |
163 | 211 |
164 { | 212 { |
165 RenderStyle s; | 213 RenderStyle s; |
166 //s.drawGrid_ = true; | 214 //s.drawGrid_ = true; |
167 s.SetColor(255, 0, 0); // Draw missing PET layer in red | 215 s.SetColor(255, 0, 0); // Draw missing PET layer in red |
168 s.alpha_ = 0.3; | 216 s.alpha_ = 0.5; |
169 s.applyLut_ = true; | 217 s.applyLut_ = true; |
170 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; | 218 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; |
171 s.interpolation_ = ImageInterpolation_Linear; | 219 s.interpolation_ = ImageInterpolation_Linear; |
172 widget->SetLayerStyle(1, s); | 220 widget->SetLayerStyle(1, s); |
173 } | 221 } |