Mercurial > hg > orthanc
annotate OrthancServer/OrthancMoveRequestHandler.cpp @ 3606:33ba63637d48 storage-commitment
DicomUserConnection: sending N-EVENT-REPORT-RQ
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 16 Jan 2020 19:24:52 +0100 |
parents | 6ce10c3b1eb7 |
children | 94f4a18a79cc |
rev | line source |
---|---|
619 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 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 |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2964
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
619 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
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 | 35 #include "OrthancMoveRequestHandler.h" |
36 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
37 #include "../../Core/DicomParsing/FromDcmtkBridge.h" |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
38 #include "../Core/DicomFormat/DicomArray.h" |
1486
f967bdf8534e
refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
39 #include "../Core/Logging.h" |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3157
diff
changeset
|
40 #include "../Core/MetricsRegistry.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
41 #include "OrthancConfiguration.h" |
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
42 #include "ServerContext.h" |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
43 #include "ServerJobs/DicomModalityStoreJob.h" |
619 | 44 |
3097 | 45 |
619 | 46 namespace Orthanc |
47 { | |
48 namespace | |
49 { | |
50 // Anonymous namespace to avoid clashes between compilation modules | |
51 | |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
52 class SynchronousMove : public IMoveRequestIterator |
619 | 53 { |
54 private: | |
55 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
|
56 const std::string& localAet_; |
619 | 57 std::vector<std::string> instances_; |
58 size_t position_; | |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
59 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
|
60 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
|
61 uint16_t originatorId_; |
2590
5e2730c8e23c
getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
62 std::auto_ptr<DicomUserConnection> connection_; |
771 | 63 |
619 | 64 public: |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
65 SynchronousMove(ServerContext& context, |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
66 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
|
67 const std::vector<std::string>& publicIds, |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
68 const std::string& originatorAet, |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
69 uint16_t originatorId) : |
619 | 70 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
|
71 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
|
72 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
|
73 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
|
74 originatorId_(originatorId) |
619 | 75 { |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
76 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
77 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
78 remote_ = lock.GetConfiguration().GetModalityUsingAet(targetAet); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
79 } |
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
|
80 |
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 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
|
82 { |
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 LOG(INFO) << "Sending resource " << publicIds[i] << " to modality \"" |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
84 << targetAet << "\" in synchronous mode"; |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
85 |
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 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
|
87 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
|
88 |
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 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
|
90 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
|
91 { |
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 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
|
93 } |
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 } |
619 | 95 } |
96 | |
97 virtual unsigned int GetSubOperationCount() const | |
98 { | |
99 return instances_.size(); | |
100 } | |
101 | |
102 virtual Status DoNext() | |
103 { | |
104 if (position_ >= instances_.size()) | |
105 { | |
106 return Status_Failure; | |
107 } | |
108 | |
109 const std::string& id = instances_[position_++]; | |
110 | |
111 std::string dicom; | |
2124 | 112 context_.ReadDicom(dicom, id); |
771 | 113 |
2590
5e2730c8e23c
getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
114 if (connection_.get() == NULL) |
771 | 115 { |
2590
5e2730c8e23c
getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
116 connection_.reset(new DicomUserConnection(localAet_, remote_)); |
771 | 117 } |
619 | 118 |
2590
5e2730c8e23c
getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
119 connection_->Store(dicom, originatorAet_, originatorId_); |
5e2730c8e23c
getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
120 |
619 | 121 return Status_Success; |
122 } | |
123 }; | |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
124 |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
125 |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
126 class AsynchronousMove : public IMoveRequestIterator |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
127 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
128 private: |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
129 ServerContext& context_; |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
130 std::auto_ptr<DicomModalityStoreJob> job_; |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
131 size_t position_; |
3157
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
132 size_t countInstances_; |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
133 |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
134 public: |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
135 AsynchronousMove(ServerContext& context, |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
136 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
|
137 const std::vector<std::string>& publicIds, |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
138 const std::string& originatorAet, |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
139 uint16_t originatorId) : |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
140 context_(context), |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
141 job_(new DicomModalityStoreJob(context)), |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
142 position_(0) |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
143 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
144 job_->SetDescription("C-MOVE"); |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
145 job_->SetPermissive(true); |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
146 job_->SetLocalAet(context.GetDefaultLocalApplicationEntityTitle()); |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
147 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
148 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
149 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
150 job_->SetRemoteModality(lock.GetConfiguration().GetModalityUsingAet(targetAet)); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
151 } |
2624
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 if (originatorId != 0) |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
154 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
155 job_->SetMoveOriginator(originatorAet, originatorId); |
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 |
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
|
158 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
|
159 { |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
160 LOG(INFO) << "Sending resource " << publicIds[i] << " to modality \"" |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
161 << targetAet << "\" in asynchronous mode"; |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
162 |
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 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
|
164 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
|
165 |
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
|
166 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
|
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 job_->Reserve(job_->GetCommandsCount() + tmp.size()); |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
169 |
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
|
170 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
|
171 { |
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 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
|
173 } |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
174 } |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
175 } |
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 virtual unsigned int GetSubOperationCount() const |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
178 { |
3157
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
179 return countInstances_; |
2624
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 Status DoNext() |
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 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
|
185 { |
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
186 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
|
187 } |
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
188 |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
189 if (position_ == 0) |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
190 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
191 context_.GetJobsEngine().GetRegistry().Submit(job_.release(), 0 /* priority */); |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
192 } |
3157
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
193 |
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
194 position_ ++; |
8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
195 return Status_Success; |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
196 } |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2590
diff
changeset
|
197 }; |
619 | 198 } |
199 | |
200 | |
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
|
201 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
|
202 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
|
203 const DicomMap& input) |
619 | 204 { |
1724
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
205 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
|
206 |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
207 switch (level) |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
208 { |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
209 case ResourceType_Patient: |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
210 tag = DICOM_TAG_PATIENT_ID; |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
211 break; |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
212 |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
213 case ResourceType_Study: |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
214 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
|
215 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
|
216 break; |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
217 |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
218 case ResourceType_Series: |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
219 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
|
220 break; |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
221 |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
222 case ResourceType_Instance: |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
223 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
|
224 break; |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
225 |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
226 default: |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
227 throw OrthancException(ErrorCode_ParameterOutOfRange); |
7e0b5e413c7c
C-Move SCP for studies using AccessionNumber tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
228 } |
1721
3bcb01028107
removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
229 |
619 | 230 if (!input.HasTag(tag)) |
231 { | |
232 return false; | |
233 } | |
234 | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
235 const DicomValue& value = input.GetValue(tag); |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
236 if (value.IsNull() || |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
237 value.IsBinary()) |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
238 { |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
239 return false; |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
240 } |
619 | 241 else |
242 { | |
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
|
243 const std::string& content = value.GetContent(); |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
244 context_.GetIndex().LookupIdentifierExact(publicIds, level, tag, content); |
619 | 245 return true; |
246 } | |
247 } | |
248 | |
249 | |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
250 static IMoveRequestIterator* CreateIterator(ServerContext& context, |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
251 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
|
252 const std::vector<std::string>& publicIds, |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
253 const std::string& originatorAet, |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
254 uint16_t originatorId) |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
255 { |
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
|
256 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
|
257 { |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
258 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
|
259 "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
|
260 } |
6ce10c3b1eb7
Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
261 |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
262 bool synchronous; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
263 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
264 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
265 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
266 synchronous = lock.GetConfiguration().GetBooleanParameter("SynchronousCMove", true); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2932
diff
changeset
|
267 } |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
268 |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
269 if (synchronous) |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
270 { |
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
|
271 return new SynchronousMove(context, targetAet, publicIds, originatorAet, originatorId); |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
272 } |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
273 else |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
274 { |
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
|
275 return new AsynchronousMove(context, targetAet, publicIds, originatorAet, originatorId); |
2625
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
276 } |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
277 } |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
278 |
5469dda691cd
new configuration option: SynchronousCMove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
279 |
1573
3309878b3e16
more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
280 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
|
281 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
|
282 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
|
283 const std::string& originatorAet, |
1909
21fcfc428dc2
another semantics for Originator Message ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1907
diff
changeset
|
284 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
|
285 uint16_t originatorId) |
619 | 286 { |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3157
diff
changeset
|
287 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
|
288 |
1573
3309878b3e16
more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
289 LOG(WARNING) << "Move-SCU request received for AET \"" << targetAet << "\""; |
619 | 290 |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
291 { |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
292 DicomArray query(input); |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
293 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
|
294 { |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
295 if (!query.GetElement(i).GetValue().IsNull()) |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
296 { |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
297 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
|
298 << " " << FromDcmtkBridge::GetTagName(query.GetElement(i)) |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
299 << " = " << query.GetElement(i).GetValue().GetContent(); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
300 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
301 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
302 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
303 |
619 | 304 /** |
305 * Retrieve the query level. | |
306 **/ | |
307 | |
308 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
|
309 |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
310 if (levelTmp == NULL || |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
311 levelTmp->IsNull() || |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
312 levelTmp->IsBinary()) |
619 | 313 { |
1231
703fcd797186
Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
314 // 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
|
315 // 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
|
316 // 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
|
317 // 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
|
318 // 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
|
319 |
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
|
320 std::vector<std::string> publicIds; |
1231
703fcd797186
Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
321 |
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
|
322 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
|
323 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
|
324 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
|
325 LookupIdentifiers(publicIds, ResourceType_Patient, input)) |
1231
703fcd797186
Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
326 { |
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
|
327 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
|
328 } |
703fcd797186
Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
329 else |
703fcd797186
Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
330 { |
703fcd797186
Support of Tudor DICOM in Query/Retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
331 // 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
|
332 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
|
333 } |
619 | 334 } |
335 | |
1721
3bcb01028107
removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
336 assert(levelTmp != NULL); |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1724
diff
changeset
|
337 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
|
338 |
619 | 339 |
340 /** | |
341 * Lookup for the resource to be sent. | |
342 **/ | |
343 | |
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
|
344 std::vector<std::string> publicIds; |
619 | 345 |
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
|
346 if (LookupIdentifiers(publicIds, level, input)) |
619 | 347 { |
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
|
348 return CreateIterator(context_, targetAet, publicIds, originatorAet, originatorId); |
619 | 349 } |
1721
3bcb01028107
removed another flavor of ServerIndex::LookupIdentifier
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
350 else |
619 | 351 { |
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
|
352 throw OrthancException(ErrorCode_BadRequest, "Invalid fields in a C-MOVE request"); |
619 | 353 } |
354 } | |
355 } |