Mercurial > hg > orthanc-stone
comparison Framework/Deprecated/Volumes/StructureSetLoader.cpp @ 792:4fe4b221a31f
deprecating MessagingToolbox
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 28 May 2019 08:49:49 +0200 |
parents | c35e98d22764 |
children | b537002f83a9 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
791:907189734acd | 792:4fe4b221a31f |
---|---|
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #include "StructureSetLoader.h" | 22 #include "StructureSetLoader.h" |
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 Deprecated | 28 namespace Deprecated |
29 { | 29 { |
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 OrthancStone::MessagingToolbox::ConvertDataset(slice, dataset); | 44 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 |
111 else | 111 else |
112 { | 112 { |
113 return *structureSet_; | 113 return *structureSet_; |
114 } | 114 } |
115 } | 115 } |
116 | |
117 | |
118 OrthancStone::DicomStructureSet* StructureSetLoader::SynchronousLoad( | |
119 OrthancPlugins::IOrthancConnection& orthanc, | |
120 const std::string& instanceId) | |
121 { | |
122 const std::string uri = "/instances/" + instanceId + "/tags?ignore-length=3006-0050"; | |
123 OrthancPlugins::FullOrthancDataset dataset(orthanc, uri); | |
124 | |
125 std::auto_ptr<OrthancStone::DicomStructureSet> result | |
126 (new OrthancStone::DicomStructureSet(dataset)); | |
127 | |
128 std::set<std::string> instances; | |
129 result->GetReferencedInstances(instances); | |
130 | |
131 for (std::set<std::string>::const_iterator it = instances.begin(); | |
132 it != instances.end(); ++it) | |
133 { | |
134 Json::Value lookup; | |
135 MessagingToolbox::RestApiPost(lookup, orthanc, "/tools/lookup", *it); | |
136 | |
137 if (lookup.type() != Json::arrayValue || | |
138 lookup.size() != 1 || | |
139 !lookup[0].isMember("Type") || | |
140 !lookup[0].isMember("Path") || | |
141 lookup[0]["Type"].type() != Json::stringValue || | |
142 lookup[0]["ID"].type() != Json::stringValue || | |
143 lookup[0]["Type"].asString() != "Instance") | |
144 { | |
145 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); | |
146 } | |
147 | |
148 OrthancPlugins::FullOrthancDataset slice | |
149 (orthanc, "/instances/" + lookup[0]["ID"].asString() + "/tags"); | |
150 Orthanc::DicomMap m; | |
151 MessagingToolbox::ConvertDataset(m, slice); | |
152 result->AddReferencedSlice(m); | |
153 } | |
154 | |
155 result->CheckReferencedSlices(); | |
156 | |
157 return result.release(); | |
158 } | |
116 } | 159 } |