annotate OrthancServer/OrthancMoveRequestHandler.cpp @ 1271:83d8b3eacf49

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Jan 2015 17:23:02 +0100
parents 703fcd797186
children 6e7e5ed91c2d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
689
2d0a347e8cfc switch to 2014
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
824
a811bdf8b8eb precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 810
diff changeset
32
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
33 #include "PrecompiledHeadersServer.h"
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "OrthancMoveRequestHandler.h"
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include <glog/logging.h>
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include "OrthancInitialization.h"
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace Orthanc
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 namespace
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 // Anonymous namespace to avoid clashes between compilation modules
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 class OrthancMoveRequestIterator : public IMoveRequestIterator
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 private:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 ServerContext& context_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 std::vector<std::string> instances_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 size_t position_;
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
52 RemoteModalityParameters remote_;
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
53
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 public:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 OrthancMoveRequestIterator(ServerContext& context,
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
56 const std::string& aet,
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 const std::string& publicId) :
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 context_(context),
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
59 position_(0)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
61 LOG(INFO) << "Sending resource " << publicId << " to modality \"" << aet << "\"";
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 std::list<std::string> tmp;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 context_.GetIndex().GetChildInstances(tmp, publicId);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 instances_.reserve(tmp.size());
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 619
diff changeset
67 for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); ++it)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 instances_.push_back(*it);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 }
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
71
810
401a9633e492 configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 776
diff changeset
72 remote_ = Configuration::GetModalityUsingAet(aet);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 virtual unsigned int GetSubOperationCount() const
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 return instances_.size();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 virtual Status DoNext()
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 if (position_ >= instances_.size())
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 return Status_Failure;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 const std::string& id = instances_[position_++];
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 std::string dicom;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 context_.ReadFile(dicom, id, FileContentType_Dicom);
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
91
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
92 {
776
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 772
diff changeset
93 ReusableDicomUserConnection::Locker locker
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
94 (context_.GetReusableDicomUserConnection(), remote_);
776
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 772
diff changeset
95 locker.GetConnection().Store(dicom);
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
96 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 return Status_Success;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 };
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
104 bool OrthancMoveRequestHandler::LookupIdentifier(std::string& publicId,
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
105 DicomTag tag,
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
106 const DicomMap& input)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 if (!input.HasTag(tag))
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 std::string value = input.GetValue(tag).AsString();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 std::list<std::string> ids;
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
116 context_.GetIndex().LookupIdentifier(ids, tag, value);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 if (ids.size() != 1)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 else
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 publicId = ids.front();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 return true;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
130 IMoveRequestIterator* OrthancMoveRequestHandler::Handle(const std::string& aet,
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 const DicomMap& input)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 {
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
133 LOG(WARNING) << "Move-SCU request received for AET \"" << aet << "\"";
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 * Retrieve the query level.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
139 ResourceType level;
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL);
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
141
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
142 if (levelTmp != NULL)
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
143 {
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
144 level = StringToResourceType(levelTmp->AsString().c_str());
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
145 }
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
146 else
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 {
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
148 // The query level is not present in the C-Move request, which
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
149 // does not follow the DICOM standard. This is for instance the
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
150 // behavior of Tudor DICOM. Try and automatically deduce the
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
151 // query level: Start from the instance level, going up to the
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
152 // patient level until a valid DICOM identifier is found.
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
153
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
154 std::string publicId;
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
155
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
156 if (LookupIdentifier(publicId, DICOM_TAG_SOP_INSTANCE_UID, input) ||
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
157 LookupIdentifier(publicId, DICOM_TAG_SERIES_INSTANCE_UID, input) ||
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
158 LookupIdentifier(publicId, DICOM_TAG_STUDY_INSTANCE_UID, input) ||
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
159 LookupIdentifier(publicId, DICOM_TAG_PATIENT_ID, input))
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
160 {
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
161 return new OrthancMoveRequestIterator(context_, aet, publicId);
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
162 }
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
163 else
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
164 {
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
165 // No identifier is present in the request.
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
166 throw OrthancException(ErrorCode_BadRequest);
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
167 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
170
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 * Lookup for the resource to be sent.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 bool ok;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 std::string publicId;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 switch (level)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 case ResourceType_Patient:
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
182 ok = LookupIdentifier(publicId, DICOM_TAG_PATIENT_ID, input);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 case ResourceType_Study:
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
186 ok = LookupIdentifier(publicId, DICOM_TAG_STUDY_INSTANCE_UID, input);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 case ResourceType_Series:
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
190 ok = LookupIdentifier(publicId, DICOM_TAG_SERIES_INSTANCE_UID, input);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 case ResourceType_Instance:
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
194 ok = LookupIdentifier(publicId, DICOM_TAG_SOP_INSTANCE_UID, input);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 default:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 ok = false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 if (!ok)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 throw OrthancException(ErrorCode_BadRequest);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
206 return new OrthancMoveRequestIterator(context_, aet, publicId);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }