annotate OrthancServer/Sources/OrthancMoveRequestHandler.cpp @ 4643:bd0ba9ff0efa

todo
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Apr 2021 12:31:18 +0200
parents c1f36fd13730
children f0038043fb97 753f87dac208
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
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4376
diff changeset
5 * Copyright (C) 2017-2021 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
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
37 #include "../../OrthancFramework/Sources/DicomFormat/DicomArray.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
38 #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
39 #include "../../OrthancFramework/Sources/Logging.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
40 #include "../../OrthancFramework/Sources/MetricsRegistry.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
41
3095
beeeb6096f27 removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
42 #include "OrthancConfiguration.h"
beeeb6096f27 removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
43 #include "ServerContext.h"
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
44 #include "ServerJobs/DicomModalityStoreJob.h"
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
3097
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3095
diff changeset
46
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 namespace Orthanc
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 namespace
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 // Anonymous namespace to avoid clashes between compilation modules
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
53 class SynchronousMove : public IMoveRequestIterator
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 private:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 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
57 const std::string& localAet_;
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 std::vector<std::string> instances_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 size_t position_;
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
60 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
61 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
62 uint16_t originatorId_;
3863
9973d10bc5c4 switch to DicomStoreUserConnection in Lua routing, C-MOVE handler and straight C-STORE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3734
diff changeset
63 std::unique_ptr<DicomStoreUserConnection> connection_;
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
64
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 public:
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
66 SynchronousMove(ServerContext& context,
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
67 const std::string& targetAet,
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
68 const std::vector<std::string>& publicIds,
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
69 const std::string& originatorAet,
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
70 uint16_t originatorId) :
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 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
72 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
73 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
74 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
75 originatorId_(originatorId)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
77 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
78 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
79 remote_ = lock.GetConfiguration().GetModalityUsingAet(targetAet);
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
80 }
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
81
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
82 for (size_t i = 0; i < publicIds.size(); i++)
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
83 {
4287
5a3374b6e707 using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4174
diff changeset
84 CLOG(INFO, DICOM) << "Sending resource " << publicIds[i] << " to modality \""
5a3374b6e707 using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4174
diff changeset
85 << targetAet << "\" in synchronous mode";
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
86
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
87 std::list<std::string> tmp;
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
88 context_.GetIndex().GetChildInstances(tmp, publicIds[i]);
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
89
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
90 instances_.reserve(tmp.size());
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
91 for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); ++it)
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
92 {
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
93 instances_.push_back(*it);
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
94 }
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
95 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 virtual unsigned int GetSubOperationCount() const
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 instances_.size();
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 virtual Status DoNext()
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 if (position_ >= instances_.size())
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 return Status_Failure;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 const std::string& id = instances_[position_++];
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 std::string dicom;
2124
2b1520efa282 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2115
diff changeset
113 context_.ReadDicom(dicom, id);
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
114
2590
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
115 if (connection_.get() == NULL)
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
116 {
3874
2effa961f67f forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3863
diff changeset
117 DicomAssociationParameters params(localAet_, remote_);
2effa961f67f forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3863
diff changeset
118 connection_.reset(new DicomStoreUserConnection(params));
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
119 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
3734
4fc24b69446a triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3712
diff changeset
121 std::string sopClassUid, sopInstanceUid; // Unused
4174
067c679626a2 Fix transcoding in C-MOVE SCP, in the case where "SynchronousCMove" is "true"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4165
diff changeset
122 context_.StoreWithTranscoding(sopClassUid, sopInstanceUid, *connection_, dicom,
067c679626a2 Fix transcoding in C-MOVE SCP, in the case where "SynchronousCMove" is "true"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4165
diff changeset
123 true, originatorAet_, originatorId_);
2590
5e2730c8e23c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
124
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 return Status_Success;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 };
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
128
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
129
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
130 class AsynchronousMove : public IMoveRequestIterator
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
131 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
132 private:
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3700
diff changeset
133 ServerContext& context_;
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3700
diff changeset
134 std::unique_ptr<DicomModalityStoreJob> job_;
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3700
diff changeset
135 size_t position_;
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3700
diff changeset
136 size_t countInstances_;
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
137
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
138 public:
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
139 AsynchronousMove(ServerContext& context,
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
140 const std::string& targetAet,
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
141 const std::vector<std::string>& publicIds,
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
142 const std::string& originatorAet,
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
143 uint16_t originatorId) :
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
144 context_(context),
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
145 job_(new DicomModalityStoreJob(context)),
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
146 position_(0)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
147 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
148 job_->SetDescription("C-MOVE");
3700
5cbbf14e516b Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3697
diff changeset
149 //job_->SetPermissive(true); // This was the behavior of Orthanc < 1.6.0
5cbbf14e516b Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3697
diff changeset
150 job_->SetPermissive(false);
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
151 job_->SetLocalAet(context.GetDefaultLocalApplicationEntityTitle());
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
152
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
153 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
154 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
155 job_->SetRemoteModality(lock.GetConfiguration().GetModalityUsingAet(targetAet));
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
156 }
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
157
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
158 if (originatorId != 0)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
159 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
160 job_->SetMoveOriginator(originatorAet, originatorId);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
161 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
162
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
163 for (size_t i = 0; i < publicIds.size(); i++)
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
164 {
4287
5a3374b6e707 using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4174
diff changeset
165 CLOG(INFO, DICOM) << "Sending resource " << publicIds[i] << " to modality \""
5a3374b6e707 using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4174
diff changeset
166 << targetAet << "\" in asynchronous mode";
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
167
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
168 std::list<std::string> tmp;
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
169 context_.GetIndex().GetChildInstances(tmp, publicIds[i]);
3157
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
170
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
171 countInstances_ = tmp.size();
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
172
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
173 job_->Reserve(job_->GetCommandsCount() + tmp.size());
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
174
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
175 for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); ++it)
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
176 {
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
177 job_->AddInstance(*it);
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
178 }
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
179 }
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 virtual unsigned int GetSubOperationCount() const
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
183 {
3157
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
184 return countInstances_;
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
185 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
186
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
187 virtual Status DoNext()
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
188 {
3157
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
189 if (position_ >= countInstances_)
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
190 {
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
191 return Status_Failure;
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
192 }
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
193
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
194 if (position_ == 0)
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
195 {
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
196 context_.GetJobsEngine().GetRegistry().Submit(job_.release(), 0 /* priority */);
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
197 }
3157
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
198
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
199 position_ ++;
8a9eb767280c Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
200 return Status_Success;
2624
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
201 }
714dcddeb65f asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2590
diff changeset
202 };
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
4165
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
206 static bool IsNonEmptyTag(const DicomMap& dicom,
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
207 const DicomTag& tag)
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
208 {
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
209 const DicomValue* value = dicom.TestAndGetValue(tag);
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
210 if (value == NULL ||
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
211 value->IsNull() ||
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
212 value->IsBinary())
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
213 {
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
214 return false;
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
215 }
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
216 else
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
217 {
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
218 return !value->GetContent().empty();
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
219 }
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
220 }
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
221
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
222
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
223 bool OrthancMoveRequestHandler::LookupIdentifiers(std::vector<std::string>& publicIds,
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
224 ResourceType level,
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
225 const DicomMap& input)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 {
1724
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
227 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
228
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
229 switch (level)
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
230 {
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
231 case ResourceType_Patient:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
232 tag = DICOM_TAG_PATIENT_ID;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
233 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
234
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
235 case ResourceType_Study:
4165
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
236 // The test below using "IsNonEmptyTag()" fixes compatibility
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
237 // with Ambra C-FIND SCU:
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
238 // https://groups.google.com/g/orthanc-users/c/yIUnZ9v9-Zs/m/GQPXiAOiCQAJ
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
239 if (IsNonEmptyTag(input, DICOM_TAG_ACCESSION_NUMBER))
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
240 {
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
241 tag = DICOM_TAG_ACCESSION_NUMBER;
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
242 }
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
243 else
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
244 {
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
245 tag = DICOM_TAG_STUDY_INSTANCE_UID;
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
246 }
1724
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
247 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
248
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
249 case ResourceType_Series:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
250 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
251 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
252
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
253 case ResourceType_Instance:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
254 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
255 break;
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
256
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
257 default:
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
258 throw OrthancException(ErrorCode_ParameterOutOfRange);
7e0b5e413c7c C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
259 }
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
260
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 if (!input.HasTag(tag))
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
266 const DicomValue& value = input.GetValue(tag);
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
267 if (value.IsNull() ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
268 value.IsBinary())
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
269 {
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
270 return false;
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
271 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 else
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 {
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
274 const std::string& content = value.GetContent();
3697
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
275
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
276 /**
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
277 * This tokenization fixes issue 154 ("Matching against list of
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
278 * UID-s by C-MOVE").
4476
c1f36fd13730 migrate remaining links to issues in bitbucket to mercurial server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
279 * https://bugs.orthanc-server.com/show_bug.cgi?id=154
3697
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
280 **/
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
281
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
282 std::vector<std::string> tokens;
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
283 Toolbox::TokenizeString(tokens, content, '\\');
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
284 for (size_t i = 0; i < tokens.size(); i++)
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
285 {
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
286 std::vector<std::string> matches;
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
287 context_.GetIndex().LookupIdentifierExact(matches, level, tag, tokens[i]);
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
288
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
289 // Concatenate "publicIds" with "matches"
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
290 publicIds.insert(publicIds.end(), matches.begin(), matches.end());
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
291 }
5331918773e7 Fix issue #154 (Matching against list of UID-s by C-MOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
292
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 return true;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
298 static IMoveRequestIterator* CreateIterator(ServerContext& context,
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
299 const std::string& targetAet,
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
300 const std::vector<std::string>& publicIds,
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
301 const std::string& originatorAet,
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
302 uint16_t originatorId)
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
303 {
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
304 if (publicIds.empty())
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
305 {
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
306 throw OrthancException(ErrorCode_BadRequest,
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
307 "C-MOVE request matching no resource stored in Orthanc");
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
308 }
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
309
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
310 bool synchronous;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
311
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
312 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
313 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
314 synchronous = lock.GetConfiguration().GetBooleanParameter("SynchronousCMove", true);
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2932
diff changeset
315 }
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
316
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
317 if (synchronous)
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
318 {
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
319 return new SynchronousMove(context, targetAet, publicIds, originatorAet, originatorId);
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
320 }
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
321 else
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
322 {
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
323 return new AsynchronousMove(context, targetAet, publicIds, originatorAet, originatorId);
2625
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
324 }
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
325 }
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
326
5469dda691cd new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2624
diff changeset
327
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
328 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
329 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
330 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
331 const std::string& originatorAet,
1909
21fcfc428dc2 another semantics for Originator Message ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1907
diff changeset
332 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
333 uint16_t originatorId)
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 {
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3157
diff changeset
335 MetricsRegistry::Timer timer(context_.GetMetricsRegistry(), "orthanc_move_scp_duration_ms");
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3157
diff changeset
336
4287
5a3374b6e707 using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4174
diff changeset
337 CLOG(WARNING, DICOM) << "Move-SCU request received for AET \"" << targetAet << "\"";
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
339 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
340 DicomArray query(input);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
341 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
342 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
343 if (!query.GetElement(i).GetValue().IsNull())
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
344 {
4313
91554aecff9a removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4287
diff changeset
345 CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format()
91554aecff9a removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4287
diff changeset
346 << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i))
4376
b002f9abe802 review of changeset 4375:208029732d51
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4375
diff changeset
347 << " = " << context_.GetDeidentifiedContent(query.GetElement(i));
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
348 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
349 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
350 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
351
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 * Retrieve the query level.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 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
357
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
358 if (levelTmp == NULL ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
359 levelTmp->IsNull() ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
360 levelTmp->IsBinary())
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 {
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
362 // 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
363 // 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
364 // 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
365 // 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
366 // 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
367
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
368 std::vector<std::string> publicIds;
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
369
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
370 if (LookupIdentifiers(publicIds, ResourceType_Instance, input) ||
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
371 LookupIdentifiers(publicIds, ResourceType_Series, input) ||
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
372 LookupIdentifiers(publicIds, ResourceType_Study, input) ||
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
373 LookupIdentifiers(publicIds, ResourceType_Patient, input))
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
374 {
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
375 return CreateIterator(context_, targetAet, publicIds, originatorAet, originatorId);
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
376 }
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
377 else
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
378 {
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
379 // No identifier is present in the request.
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
380 throw OrthancException(ErrorCode_BadRequest, "Invalid fields in a C-MOVE request");
1231
703fcd797186 Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
381 }
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
384 assert(levelTmp != NULL);
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1724
diff changeset
385 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
386
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 * Lookup for the resource to be sent.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
392 std::vector<std::string> publicIds;
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
394 if (LookupIdentifiers(publicIds, level, input))
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 {
3301
6ce10c3b1eb7 Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
396 return CreateIterator(context_, targetAet, publicIds, originatorAet, originatorId);
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 }
1721
3bcb01028107 removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
398 else
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 {
4165
e34c89e89aac Fix compatibility with C-MOVE SCU requests issued by Ambra
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
400 throw OrthancException(ErrorCode_BadRequest, "No DICOM identifier provided in the C-MOVE request for this query retrieve level");
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 }