Mercurial > hg > orthanc
annotate OrthancServer/ServerJobs/DicomModalityStoreJob.cpp @ 3844:c9c34bb50f0a
fix paths
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 16 Apr 2020 17:27:18 +0200 |
parents | 138d0dde41b5 |
children | 594263db316a |
rev | line source |
---|---|
2603 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
2603 | 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 | |
33 | |
34 #include "../PrecompiledHeadersServer.h" | |
35 #include "DicomModalityStoreJob.h" | |
36 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
37 #include "../../Core/Compatibility.h" |
2603 | 38 #include "../../Core/Logging.h" |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
39 #include "../../Core/SerializationToolbox.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
40 #include "../ServerContext.h" |
3737
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
41 #include "../StorageCommitmentReports.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
42 |
2603 | 43 |
44 namespace Orthanc | |
45 { | |
46 void DicomModalityStoreJob::OpenConnection() | |
47 { | |
48 if (connection_.get() == NULL) | |
49 { | |
3843
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3737
diff
changeset
|
50 connection_.reset(new DicomUserConnection(localAet_, remote_)); |
2603 | 51 } |
52 } | |
53 | |
54 | |
55 bool DicomModalityStoreJob::HandleInstance(const std::string& instance) | |
56 { | |
2640
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
57 assert(IsStarted()); |
2603 | 58 OpenConnection(); |
59 | |
60 LOG(INFO) << "Sending instance " << instance << " to modality \"" | |
61 << remote_.GetApplicationEntityTitle() << "\""; | |
62 | |
63 std::string dicom; | |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
64 |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
65 try |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
66 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
67 context_.ReadDicom(dicom, instance); |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
68 } |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
69 catch (OrthancException& e) |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
70 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
71 LOG(WARNING) << "An instance was removed after the job was issued: " << instance; |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
72 return false; |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
73 } |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
74 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
75 std::string sopClassUid, sopInstanceUid; |
2603 | 76 |
77 if (HasMoveOriginator()) | |
78 { | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
79 connection_->Store(sopClassUid, sopInstanceUid, dicom, moveOriginatorAet_, moveOriginatorId_); |
2603 | 80 } |
81 else | |
82 { | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
83 connection_->Store(sopClassUid, sopInstanceUid, dicom); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
84 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
85 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
86 if (storageCommitment_) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
87 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
88 sopClassUids_.push_back(sopClassUid); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
89 sopInstanceUids_.push_back(sopInstanceUid); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
90 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
91 if (sopClassUids_.size() != sopInstanceUids_.size() || |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
92 sopClassUids_.size() > GetInstancesCount()) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
93 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
94 throw OrthancException(ErrorCode_InternalError); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
95 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
96 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
97 if (sopClassUids_.size() == GetInstancesCount()) |
3737
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
98 { |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
99 const std::string& remoteAet = remote_.GetApplicationEntityTitle(); |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
100 |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
101 LOG(INFO) << "Sending storage commitment request to modality: " << remoteAet; |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
102 |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
103 // Create a "pending" storage commitment report BEFORE the |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
104 // actual SCU call in order to avoid race conditions |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
105 context_.GetStorageCommitmentReports().Store( |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
106 transactionUid_, new StorageCommitmentReports::Report(remoteAet)); |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
107 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
108 assert(IsStarted()); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
109 OpenConnection(); |
3735 | 110 |
111 std::vector<std::string> a(sopClassUids_.begin(), sopClassUids_.end()); | |
112 std::vector<std::string> b(sopInstanceUids_.begin(), sopInstanceUids_.end()); | |
113 connection_->RequestStorageCommitment(transactionUid_, a, b); | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
114 } |
2603 | 115 } |
116 | |
117 //boost::this_thread::sleep(boost::posix_time::milliseconds(500)); | |
118 | |
119 return true; | |
120 } | |
121 | |
122 | |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
123 bool DicomModalityStoreJob::HandleTrailingStep() |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
124 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
125 throw OrthancException(ErrorCode_InternalError); |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
126 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
127 |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
128 |
2603 | 129 DicomModalityStoreJob::DicomModalityStoreJob(ServerContext& context) : |
130 context_(context), | |
131 localAet_("ORTHANC"), | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
132 moveOriginatorId_(0), // By default, not a C-MOVE |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
133 storageCommitment_(false) // By default, no storage commitment |
2603 | 134 { |
3735 | 135 ResetStorageCommitment(); |
2603 | 136 } |
137 | |
138 | |
139 void DicomModalityStoreJob::SetLocalAet(const std::string& aet) | |
140 { | |
141 if (IsStarted()) | |
142 { | |
143 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
144 } | |
145 else | |
146 { | |
147 localAet_ = aet; | |
148 } | |
149 } | |
150 | |
151 | |
152 void DicomModalityStoreJob::SetRemoteModality(const RemoteModalityParameters& remote) | |
153 { | |
154 if (IsStarted()) | |
155 { | |
156 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
157 } | |
158 else | |
159 { | |
160 remote_ = remote; | |
161 } | |
162 } | |
163 | |
164 | |
165 const std::string& DicomModalityStoreJob::GetMoveOriginatorAet() const | |
166 { | |
167 if (HasMoveOriginator()) | |
168 { | |
169 return moveOriginatorAet_; | |
170 } | |
171 else | |
172 { | |
173 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
174 } | |
175 } | |
176 | |
177 | |
178 uint16_t DicomModalityStoreJob::GetMoveOriginatorId() const | |
179 { | |
180 if (HasMoveOriginator()) | |
181 { | |
182 return moveOriginatorId_; | |
183 } | |
184 else | |
185 { | |
186 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
187 } | |
188 } | |
189 | |
190 | |
191 void DicomModalityStoreJob::SetMoveOriginator(const std::string& aet, | |
192 int id) | |
193 { | |
194 if (IsStarted()) | |
195 { | |
196 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
197 } | |
198 else if (id < 0 || | |
199 id >= 65536) | |
200 { | |
201 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
202 } | |
203 else | |
204 { | |
205 moveOriginatorId_ = static_cast<uint16_t>(id); | |
206 moveOriginatorAet_ = aet; | |
207 } | |
208 } | |
209 | |
2812
ea7aea6f6a95
improved naming of methods in IJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2811
diff
changeset
|
210 void DicomModalityStoreJob::Stop(JobStopReason reason) // For pausing jobs |
2603 | 211 { |
212 connection_.reset(NULL); | |
213 } | |
214 | |
215 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
216 void DicomModalityStoreJob::ResetStorageCommitment() |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
217 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
218 if (storageCommitment_) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
219 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
220 transactionUid_ = Toolbox::GenerateDicomPrivateUniqueIdentifier(); |
3735 | 221 sopClassUids_.clear(); |
222 sopInstanceUids_.clear(); | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
223 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
224 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
225 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
226 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
227 void DicomModalityStoreJob::Reset() |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
228 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
229 SetOfInstancesJob::Reset(); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
230 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
231 /** |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
232 * "After the N-EVENT-REPORT has been sent, the Transaction UID is |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
233 * no longer active and shall not be reused for other |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
234 * transactions." => Need to reset the transaction UID here |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
235 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
236 **/ |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
237 ResetStorageCommitment(); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
238 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
239 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
240 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
241 void DicomModalityStoreJob::EnableStorageCommitment(bool enabled) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
242 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
243 storageCommitment_ = enabled; |
3735 | 244 ResetStorageCommitment(); |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
245 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
246 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
247 |
2603 | 248 void DicomModalityStoreJob::GetPublicContent(Json::Value& value) |
249 { | |
2640
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
250 SetOfInstancesJob::GetPublicContent(value); |
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
251 |
2603 | 252 value["LocalAet"] = localAet_; |
253 value["RemoteAet"] = remote_.GetApplicationEntityTitle(); | |
254 | |
255 if (HasMoveOriginator()) | |
256 { | |
257 value["MoveOriginatorAET"] = GetMoveOriginatorAet(); | |
258 value["MoveOriginatorID"] = GetMoveOriginatorId(); | |
259 } | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
260 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
261 if (storageCommitment_) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
262 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
263 value["StorageCommitmentTransactionUID"] = transactionUid_; |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
264 } |
2603 | 265 } |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
266 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
267 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
268 static const char* LOCAL_AET = "LocalAet"; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
269 static const char* REMOTE = "Remote"; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
270 static const char* MOVE_ORIGINATOR_AET = "MoveOriginatorAet"; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
271 static const char* MOVE_ORIGINATOR_ID = "MoveOriginatorId"; |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
272 static const char* STORAGE_COMMITMENT = "StorageCommitment"; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
273 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
274 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
275 DicomModalityStoreJob::DicomModalityStoreJob(ServerContext& context, |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
276 const Json::Value& serialized) : |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
277 SetOfInstancesJob(serialized), |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
278 context_(context) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
279 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
280 localAet_ = SerializationToolbox::ReadString(serialized, LOCAL_AET); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
281 remote_ = RemoteModalityParameters(serialized[REMOTE]); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
282 moveOriginatorAet_ = SerializationToolbox::ReadString(serialized, MOVE_ORIGINATOR_AET); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
283 moveOriginatorId_ = static_cast<uint16_t> |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
284 (SerializationToolbox::ReadUnsignedInteger(serialized, MOVE_ORIGINATOR_ID)); |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
285 EnableStorageCommitment(SerializationToolbox::ReadBoolean(serialized, STORAGE_COMMITMENT)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
286 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
287 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
288 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
289 bool DicomModalityStoreJob::Serialize(Json::Value& target) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
290 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
291 if (!SetOfInstancesJob::Serialize(target)) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
292 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
293 return false; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
294 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
295 else |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
296 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
297 target[LOCAL_AET] = localAet_; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
298 remote_.Serialize(target[REMOTE], true /* force advanced format */); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
299 target[MOVE_ORIGINATOR_AET] = moveOriginatorAet_; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
300 target[MOVE_ORIGINATOR_ID] = moveOriginatorId_; |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
301 target[STORAGE_COMMITMENT] = storageCommitment_; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
302 return true; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
303 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
304 } |
2603 | 305 } |