Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp @ 4741:a6b7c29f5118 openssl-3.x
compiler warning about openssl license
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 Jul 2021 09:52:15 +0200 |
parents | f0038043fb97 |
children | 2e71a08eea15 |
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 | |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
5 * Copyright (C) 2017-2021 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 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "../PrecompiledHeadersServer.h" | |
23 #include "DicomModalityStoreJob.h" | |
24 | |
4045 | 25 #include "../../../OrthancFramework/Sources/Compatibility.h" |
26 #include "../../../OrthancFramework/Sources/DicomNetworking/DicomAssociation.h" | |
27 #include "../../../OrthancFramework/Sources/Logging.h" | |
28 #include "../../../OrthancFramework/Sources/SerializationToolbox.h" | |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
29 #include "../ServerContext.h" |
3737
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
30 #include "../StorageCommitmentReports.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
31 |
2603 | 32 |
33 namespace Orthanc | |
34 { | |
35 void DicomModalityStoreJob::OpenConnection() | |
36 { | |
37 if (connection_.get() == NULL) | |
38 { | |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
39 connection_.reset(new DicomStoreUserConnection(parameters_)); |
2603 | 40 } |
41 } | |
42 | |
43 | |
44 bool DicomModalityStoreJob::HandleInstance(const std::string& instance) | |
45 { | |
2640
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
46 assert(IsStarted()); |
2603 | 47 OpenConnection(); |
48 | |
49 LOG(INFO) << "Sending instance " << instance << " to modality \"" | |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
50 << parameters_.GetRemoteModality().GetApplicationEntityTitle() << "\""; |
2603 | 51 |
52 std::string dicom; | |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
53 |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
54 try |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
55 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
56 context_.ReadDicom(dicom, instance); |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
57 } |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
58 catch (OrthancException& e) |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
59 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
60 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
|
61 return false; |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
62 } |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
63 |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
64 std::string sopClassUid, sopInstanceUid; |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
65 context_.StoreWithTranscoding(sopClassUid, sopInstanceUid, *connection_, dicom, |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
66 HasMoveOriginator(), moveOriginatorAet_, moveOriginatorId_); |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
67 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
68 if (storageCommitment_) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
69 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
70 sopClassUids_.push_back(sopClassUid); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
71 sopInstanceUids_.push_back(sopInstanceUid); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
72 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
73 if (sopClassUids_.size() != sopInstanceUids_.size() || |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
74 sopClassUids_.size() > GetInstancesCount()) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
75 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
76 throw OrthancException(ErrorCode_InternalError); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
77 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
78 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
79 if (sopClassUids_.size() == GetInstancesCount()) |
3737
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
80 { |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3843
diff
changeset
|
81 assert(IsStarted()); |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3843
diff
changeset
|
82 connection_.reset(NULL); |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3843
diff
changeset
|
83 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
84 const std::string& remoteAet = parameters_.GetRemoteModality().GetApplicationEntityTitle(); |
3737
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
85 |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
86 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
|
87 |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
88 // 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
|
89 // 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
|
90 context_.GetStorageCommitmentReports().Store( |
f29843323daf
accessing storage commitment reports from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3735
diff
changeset
|
91 transactionUid_, new StorageCommitmentReports::Report(remoteAet)); |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
92 |
3735 | 93 std::vector<std::string> a(sopClassUids_.begin(), sopClassUids_.end()); |
94 std::vector<std::string> b(sopInstanceUids_.begin(), sopInstanceUids_.end()); | |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3843
diff
changeset
|
95 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
96 DicomAssociation::RequestStorageCommitment(parameters_, transactionUid_, a, b); |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
97 } |
2603 | 98 } |
99 | |
100 //boost::this_thread::sleep(boost::posix_time::milliseconds(500)); | |
101 | |
102 return true; | |
103 } | |
104 | |
105 | |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
106 bool DicomModalityStoreJob::HandleTrailingStep() |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
107 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
108 throw OrthancException(ErrorCode_InternalError); |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
109 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
110 |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
111 |
2603 | 112 DicomModalityStoreJob::DicomModalityStoreJob(ServerContext& context) : |
113 context_(context), | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
114 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
|
115 storageCommitment_(false) // By default, no storage commitment |
2603 | 116 { |
3735 | 117 ResetStorageCommitment(); |
2603 | 118 } |
119 | |
120 | |
121 void DicomModalityStoreJob::SetLocalAet(const std::string& aet) | |
122 { | |
123 if (IsStarted()) | |
124 { | |
125 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
126 } | |
127 else | |
128 { | |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
129 parameters_.SetLocalApplicationEntityTitle(aet); |
2603 | 130 } |
131 } | |
132 | |
133 | |
134 void DicomModalityStoreJob::SetRemoteModality(const RemoteModalityParameters& remote) | |
135 { | |
136 if (IsStarted()) | |
137 { | |
138 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
139 } | |
140 else | |
141 { | |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
142 parameters_.SetRemoteModality(remote); |
2603 | 143 } |
144 } | |
145 | |
146 | |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
147 void DicomModalityStoreJob::SetTimeout(uint32_t seconds) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
148 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
149 if (IsStarted()) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
150 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
151 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
152 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
153 else |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
154 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
155 parameters_.SetTimeout(seconds); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
156 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
157 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
158 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
159 |
2603 | 160 const std::string& DicomModalityStoreJob::GetMoveOriginatorAet() const |
161 { | |
162 if (HasMoveOriginator()) | |
163 { | |
164 return moveOriginatorAet_; | |
165 } | |
166 else | |
167 { | |
168 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
169 } | |
170 } | |
171 | |
172 | |
173 uint16_t DicomModalityStoreJob::GetMoveOriginatorId() const | |
174 { | |
175 if (HasMoveOriginator()) | |
176 { | |
177 return moveOriginatorId_; | |
178 } | |
179 else | |
180 { | |
181 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
182 } | |
183 } | |
184 | |
185 | |
186 void DicomModalityStoreJob::SetMoveOriginator(const std::string& aet, | |
187 int id) | |
188 { | |
189 if (IsStarted()) | |
190 { | |
191 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
192 } | |
193 else if (id < 0 || | |
194 id >= 65536) | |
195 { | |
196 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
197 } | |
198 else | |
199 { | |
200 moveOriginatorId_ = static_cast<uint16_t>(id); | |
201 moveOriginatorAet_ = aet; | |
202 } | |
203 } | |
204 | |
2812
ea7aea6f6a95
improved naming of methods in IJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2811
diff
changeset
|
205 void DicomModalityStoreJob::Stop(JobStopReason reason) // For pausing jobs |
2603 | 206 { |
207 connection_.reset(NULL); | |
208 } | |
209 | |
210 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
211 void DicomModalityStoreJob::ResetStorageCommitment() |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
212 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
213 if (storageCommitment_) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
214 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
215 transactionUid_ = Toolbox::GenerateDicomPrivateUniqueIdentifier(); |
3735 | 216 sopClassUids_.clear(); |
217 sopInstanceUids_.clear(); | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
218 } |
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 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
221 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
222 void DicomModalityStoreJob::Reset() |
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 SetOfInstancesJob::Reset(); |
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 * "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
|
228 * 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
|
229 * 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
|
230 * 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
|
231 **/ |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
232 ResetStorageCommitment(); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
233 } |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
234 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
235 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
236 void DicomModalityStoreJob::EnableStorageCommitment(bool enabled) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
237 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
238 storageCommitment_ = enabled; |
3735 | 239 ResetStorageCommitment(); |
3734
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 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
242 |
2603 | 243 void DicomModalityStoreJob::GetPublicContent(Json::Value& value) |
244 { | |
2640
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
245 SetOfInstancesJob::GetPublicContent(value); |
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
246 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
247 value["LocalAet"] = parameters_.GetLocalApplicationEntityTitle(); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
248 value["RemoteAet"] = parameters_.GetRemoteModality().GetApplicationEntityTitle(); |
2603 | 249 |
250 if (HasMoveOriginator()) | |
251 { | |
252 value["MoveOriginatorAET"] = GetMoveOriginatorAet(); | |
253 value["MoveOriginatorID"] = GetMoveOriginatorId(); | |
254 } | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
255 |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
256 if (storageCommitment_) |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
257 { |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
258 value["StorageCommitmentTransactionUID"] = transactionUid_; |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
259 } |
2603 | 260 } |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
261 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
262 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
263 static const char* MOVE_ORIGINATOR_AET = "MoveOriginatorAet"; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
264 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
|
265 static const char* STORAGE_COMMITMENT = "StorageCommitment"; |
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 DicomModalityStoreJob::DicomModalityStoreJob(ServerContext& context, |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
269 const Json::Value& serialized) : |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
270 SetOfInstancesJob(serialized), |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
271 context_(context) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
272 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
273 moveOriginatorAet_ = SerializationToolbox::ReadString(serialized, MOVE_ORIGINATOR_AET); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
274 moveOriginatorId_ = static_cast<uint16_t> |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
275 (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
|
276 EnableStorageCommitment(SerializationToolbox::ReadBoolean(serialized, STORAGE_COMMITMENT)); |
3870
09798f2b985f
added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents:
3862
diff
changeset
|
277 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
278 parameters_ = DicomAssociationParameters::UnserializeJob(serialized); |
2664
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 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
281 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
282 bool DicomModalityStoreJob::Serialize(Json::Value& target) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
283 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
284 if (!SetOfInstancesJob::Serialize(target)) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
285 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
286 return false; |
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 else |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
289 { |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
290 parameters_.SerializeJob(target); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
291 target[MOVE_ORIGINATOR_AET] = moveOriginatorAet_; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
292 target[MOVE_ORIGINATOR_ID] = moveOriginatorId_; |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
293 target[STORAGE_COMMITMENT] = storageCommitment_; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
294 return true; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
295 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
296 } |
2603 | 297 } |