annotate Framework/Deprecated/Volumes/StructureSetLoader.cpp @ 1006:4f28d9459e31 toa2019092001

Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 20 Sep 2019 12:13:10 +0200
parents 4fe4b221a31f
children b537002f83a9 2d8ab34c8c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 404
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "StructureSetLoader.h"
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
792
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
24 #include "../Toolbox/MessagingToolbox.h"
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
26 #include <Core/OrthancException.h>
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
28 namespace Deprecated
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
30 StructureSetLoader::StructureSetLoader(OrthancStone::MessageBroker& broker,
404
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
31 OrthancApiClient& orthanc) :
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
32 IVolumeLoader(broker),
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
33 IObserver(broker),
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 orthanc_(orthanc)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
39 void StructureSetLoader::OnReferencedSliceLoaded(const OrthancApiClient::JsonResponseReadyMessage& message)
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
40 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 300
diff changeset
41 OrthancPlugins::FullOrthancDataset dataset(message.GetJson());
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
42
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
43 Orthanc::DicomMap slice;
792
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
44 MessagingToolbox::ConvertDataset(slice, dataset);
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
45 structureSet_->AddReferencedSlice(slice);
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
46
623
42dadae61fa9 renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
47 BroadcastMessage(ContentChangedMessage(*this));
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
48 }
404
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
49
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
50
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
51 void StructureSetLoader::OnStructureSetLoaded(const OrthancApiClient::JsonResponseReadyMessage& message)
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
52 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 300
diff changeset
53 OrthancPlugins::FullOrthancDataset dataset(message.GetJson());
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
54 structureSet_.reset(new OrthancStone::DicomStructureSet(dataset));
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
55
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
56 std::set<std::string> instances;
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
57 structureSet_->GetReferencedInstances(instances);
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
58
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
59 for (std::set<std::string>::const_iterator it = instances.begin();
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
60 it != instances.end(); ++it)
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
61 {
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
62 orthanc_.PostBinaryAsyncExpectJson("/tools/lookup", *it,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
63 new OrthancStone::Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnLookupCompleted));
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
64 }
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
65
623
42dadae61fa9 renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
66 BroadcastMessage(GeometryReadyMessage(*this));
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
67 }
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
68
404
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
69
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
70 void StructureSetLoader::OnLookupCompleted(const OrthancApiClient::JsonResponseReadyMessage& message)
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
71 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 300
diff changeset
72 const Json::Value& lookup = message.GetJson();
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
73
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
74 if (lookup.type() != Json::arrayValue ||
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
75 lookup.size() != 1 ||
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
76 !lookup[0].isMember("Type") ||
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
77 !lookup[0].isMember("Path") ||
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
78 lookup[0]["Type"].type() != Json::stringValue ||
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
79 lookup[0]["ID"].type() != Json::stringValue ||
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
80 lookup[0]["Type"].asString() != "Instance")
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
81 {
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
82 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
83 }
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
84
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
85 const std::string& instance = lookup[0]["ID"].asString();
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
86 orthanc_.GetJsonAsync("/instances/" + instance + "/tags",
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
87 new OrthancStone::Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnReferencedSliceLoaded));
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
88 }
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
89
404
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 377
diff changeset
90
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 void StructureSetLoader::ScheduleLoadInstance(const std::string& instance)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 if (structureSet_.get() != NULL)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 else
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 {
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 257
diff changeset
99 orthanc_.GetJsonAsync("/instances/" + instance + "/tags?ignore-length=3006-0050",
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
100 new OrthancStone::Callable<StructureSetLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &StructureSetLoader::OnStructureSetLoaded));
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
105 OrthancStone::DicomStructureSet& StructureSetLoader::GetStructureSet()
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 if (structureSet_.get() == NULL)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 else
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 return *structureSet_;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 }
792
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
116
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
117
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
118 OrthancStone::DicomStructureSet* StructureSetLoader::SynchronousLoad(
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
119 OrthancPlugins::IOrthancConnection& orthanc,
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
120 const std::string& instanceId)
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
121 {
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
122 const std::string uri = "/instances/" + instanceId + "/tags?ignore-length=3006-0050";
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
123 OrthancPlugins::FullOrthancDataset dataset(orthanc, uri);
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
124
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
125 std::auto_ptr<OrthancStone::DicomStructureSet> result
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
126 (new OrthancStone::DicomStructureSet(dataset));
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
127
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
128 std::set<std::string> instances;
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
129 result->GetReferencedInstances(instances);
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
130
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
131 for (std::set<std::string>::const_iterator it = instances.begin();
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
132 it != instances.end(); ++it)
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
133 {
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
134 Json::Value lookup;
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
135 MessagingToolbox::RestApiPost(lookup, orthanc, "/tools/lookup", *it);
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
136
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
137 if (lookup.type() != Json::arrayValue ||
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
138 lookup.size() != 1 ||
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
139 !lookup[0].isMember("Type") ||
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
140 !lookup[0].isMember("Path") ||
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
141 lookup[0]["Type"].type() != Json::stringValue ||
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
142 lookup[0]["ID"].type() != Json::stringValue ||
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
143 lookup[0]["Type"].asString() != "Instance")
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
144 {
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
145 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource);
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
146 }
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
147
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
148 OrthancPlugins::FullOrthancDataset slice
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
149 (orthanc, "/instances/" + lookup[0]["ID"].asString() + "/tags");
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
150 Orthanc::DicomMap m;
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
151 MessagingToolbox::ConvertDataset(m, slice);
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
152 result->AddReferencedSlice(m);
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
153 }
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
154
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
155 result->CheckReferencedSlices();
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
156
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
157 return result.release();
4fe4b221a31f deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
158 }
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }