comparison Applications/Samples/SingleVolumeApplication.h @ 235:ce4405d98b92 am

Added SimpleViewerApplication (working in SDL)
author am@osimis.io
date Tue, 19 Jun 2018 16:02:41 +0200
parents 5412adf19980
children 557c8ff1db5c
comparison
equal deleted inserted replaced
234:9afb50d1ac14 235:ce4405d98b92
87 } 87 }
88 }; 88 };
89 89
90 90
91 public: 91 public:
92 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) 92 virtual void DeclareStartupOptions(boost::program_options::options_description& options)
93 { 93 {
94 boost::program_options::options_description generic("Sample options"); 94 boost::program_options::options_description generic("Sample options");
95 generic.add_options() 95 generic.add_options()
96 ("series", boost::program_options::value<std::string>(), 96 ("series", boost::program_options::value<std::string>(),
97 "Orthanc ID of the series") 97 "Orthanc ID of the series")
106 ; 106 ;
107 107
108 options.add(generic); 108 options.add(generic);
109 } 109 }
110 110
111 virtual void Initialize(BasicApplicationContext& context, 111 virtual void Initialize(IStatusBar& statusBar,
112 IStatusBar& statusBar,
113 const boost::program_options::variables_map& parameters) 112 const boost::program_options::variables_map& parameters)
114 { 113 {
115 using namespace OrthancStone; 114 using namespace OrthancStone;
116 115
117 if (parameters.count("series") > 1 || 116 if (parameters.count("series") > 1 ||
145 { 144 {
146 LOG(ERROR) << "The series ID or instance ID is missing"; 145 LOG(ERROR) << "The series ID or instance ID is missing";
147 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 146 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
148 } 147 }
149 148
150 unsigned int threads = parameters["threads"].as<unsigned int>(); 149 //unsigned int threads = parameters["threads"].as<unsigned int>();
151 bool reverse = parameters["reverse"].as<bool>(); 150 //bool reverse = parameters["reverse"].as<bool>();
152 151
153 std::string tmp = parameters["projection"].as<std::string>(); 152 std::string tmp = parameters["projection"].as<std::string>();
154 Orthanc::Toolbox::ToLowerCase(tmp); 153 Orthanc::Toolbox::ToLowerCase(tmp);
155 154
156 VolumeProjection projection; 155 VolumeProjection projection;
173 } 172 }
174 173
175 std::auto_ptr<LayerWidget> widget(new LayerWidget); 174 std::auto_ptr<LayerWidget> widget(new LayerWidget);
176 175
177 #if 0 176 #if 0
178 std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context.GetWebService(), true)); 177 std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context_->GetWebService(), true));
179 if (series.empty()) 178 if (series.empty())
180 { 179 {
181 volume->ScheduleLoadInstance(instance); 180 volume->ScheduleLoadInstance(instance);
182 } 181 }
183 else 182 else
185 volume->ScheduleLoadSeries(series); 184 volume->ScheduleLoadSeries(series);
186 } 185 }
187 186
188 widget->AddLayer(new VolumeImageSource(*volume)); 187 widget->AddLayer(new VolumeImageSource(*volume));
189 188
190 context.AddInteractor(new Interactor(*volume, *widget, projection, 0)); 189 context_->AddInteractor(new Interactor(*volume, *widget, projection, 0));
191 context.AddSlicedVolume(volume.release()); 190 context_->AddSlicedVolume(volume.release());
192 191
193 { 192 {
194 RenderStyle s; 193 RenderStyle s;
195 s.alpha_ = 1; 194 s.alpha_ = 1;
196 s.applyLut_ = true; 195 s.applyLut_ = true;
197 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; 196 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET;
198 s.interpolation_ = ImageInterpolation_Bilinear; 197 s.interpolation_ = ImageInterpolation_Bilinear;
199 widget->SetLayerStyle(0, s); 198 widget->SetLayerStyle(0, s);
200 } 199 }
201 #else 200 #else
202 std::auto_ptr<OrthancVolumeImage> ct(new OrthancVolumeImage(context.GetWebService(), false)); 201 std::auto_ptr<OrthancVolumeImage> ct(new OrthancVolumeImage(context_->GetWebService(), false));
203 //ct->ScheduleLoadSeries("15a6f44a-ac7b88fe-19c462d9-dddd918e-b01550d8"); // 0178023P 202 //ct->ScheduleLoadSeries("15a6f44a-ac7b88fe-19c462d9-dddd918e-b01550d8"); // 0178023P
204 //ct->ScheduleLoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); 203 //ct->ScheduleLoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d");
205 //ct->ScheduleLoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // IBA 204 //ct->ScheduleLoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // IBA
206 //ct->ScheduleLoadSeries("03677739-1d8bca40-db1daf59-d74ff548-7f6fc9c0"); // 0522c0001 TCIA 205 //ct->ScheduleLoadSeries("03677739-1d8bca40-db1daf59-d74ff548-7f6fc9c0"); // 0522c0001 TCIA
207 ct->ScheduleLoadSeries("295e8a13-dfed1320-ba6aebb2-9a13e20f-1b3eb953"); // Captain 206 ct->ScheduleLoadSeries("295e8a13-dfed1320-ba6aebb2-9a13e20f-1b3eb953"); // Captain
208 207
209 std::auto_ptr<OrthancVolumeImage> pet(new OrthancVolumeImage(context.GetWebService(), true)); 208 std::auto_ptr<OrthancVolumeImage> pet(new OrthancVolumeImage(context_->GetWebService(), true));
210 //pet->ScheduleLoadSeries("48d2997f-8e25cd81-dd715b64-bd79cdcc-e8fcee53"); // 0178023P 209 //pet->ScheduleLoadSeries("48d2997f-8e25cd81-dd715b64-bd79cdcc-e8fcee53"); // 0178023P
211 //pet->ScheduleLoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e"); 210 //pet->ScheduleLoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e");
212 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 1 211 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 1
213 //pet->ScheduleLoadInstance("337876a1-a68a9718-f15abccd-38faafa1-b99b496a"); // IBA 2 212 //pet->ScheduleLoadInstance("337876a1-a68a9718-f15abccd-38faafa1-b99b496a"); // IBA 2
214 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 3 213 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 3
215 //pet->ScheduleLoadInstance("269f26f4-0c83eeeb-2e67abbd-5467a40f-f1bec90c"); // 0522c0001 TCIA 214 //pet->ScheduleLoadInstance("269f26f4-0c83eeeb-2e67abbd-5467a40f-f1bec90c"); // 0522c0001 TCIA
216 pet->ScheduleLoadInstance("f080888c-0ab7528a-f7d9c28c-84980eb1-ff3b0ae6"); // Captain 1 215 pet->ScheduleLoadInstance("f080888c-0ab7528a-f7d9c28c-84980eb1-ff3b0ae6"); // Captain 1
217 //pet->ScheduleLoadInstance("4f78055b-6499a2c5-1e089290-394acc05-3ec781c1"); // Captain 2 216 //pet->ScheduleLoadInstance("4f78055b-6499a2c5-1e089290-394acc05-3ec781c1"); // Captain 2
218 217
219 std::auto_ptr<StructureSetLoader> rtStruct(new StructureSetLoader(context.GetWebService())); 218 std::auto_ptr<StructureSetLoader> rtStruct(new StructureSetLoader(context_->GetWebService()));
220 //rtStruct->ScheduleLoadInstance("c2ebc17b-6b3548db-5e5da170-b8ecab71-ea03add3"); // 0178023P 219 //rtStruct->ScheduleLoadInstance("c2ebc17b-6b3548db-5e5da170-b8ecab71-ea03add3"); // 0178023P
221 //rtStruct->ScheduleLoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // IBA 220 //rtStruct->ScheduleLoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // IBA
222 //rtStruct->ScheduleLoadInstance("17cd032b-ad92a438-ca05f06a-f9e96668-7e3e9e20"); // 0522c0001 TCIA 221 //rtStruct->ScheduleLoadInstance("17cd032b-ad92a438-ca05f06a-f9e96668-7e3e9e20"); // 0522c0001 TCIA
223 rtStruct->ScheduleLoadInstance("96c889ab-29fe5c54-dda6e66c-3949e4da-58f90d75"); // Captain 222 rtStruct->ScheduleLoadInstance("96c889ab-29fe5c54-dda6e66c-3949e4da-58f90d75"); // Captain
224 223
225 widget->AddLayer(new VolumeImageSource(*ct)); 224 widget->AddLayer(new VolumeImageSource(*ct));
226 widget->AddLayer(new VolumeImageSource(*pet)); 225 widget->AddLayer(new VolumeImageSource(*pet));
227 widget->AddLayer(new DicomStructureSetRendererFactory(*rtStruct)); 226 widget->AddLayer(new DicomStructureSetRendererFactory(*rtStruct));
228 227
229 context.AddInteractor(new Interactor(*pet, *widget, projection, 1)); 228 context_->AddInteractor(new Interactor(*pet, *widget, projection, 1));
230 //context.AddInteractor(new VolumeImageInteractor(*ct, *widget, projection)); 229 //context_->AddInteractor(new VolumeImageInteractor(*ct, *widget, projection));
231 230
232 context.AddSlicedVolume(ct.release()); 231 context_->AddSlicedVolume(ct.release());
233 context.AddSlicedVolume(pet.release()); 232 context_->AddSlicedVolume(pet.release());
234 context.AddVolumeLoader(rtStruct.release()); 233 context_->AddVolumeLoader(rtStruct.release());
235 234
236 { 235 {
237 RenderStyle s; 236 RenderStyle s;
238 //s.drawGrid_ = true; 237 //s.drawGrid_ = true;
239 s.alpha_ = 1; 238 s.alpha_ = 1;
261 statusBar.SetMessage("Use the keys \"t\" to track the (X,Y,Z) mouse coordinates"); 260 statusBar.SetMessage("Use the keys \"t\" to track the (X,Y,Z) mouse coordinates");
262 statusBar.SetMessage("Use the keys \"m\" to measure distances"); 261 statusBar.SetMessage("Use the keys \"m\" to measure distances");
263 statusBar.SetMessage("Use the keys \"c\" to draw circles"); 262 statusBar.SetMessage("Use the keys \"c\" to draw circles");
264 263
265 widget->SetTransmitMouseOver(true); 264 widget->SetTransmitMouseOver(true);
266 context.SetCentralWidget(widget.release()); 265 context_->SetCentralWidget(widget.release());
267 } 266 }
268 }; 267 };
269 } 268 }
270 } 269 }