comparison Framework/Volumes/StructureSetLoader.cpp @ 726:4f2416d519b4

moving layers, widgets and loaders to Deprecated namespace
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 11:43:25 +0200
parents 42dadae61fa9
children
comparison
equal deleted inserted replaced
714:d2c0e347ddc2 726:4f2416d519b4
23 23
24 #include "../Toolbox/MessagingToolbox.h" 24 #include "../Toolbox/MessagingToolbox.h"
25 25
26 #include <Core/OrthancException.h> 26 #include <Core/OrthancException.h>
27 27
28 namespace OrthancStone 28 namespace Deprecated
29 { 29 {
30 StructureSetLoader::StructureSetLoader(MessageBroker& broker, 30 StructureSetLoader::StructureSetLoader(OrthancStone::MessageBroker& broker,
31 OrthancApiClient& orthanc) : 31 OrthancApiClient& orthanc) :
32 IVolumeLoader(broker), 32 IVolumeLoader(broker),
33 IObserver(broker), 33 IObserver(broker),
34 orthanc_(orthanc) 34 orthanc_(orthanc)
35 { 35 {
39 void StructureSetLoader::OnReferencedSliceLoaded(const OrthancApiClient::JsonResponseReadyMessage& message) 39 void StructureSetLoader::OnReferencedSliceLoaded(const OrthancApiClient::JsonResponseReadyMessage& message)
40 { 40 {
41 OrthancPlugins::FullOrthancDataset dataset(message.GetJson()); 41 OrthancPlugins::FullOrthancDataset dataset(message.GetJson());
42 42
43 Orthanc::DicomMap slice; 43 Orthanc::DicomMap slice;
44 MessagingToolbox::ConvertDataset(slice, dataset); 44 OrthancStone::MessagingToolbox::ConvertDataset(slice, dataset);
45 structureSet_->AddReferencedSlice(slice); 45 structureSet_->AddReferencedSlice(slice);
46 46
47 BroadcastMessage(ContentChangedMessage(*this)); 47 BroadcastMessage(ContentChangedMessage(*this));
48 } 48 }
49 49
50 50
51 void StructureSetLoader::OnStructureSetLoaded(const OrthancApiClient::JsonResponseReadyMessage& message) 51 void StructureSetLoader::OnStructureSetLoaded(const OrthancApiClient::JsonResponseReadyMessage& message)
52 { 52 {
53 OrthancPlugins::FullOrthancDataset dataset(message.GetJson()); 53 OrthancPlugins::FullOrthancDataset dataset(message.GetJson());
54 structureSet_.reset(new DicomStructureSet(dataset)); 54 structureSet_.reset(new OrthancStone::DicomStructureSet(dataset));
55 55
56 std::set<std::string> instances; 56 std::set<std::string> instances;
57 structureSet_->GetReferencedInstances(instances); 57 structureSet_->GetReferencedInstances(instances);
58 58
59 for (std::set<std::string>::const_iterator it = instances.begin(); 59 for (std::set<std::string>::const_iterator it = instances.begin();
60 it != instances.end(); ++it) 60 it != instances.end(); ++it)
61 { 61 {
62 orthanc_.PostBinaryAsyncExpectJson("/tools/lookup", *it, 62 orthanc_.PostBinaryAsyncExpectJson("/tools/lookup", *it,
63 new Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnLookupCompleted)); 63 new OrthancStone::Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnLookupCompleted));
64 } 64 }
65 65
66 BroadcastMessage(GeometryReadyMessage(*this)); 66 BroadcastMessage(GeometryReadyMessage(*this));
67 } 67 }
68 68
82 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); 82 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
83 } 83 }
84 84
85 const std::string& instance = lookup[0]["ID"].asString(); 85 const std::string& instance = lookup[0]["ID"].asString();
86 orthanc_.GetJsonAsync("/instances/" + instance + "/tags", 86 orthanc_.GetJsonAsync("/instances/" + instance + "/tags",
87 new Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnReferencedSliceLoaded)); 87 new OrthancStone::Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnReferencedSliceLoaded));
88 } 88 }
89 89
90 90
91 void StructureSetLoader::ScheduleLoadInstance(const std::string& instance) 91 void StructureSetLoader::ScheduleLoadInstance(const std::string& instance)
92 { 92 {
95 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); 95 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
96 } 96 }
97 else 97 else
98 { 98 {
99 orthanc_.GetJsonAsync("/instances/" + instance + "/tags?ignore-length=3006-0050", 99 orthanc_.GetJsonAsync("/instances/" + instance + "/tags?ignore-length=3006-0050",
100 new Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnStructureSetLoaded)); 100 new OrthancStone::Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnStructureSetLoaded));
101 } 101 }
102 } 102 }
103 103
104 104
105 DicomStructureSet& StructureSetLoader::GetStructureSet() 105 OrthancStone::DicomStructureSet& StructureSetLoader::GetStructureSet()
106 { 106 {
107 if (structureSet_.get() == NULL) 107 if (structureSet_.get() == NULL)
108 { 108 {
109 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); 109 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
110 } 110 }