Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp @ 4831:7053502fbf97
added copyright UCLouvain
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 19:01:11 +0100 |
parents | 9804d6490872 |
children | 2e71a08eea15 43e613a7756b |
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:
4154
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4650
diff
changeset
|
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
2603 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * In addition, as a special exception, the copyright holders of this | |
14 * program give permission to link the code of its release with the | |
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
16 * that use the same license as the "OpenSSL" library), and distribute | |
17 * the linked executables. You must obey the GNU General Public License | |
18 * in all respects for all of the code used other than "OpenSSL". If you | |
19 * modify file(s) with this exception, you may extend this exception to | |
20 * your version of the file(s), but you are not obligated to do so. If | |
21 * you do not wish to do so, delete this exception statement from your | |
22 * version. If you delete this exception statement from all source files | |
23 * in the program, then also delete it here. | |
24 * | |
25 * This program is distributed in the hope that it will be useful, but | |
26 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
28 * General Public License for more details. | |
29 * | |
30 * You should have received a copy of the GNU General Public License | |
31 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
32 **/ | |
33 | |
34 | |
35 #include "../PrecompiledHeadersServer.h" | |
36 #include "OrthancPeerStoreJob.h" | |
37 | |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
38 #include "../../../OrthancFramework/Sources/Compression/GzipCompressor.h" |
4045 | 39 #include "../../../OrthancFramework/Sources/Logging.h" |
40 #include "../../../OrthancFramework/Sources/SerializationToolbox.h" | |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
41 #include "../ServerContext.h" |
2603 | 42 |
3950
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
43 #include <dcmtk/dcmdata/dcfilefo.h> |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
44 |
2603 | 45 |
46 namespace Orthanc | |
47 { | |
48 bool OrthancPeerStoreJob::HandleInstance(const std::string& instance) | |
49 { | |
50 //boost::this_thread::sleep(boost::posix_time::milliseconds(500)); | |
51 | |
52 if (client_.get() == NULL) | |
53 { | |
54 client_.reset(new HttpClient(peer_, "instances")); | |
55 client_->SetMethod(HttpMethod_Post); | |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
56 |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
57 if (compress_) |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
58 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
59 client_->AddHeader("Expect", ""); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
60 client_->AddHeader("Content-Encoding", "gzip"); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
61 } |
2603 | 62 } |
63 | |
64 LOG(INFO) << "Sending instance " << instance << " to peer \"" | |
65 << peer_.GetUrl() << "\""; | |
66 | |
4650
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 // Lifetime of "body" must exceed the call to "client_->Apply()" because of "SetExternalBody()" |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
68 std::string body; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
69 |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
70 try |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
71 { |
3950
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
72 if (transcode_) |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
73 { |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
74 std::string dicom; |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
75 context_.ReadDicom(dicom, instance); |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
76 |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
77 std::set<DicomTransferSyntax> syntaxes; |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
78 syntaxes.insert(transferSyntax_); |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
79 |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
80 IDicomTranscoder::DicomImage source, transcoded; |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
81 source.SetExternalBuffer(dicom); |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
82 |
3951
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3950
diff
changeset
|
83 if (context_.Transcode(transcoded, source, syntaxes, true)) |
3950
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
84 { |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
85 body.assign(reinterpret_cast<const char*>(transcoded.GetBufferData()), |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
86 transcoded.GetBufferSize()); |
3950
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
87 } |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
88 else |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
89 { |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
90 body.swap(dicom); |
3950
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
91 } |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
92 } |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
93 else |
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
94 { |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
95 context_.ReadDicom(body, instance); |
3950
5797ca4f3b8d
"/peers/{id}/store": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3949
diff
changeset
|
96 } |
2624
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
97 } |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
98 catch (OrthancException& e) |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
99 { |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
100 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
|
101 return false; |
714dcddeb65f
asynchronous c-movoe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
102 } |
2603 | 103 |
4650
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
104 // Lifetime of "compressedBody" must exceed the call to "client_->Apply()" because of "SetExternalBody()" |
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
105 std::string compressedBody; |
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
106 |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
107 if (compress_) |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
108 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
109 GzipCompressor compressor; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
110 compressor.SetCompressionLevel(9); // Max compression level |
4650
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
111 IBufferCompressor::Compress(compressedBody, compressor, body); |
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
112 |
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
113 client_->SetExternalBody(compressedBody); |
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
114 size_ += compressedBody.size(); |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
115 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
116 else |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
117 { |
4650
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
118 client_->SetExternalBody(body); |
9804d6490872
Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
119 size_ += body.size(); |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
120 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
121 |
2603 | 122 std::string answer; |
123 if (client_->Apply(answer)) | |
124 { | |
125 return true; | |
126 } | |
127 else | |
128 { | |
4154 | 129 if (compress_) |
130 { | |
131 LOG(ERROR) << "Cannot send DICOM over HTTP using \"gzip\" as " | |
132 << "\"Content-Encoding\": Make sure that the version " | |
133 << "of the remote Orthanc server is >= 1.6.0"; | |
134 } | |
135 | |
2603 | 136 throw OrthancException(ErrorCode_NetworkProtocol); |
137 } | |
138 } | |
139 | |
140 | |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
141 bool OrthancPeerStoreJob::HandleTrailingStep() |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
142 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
143 throw OrthancException(ErrorCode_InternalError); |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
144 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
145 |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
146 |
2603 | 147 void OrthancPeerStoreJob::SetPeer(const WebServiceParameters& peer) |
148 { | |
149 if (IsStarted()) | |
150 { | |
151 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
152 } | |
153 else | |
154 { | |
155 peer_ = peer; | |
156 } | |
157 } | |
158 | |
159 | |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
160 DicomTransferSyntax OrthancPeerStoreJob::GetTransferSyntax() const |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
161 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
162 if (transcode_) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
163 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
164 return transferSyntax_; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
165 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
166 else |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
167 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
168 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
169 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
170 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
171 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
172 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
173 void OrthancPeerStoreJob::SetTranscode(DicomTransferSyntax syntax) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
174 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
175 if (IsStarted()) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
176 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
177 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
178 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
179 else |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
180 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
181 transcode_ = true; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
182 transferSyntax_ = syntax; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
183 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
184 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
185 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
186 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
187 void OrthancPeerStoreJob::SetTranscode(const std::string& transferSyntaxUid) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
188 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
189 DicomTransferSyntax s; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
190 if (LookupTransferSyntax(s, transferSyntaxUid)) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
191 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
192 SetTranscode(s); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
193 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
194 else |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
195 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
196 throw OrthancException(ErrorCode_BadFileFormat, |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
197 "Unknown transfer syntax UID: " + transferSyntaxUid); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
198 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
199 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
200 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
201 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
202 void OrthancPeerStoreJob::ClearTranscode() |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
203 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
204 if (IsStarted()) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
205 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
206 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
207 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
208 else |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
209 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
210 transcode_ = false; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
211 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
212 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
213 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
214 |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
215 void OrthancPeerStoreJob::SetCompress(bool compress) |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
216 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
217 if (IsStarted()) |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
218 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
219 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
220 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
221 else |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
222 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
223 compress_ = compress; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
224 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
225 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
226 |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
227 |
2812
ea7aea6f6a95
improved naming of methods in IJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2811
diff
changeset
|
228 void OrthancPeerStoreJob::Stop(JobStopReason reason) // For pausing jobs |
2603 | 229 { |
230 client_.reset(NULL); | |
231 } | |
232 | |
233 | |
234 void OrthancPeerStoreJob::GetPublicContent(Json::Value& value) | |
235 { | |
2640
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
236 SetOfInstancesJob::GetPublicContent(value); |
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2624
diff
changeset
|
237 |
2603 | 238 Json::Value v; |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2669
diff
changeset
|
239 peer_.Serialize(v, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2669
diff
changeset
|
240 false /* allow simple format if possible */, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2669
diff
changeset
|
241 false /* don't include passwords */); |
2603 | 242 value["Peer"] = v; |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
243 value["Compress"] = compress_; |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
244 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
245 if (transcode_) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
246 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
247 value["Transcode"] = GetTransferSyntaxUid(transferSyntax_); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
248 } |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
249 |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
250 static const uint64_t MEGA_BYTES = 1024 * 1024; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
251 value["Size"] = boost::lexical_cast<std::string>(size_); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
252 value["SizeMB"] = static_cast<unsigned int>(size_ / MEGA_BYTES); |
2603 | 253 } |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
254 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
255 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
256 static const char* PEER = "Peer"; |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
257 static const char* TRANSCODE = "Transcode"; |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
258 static const char* COMPRESS = "Compress"; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
259 static const char* SIZE = "Size"; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
260 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
261 OrthancPeerStoreJob::OrthancPeerStoreJob(ServerContext& context, |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
262 const Json::Value& serialized) : |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
263 SetOfInstancesJob(serialized), |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
264 context_(context) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
265 { |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
266 assert(serialized.type() == Json::objectValue); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
267 peer_ = WebServiceParameters(serialized[PEER]); |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
268 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
269 if (serialized.isMember(TRANSCODE)) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
270 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
271 SetTranscode(SerializationToolbox::ReadString(serialized, TRANSCODE)); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
272 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
273 else |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
274 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
275 transcode_ = false; |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
276 transferSyntax_ = DicomTransferSyntax_LittleEndianExplicit; // Dummy value |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
277 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
278 |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
279 if (serialized.isMember(COMPRESS)) |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
280 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
281 SetCompress(SerializationToolbox::ReadBoolean(serialized, COMPRESS)); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
282 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
283 else |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
284 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
285 compress_ = false; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
286 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
287 |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
288 if (serialized.isMember(SIZE)) |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
289 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
290 size_ = boost::lexical_cast<uint64_t>(SerializationToolbox::ReadString(serialized, SIZE)); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
291 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
292 else |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
293 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
294 size_ = 0; |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
295 } |
2664
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 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
298 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
299 bool OrthancPeerStoreJob::Serialize(Json::Value& target) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
300 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
301 if (!SetOfInstancesJob::Serialize(target)) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
302 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
303 return false; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
304 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
305 else |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
306 { |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
307 assert(target.type() == Json::objectValue); |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2669
diff
changeset
|
308 peer_.Serialize(target[PEER], |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2669
diff
changeset
|
309 true /* force advanced format */, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2669
diff
changeset
|
310 true /* include passwords */); |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
311 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
312 if (transcode_) |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
313 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
314 target[TRANSCODE] = GetTransferSyntaxUid(transferSyntax_); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
315 } |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
316 |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
317 target[COMPRESS] = compress_; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
318 target[SIZE] = boost::lexical_cast<std::string>(size_); |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
319 |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
320 return true; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
321 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
322 } |
2603 | 323 } |