annotate Framework/Volumes/StructureSetLoader.cpp @ 130:1982d6c1d2ff wasm

IVolumeLoader
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 Nov 2017 13:46:03 +0100
parents
children e2fe9352f240
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
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017 Osimis, Belgium
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
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "../Toolbox/MessagingToolbox.h"
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include <Core/OrthancException.h>
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancStone
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 class StructureSetLoader::Operation : public Orthanc::IDynamicObject
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 public:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 enum Type
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 Type_LoadStructureSet,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 Type_LookupSopInstanceUid,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 Type_LoadReferencedSlice
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 };
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 private:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 Type type_;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 std::string value_;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 public:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 Operation(Type type,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 const std::string& value) :
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 type_(type),
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 value_(value)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 Type GetType() const
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 return type_;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 const std::string& GetIdentifier() const
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 return value_;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 };
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 void StructureSetLoader::NotifyError(const std::string& uri,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 Orthanc::IDynamicObject* payload)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 // TODO
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 void StructureSetLoader::NotifySuccess(const std::string& uri,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 const void* answer,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 size_t answerSize,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 Orthanc::IDynamicObject* payload)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 std::auto_ptr<Operation> op(dynamic_cast<Operation*>(payload));
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 switch (op->GetType())
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 case Operation::Type_LoadStructureSet:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 OrthancPlugins::FullOrthancDataset dataset(answer, answerSize);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 structureSet_.reset(new DicomStructureSet(dataset));
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 std::set<std::string> instances;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 structureSet_->GetReferencedInstances(instances);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 for (std::set<std::string>::const_iterator it = instances.begin();
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 it != instances.end(); ++it)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 orthanc_.SchedulePostRequest(*this, "/tools/lookup", *it,
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 new Operation(Operation::Type_LookupSopInstanceUid, *it));
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 VolumeLoaderBase::NotifyGeometryReady();
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 break;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 case Operation::Type_LookupSopInstanceUid:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 Json::Value lookup;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 if (MessagingToolbox::ParseJson(lookup, answer, answerSize))
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 if (lookup.type() != Json::arrayValue ||
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 lookup.size() != 1 ||
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 !lookup[0].isMember("Type") ||
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 !lookup[0].isMember("Path") ||
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 lookup[0]["Type"].type() != Json::stringValue ||
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 lookup[0]["ID"].type() != Json::stringValue ||
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 lookup[0]["Type"].asString() != "Instance")
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 const std::string& instance = lookup[0]["ID"].asString();
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 orthanc_.ScheduleGetRequest(*this, "/instances/" + instance + "/tags",
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 new Operation(Operation::Type_LoadReferencedSlice, instance));
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 else
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 // TODO
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 break;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 case Operation::Type_LoadReferencedSlice:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 OrthancPlugins::FullOrthancDataset dataset(answer, answerSize);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 Orthanc::DicomMap slice;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 MessagingToolbox::ConvertDataset(slice, dataset);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 structureSet_->AddReferencedSlice(slice);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 VolumeLoaderBase::NotifyContentChange();
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 break;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 default:
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 StructureSetLoader::StructureSetLoader(IWebService& orthanc) :
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 orthanc_(orthanc)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 void StructureSetLoader::ScheduleLoadInstance(const std::string& instance)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 if (structureSet_.get() != NULL)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 else
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 const std::string uri = "/instances/" + instance + "/tags?ignore-length=3006-0050";
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 orthanc_.ScheduleGetRequest(*this, uri, new Operation(Operation::Type_LoadStructureSet, instance));
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 DicomStructureSet& StructureSetLoader::GetStructureSet()
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 if (structureSet_.get() == NULL)
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 else
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 return *structureSet_;
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 }
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 }