annotate OrthancServer/OrthancMoveRequestHandler.cpp @ 2996:d547f998c947 db-changes

integration mainline->db-changes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Dec 2018 20:33:13 +0100
parents 6896a7c1cbe2
children 54e422fe31ce 4e43e67f8ecf
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
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1231
diff changeset
4 * Department, University Hospital of Liege, Belgium
2447
878b59270859 upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * 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
18 * modify file(s) with this exception, you may extend this exception to
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * 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
20 * you do not wish to do so, delete this exception statement from your
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
824
a811bdf8b8eb precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 810
diff changeset
33
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
34 #include "PrecompiledHeadersServer.h"
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "OrthancMoveRequestHandler.h"
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
37 #include "OrthancConfiguration.h"
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
38 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
39 #include "../Core/DicomFormat/DicomArray.h"
1486
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
40 #include "../Core/Logging.h"
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
41 #include "ServerJobs/DicomModalityStoreJob.h"
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 namespace Orthanc
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 namespace
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 // Anonymous namespace to avoid clashes between compilation modules
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
49 class SynchronousMove : public IMoveRequestIterator
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 private:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ServerContext& context_;
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1371
diff changeset
53 const std::string& localAet_;
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 std::vector<std::string> instances_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 size_t position_;
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
56 RemoteModalityParameters remote_;
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
57 std::string originatorAet_;
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
58 uint16_t originatorId_;
2590
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
59 std::auto_ptr<DicomUserConnection> connection_;
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
60
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 public:
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
62 SynchronousMove(ServerContext& context,
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
63 const std::string& targetAet,
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
64 const std::string& publicId,
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
65 const std::string& originatorAet,
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
66 uint16_t originatorId) :
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 context_(context),
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1371
diff changeset
68 localAet_(context.GetDefaultLocalApplicationEntityTitle()),
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
69 position_(0),
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
70 originatorAet_(originatorAet),
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
71 originatorId_(originatorId)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
2964
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
73 LOG(INFO) << "Sending resource " << publicId << " to modality \""
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
74 << targetAet << "\" in synchronous mode";
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 std::list<std::string> tmp;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 context_.GetIndex().GetChildInstances(tmp, publicId);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 instances_.reserve(tmp.size());
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 619
diff changeset
80 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
81 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 instances_.push_back(*it);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
84
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
85 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
86 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
87 remote_ = lock.GetConfiguration().GetModalityUsingAet(targetAet);
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
88 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 virtual unsigned int GetSubOperationCount() const
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 return instances_.size();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 virtual Status DoNext()
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 if (position_ >= instances_.size())
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 return Status_Failure;
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 const std::string& id = instances_[position_++];
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 std::string dicom;
2124
2b1520efa282 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2115
diff changeset
106 context_.ReadDicom(dicom, id);
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
107
2590
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
108 if (connection_.get() == NULL)
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
109 {
2590
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
110 connection_.reset(new DicomUserConnection(localAet_, remote_));
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
111 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
2590
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
113 connection_->Store(dicom, originatorAet_, originatorId_);
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
114
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 return Status_Success;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 };
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
118
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
119
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
120 class AsynchronousMove : public IMoveRequestIterator
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
121 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
122 private:
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
123 ServerContext& context_;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
124 std::auto_ptr<DicomModalityStoreJob> job_;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
125 size_t position_;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
126
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
127 public:
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
128 AsynchronousMove(ServerContext& context,
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
129 const std::string& targetAet,
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
130 const std::string& publicId,
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
131 const std::string& originatorAet,
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
132 uint16_t originatorId) :
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
133 context_(context),
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
134 job_(new DicomModalityStoreJob(context)),
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
135 position_(0)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
136 {
2964
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
137 LOG(INFO) << "Sending resource " << publicId << " to modality \""
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
138 << targetAet << "\" in asynchronous mode";
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
139
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
140 job_->SetDescription("C-MOVE");
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
141 job_->SetPermissive(true);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
142 job_->SetLocalAet(context.GetDefaultLocalApplicationEntityTitle());
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
143
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
144 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
145 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
146 job_->SetRemoteModality(lock.GetConfiguration().GetModalityUsingAet(targetAet));
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
147 }
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
148
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
149 if (originatorId != 0)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
150 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
151 job_->SetMoveOriginator(originatorAet, originatorId);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
152 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
153
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
154 std::list<std::string> tmp;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
155 context_.GetIndex().GetChildInstances(tmp, publicId);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
156
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
157 job_->Reserve(tmp.size());
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
158
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
159 for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); ++it)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
160 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
161 job_->AddInstance(*it);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
162 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
163 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
164
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
165 virtual unsigned int GetSubOperationCount() const
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
166 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
167 return 1;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
168 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
169
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
170 virtual Status DoNext()
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
171 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
172 if (position_ == 0)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
173 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
174 context_.GetJobsEngine().GetRegistry().Submit(job_.release(), 0 /* priority */);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
175 return Status_Success;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
176 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
177 else
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
178 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
179 return Status_Failure;
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
180 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
181 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
182 };
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
1162
1ea4094d077c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
186 bool OrthancMoveRequestHandler::LookupIdentifier(std::string& publicId,
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
187 ResourceType level,
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
188 const DicomMap& input)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 {
1724
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
190 DicomTag tag(0, 0); // Dummy initialization
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
191
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
192 switch (level)
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
193 {
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
194 case ResourceType_Patient:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
195 tag = DICOM_TAG_PATIENT_ID;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
196 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
197
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
198 case ResourceType_Study:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
199 tag = (input.HasTag(DICOM_TAG_ACCESSION_NUMBER) ?
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
200 DICOM_TAG_ACCESSION_NUMBER : DICOM_TAG_STUDY_INSTANCE_UID);
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
201 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
202
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
203 case ResourceType_Series:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
204 tag = DICOM_TAG_SERIES_INSTANCE_UID;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
205 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
206
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
207 case ResourceType_Instance:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
208 tag = DICOM_TAG_SOP_INSTANCE_UID;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
209 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
210
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
211 default:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
212 throw OrthancException(ErrorCode_ParameterOutOfRange);
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
213 }
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
214
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 if (!input.HasTag(tag))
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
220 const DicomValue& value = input.GetValue(tag);
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
221 if (value.IsNull() ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
222 value.IsBinary())
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
223 {
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
224 return false;
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
225 }
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
226
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
227 const std::string& content = value.GetContent();
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 std::list<std::string> ids;
1744
b3de74dec2d5 integration mainline->db-changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728 1737
diff changeset
230 context_.GetIndex().LookupIdentifierExact(ids, level, tag, content);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 if (ids.size() != 1)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 else
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 publicId = ids.front();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 return true;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
244 static IMoveRequestIterator* CreateIterator(ServerContext& context,
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
245 const std::string& targetAet,
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
246 const std::string& publicId,
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
247 const std::string& originatorAet,
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
248 uint16_t originatorId)
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
249 {
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
250 bool synchronous;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
251
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
252 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
253 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
254 synchronous = lock.GetConfiguration().GetBooleanParameter("SynchronousCMove", true);
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
255 }
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
256
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
257 if (synchronous)
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
258 {
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
259 return new SynchronousMove(context, targetAet, publicId, originatorAet, originatorId);
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
260 }
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
261 else
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
262 {
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
263 return new AsynchronousMove(context, targetAet, publicId, originatorAet, originatorId);
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
264 }
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
265 }
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
266
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
267
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
268 IMoveRequestIterator* OrthancMoveRequestHandler::Handle(const std::string& targetAet,
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
269 const DicomMap& input,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
270 const std::string& originatorIp,
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
271 const std::string& originatorAet,
1909
21fcfc428dc2 another semantics for Originator Message ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1907
diff changeset
272 const std::string& calledAet,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2124
diff changeset
273 uint16_t originatorId)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 {
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
275 LOG(WARNING) << "Move-SCU request received for AET \"" << targetAet << "\"";
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
277 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
278 DicomArray query(input);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
279 for (size_t i = 0; i < query.GetSize(); i++)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
280 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
281 if (!query.GetElement(i).GetValue().IsNull())
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
282 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
283 LOG(INFO) << " " << query.GetElement(i).GetTag()
2115
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
284 << " " << FromDcmtkBridge::GetTagName(query.GetElement(i))
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
285 << " = " << query.GetElement(i).GetValue().GetContent();
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
286 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
287 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
288 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
289
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 * Retrieve the query level.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 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
295
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
296 if (levelTmp == NULL ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
297 levelTmp->IsNull() ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
298 levelTmp->IsBinary())
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 {
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
300 // 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
301 // 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
302 // 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
303 // 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
304 // 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
305
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
306 std::string publicId;
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
307
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
308 if (LookupIdentifier(publicId, ResourceType_Instance, input) ||
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
309 LookupIdentifier(publicId, ResourceType_Series, input) ||
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
310 LookupIdentifier(publicId, ResourceType_Study, input) ||
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
311 LookupIdentifier(publicId, ResourceType_Patient, input))
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
312 {
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
313 return CreateIterator(context_, targetAet, publicId, originatorAet, originatorId);
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
314 }
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
315 else
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
316 {
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
317 // 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
318 throw OrthancException(ErrorCode_BadRequest);
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
319 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
322 assert(levelTmp != NULL);
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
323 ResourceType level = StringToResourceType(levelTmp->GetContent().c_str());
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
324
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 * Lookup for the resource to be sent.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 std::string publicId;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
332 if (LookupIdentifier(publicId, level, input))
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 {
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
334 return CreateIterator(context_, targetAet, publicId, originatorAet, originatorId);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 }
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
336 else
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 throw OrthancException(ErrorCode_BadRequest);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 }