Mercurial > hg > orthanc-stone
comparison Applications/Samples/SingleFrameEditorApplication.h @ 417:aee3d7941c9b
preparing to load images using DICOMweb
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 15 Nov 2018 17:28:15 +0100 |
parents | c0589c3173fd |
children | c23df8b3433b |
comparison
equal
deleted
inserted
replaced
415:c0589c3173fd | 417:aee3d7941c9b |
---|---|
59 Tool_Resize, | 59 Tool_Resize, |
60 Tool_Windowing | 60 Tool_Windowing |
61 }; | 61 }; |
62 | 62 |
63 | 63 |
64 UndoRedoStack undoRedoStack_; | 64 StoneApplicationContext* context_; |
65 Tool tool_; | 65 UndoRedoStack undoRedoStack_; |
66 Tool tool_; | |
66 | 67 |
67 | 68 |
68 static double GetHandleSize() | 69 static double GetHandleSize() |
69 { | 70 { |
70 return 10.0; | 71 return 10.0; |
72 | 73 |
73 | 74 |
74 public: | 75 public: |
75 RadiographyEditorInteractor(MessageBroker& broker) : | 76 RadiographyEditorInteractor(MessageBroker& broker) : |
76 IObserver(broker), | 77 IObserver(broker), |
78 context_(NULL), | |
77 tool_(Tool_Move) | 79 tool_(Tool_Move) |
78 { | 80 { |
81 } | |
82 | |
83 void SetContext(StoneApplicationContext& context) | |
84 { | |
85 context_ = &context; | |
79 } | 86 } |
80 | 87 |
81 virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& worldWidget, | 88 virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& worldWidget, |
82 const ViewportGeometry& view, | 89 const ViewportGeometry& view, |
83 MouseButton button, | 90 MouseButton button, |
290 tags.SetValue(Orthanc::DICOM_TAG_SERIES_NUMBER, "1", false); | 297 tags.SetValue(Orthanc::DICOM_TAG_SERIES_NUMBER, "1", false); |
291 tags.SetValue(Orthanc::DICOM_TAG_SOP_CLASS_UID, "1.2.840.10008.5.1.4.1.1.1", false); | 298 tags.SetValue(Orthanc::DICOM_TAG_SOP_CLASS_UID, "1.2.840.10008.5.1.4.1.1.1", false); |
292 tags.SetValue(Orthanc::DICOM_TAG_STUDY_ID, "STUDY", false); | 299 tags.SetValue(Orthanc::DICOM_TAG_STUDY_ID, "STUDY", false); |
293 tags.SetValue(Orthanc::DICOM_TAG_VIEW_POSITION, "", false); | 300 tags.SetValue(Orthanc::DICOM_TAG_VIEW_POSITION, "", false); |
294 | 301 |
295 widget.GetScene().ExportDicom(tags, 0.1, 0.1, widget.IsInverted(), | 302 if (context_ != NULL) |
296 widget.GetInterpolation(), EXPORT_USING_PAM); | 303 { |
304 widget.GetScene().ExportDicom(context_->GetOrthancApiClient(), | |
305 tags, 0.1, 0.1, widget.IsInverted(), | |
306 widget.GetInterpolation(), EXPORT_USING_PAM); | |
307 } | |
308 | |
297 break; | 309 break; |
298 } | 310 } |
299 | 311 |
300 case 'i': | 312 case 'i': |
301 widget.SwitchInvert(); | 313 widget.SwitchInvert(); |
365 class SingleFrameEditorApplication : | 377 class SingleFrameEditorApplication : |
366 public SampleSingleCanvasApplicationBase, | 378 public SampleSingleCanvasApplicationBase, |
367 public IObserver | 379 public IObserver |
368 { | 380 { |
369 private: | 381 private: |
370 std::auto_ptr<OrthancApiClient> orthancApiClient_; | |
371 std::auto_ptr<RadiographyScene> scene_; | 382 std::auto_ptr<RadiographyScene> scene_; |
372 RadiographyEditorInteractor interactor_; | 383 RadiographyEditorInteractor interactor_; |
373 | 384 |
374 public: | 385 public: |
375 SingleFrameEditorApplication(MessageBroker& broker) : | 386 SingleFrameEditorApplication(MessageBroker& broker) : |
401 const boost::program_options::variables_map& parameters) | 412 const boost::program_options::variables_map& parameters) |
402 { | 413 { |
403 using namespace OrthancStone; | 414 using namespace OrthancStone; |
404 | 415 |
405 context_ = context; | 416 context_ = context; |
417 interactor_.SetContext(*context); | |
406 | 418 |
407 statusBar.SetMessage("Use the key \"a\" to reinitialize the layout"); | 419 statusBar.SetMessage("Use the key \"a\" to reinitialize the layout"); |
408 statusBar.SetMessage("Use the key \"c\" to crop"); | 420 statusBar.SetMessage("Use the key \"c\" to crop"); |
409 statusBar.SetMessage("Use the key \"e\" to export DICOM to the Orthanc server"); | 421 statusBar.SetMessage("Use the key \"e\" to export DICOM to the Orthanc server"); |
410 statusBar.SetMessage("Use the key \"f\" to switch full screen"); | 422 statusBar.SetMessage("Use the key \"f\" to switch full screen"); |
425 } | 437 } |
426 | 438 |
427 std::string instance = parameters["instance"].as<std::string>(); | 439 std::string instance = parameters["instance"].as<std::string>(); |
428 int frame = parameters["frame"].as<unsigned int>(); | 440 int frame = parameters["frame"].as<unsigned int>(); |
429 | 441 |
430 orthancApiClient_.reset(new OrthancApiClient(GetBroker(), context_->GetWebService())); | |
431 | |
432 Orthanc::FontRegistry fonts; | 442 Orthanc::FontRegistry fonts; |
433 fonts.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16); | 443 fonts.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16); |
434 | 444 |
435 scene_.reset(new RadiographyScene(GetBroker(), *orthancApiClient_)); | 445 scene_.reset(new RadiographyScene(GetBroker())); |
436 scene_->LoadDicomFrame(instance, frame, false); //.SetPan(200, 0); | 446 //scene_->LoadDicomFrame(instance, frame, false); //.SetPan(200, 0); |
437 //scene_->LoadDicomFrame("61f3143e-96f34791-ad6bbb8d-62559e75-45943e1b", 0, false); | 447 scene_->LoadDicomFrame(context->GetOrthancApiClient(), "61f3143e-96f34791-ad6bbb8d-62559e75-45943e1b", 0, false); |
438 | 448 //scene_->LoadDicomWebFrame(context->GetWebService()); |
449 | |
439 { | 450 { |
440 RadiographyLayer& layer = scene_->LoadText(fonts.GetFont(0), "Hello\nworld"); | 451 RadiographyLayer& layer = scene_->LoadText(fonts.GetFont(0), "Hello\nworld"); |
441 layer.SetResizeable(true); | 452 layer.SetResizeable(true); |
442 } | 453 } |
443 | 454 |