Mercurial > hg > orthanc
annotate OrthancServer/Internals/StoreScp.cpp @ 1429:7366a0bdda6a
attempt of fix for Syngo.Via
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 29 Jun 2015 14:43:08 +0200 |
parents | 732b6a4ed541 |
children | f967bdf8534e |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1285
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1285
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
0 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
136 | 10 * |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
0 | 22 * |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
33 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
34 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
35 /*========================================================================= |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
36 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
37 This file is based on portions of the following project: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
38 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
39 Program: DCMTK 3.6.0 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
40 Module: http://dicom.offis.de/dcmtk.php.en |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
41 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
42 Copyright (C) 1994-2011, OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
43 All rights reserved. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
44 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
45 This software and supporting documentation were developed by |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
46 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
47 OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
48 R&D Division Health |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
49 Escherweg 2 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
50 26121 Oldenburg, Germany |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
51 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
52 Redistribution and use in source and binary forms, with or without |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
53 modification, are permitted provided that the following conditions |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
54 are met: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
55 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
56 - Redistributions of source code must retain the above copyright |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
57 notice, this list of conditions and the following disclaimer. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
58 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
59 - Redistributions in binary form must reproduce the above copyright |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
60 notice, this list of conditions and the following disclaimer in the |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
61 documentation and/or other materials provided with the distribution. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
62 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
63 - Neither the name of OFFIS nor the names of its contributors may be |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
64 used to endorse or promote products derived from this software |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
65 without specific prior written permission. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
66 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
67 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
68 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
69 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
70 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
71 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
72 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
73 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
74 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
75 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
76 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
77 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
78 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
79 =========================================================================*/ |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
80 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
81 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
82 #include "../PrecompiledHeadersServer.h" |
0 | 83 #include "StoreScp.h" |
84 | |
85 #include "../FromDcmtkBridge.h" | |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
86 #include "../ServerToolbox.h" |
0 | 87 #include "../ToDcmtkBridge.h" |
62 | 88 #include "../../Core/OrthancException.h" |
0 | 89 |
90 #include <dcmtk/dcmdata/dcfilefo.h> | |
91 #include <dcmtk/dcmdata/dcmetinf.h> | |
92 #include <dcmtk/dcmdata/dcostrmb.h> | |
93 #include <dcmtk/dcmdata/dcdeftag.h> | |
94 #include <dcmtk/dcmnet/diutil.h> | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
95 #include <glog/logging.h> |
0 | 96 |
97 | |
62 | 98 namespace Orthanc |
0 | 99 { |
100 namespace | |
101 { | |
102 struct StoreCallbackData | |
103 { | |
104 IStoreRequestHandler* handler; | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
105 const char* remoteAET; |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
106 const char* calledAET; |
0 | 107 const char* modality; |
108 const char* affectedSOPInstanceUID; | |
109 uint32_t messageID; | |
110 }; | |
111 | |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
112 |
0 | 113 static void |
114 storeScpCallback( | |
115 void *callbackData, | |
116 T_DIMSE_StoreProgress *progress, | |
117 T_DIMSE_C_StoreRQ *req, | |
118 char * /*imageFileName*/, DcmDataset **imageDataSet, | |
119 T_DIMSE_C_StoreRSP *rsp, | |
120 DcmDataset **statusDetail) | |
121 /* | |
122 * This function.is used to indicate progress when storescp receives instance data over the | |
123 * network. On the final call to this function (identified by progress->state == DIMSE_StoreEnd) | |
124 * this function will store the data set which was received over the network to a file. | |
125 * Earlier calls to this function will simply cause some information to be dumped to stdout. | |
126 * | |
127 * Parameters: | |
128 * callbackData - [in] data for this callback function | |
129 * progress - [in] The state of progress. (identifies if this is the initial or final call | |
130 * to this function, or a call in between these two calls. | |
131 * req - [in] The original store request message. | |
132 * imageFileName - [in] The path to and name of the file the information shall be written to. | |
133 * imageDataSet - [in] The data set which shall be stored in the image file | |
134 * rsp - [inout] the C-STORE-RSP message (will be sent after the call to this function) | |
135 * statusDetail - [inout] This variable can be used to capture detailed information with regard to | |
136 * the status information which is captured in the status element (0000,0900). Note | |
137 * that this function does specify any such information, the pointer will be set to NULL. | |
138 */ | |
139 { | |
140 StoreCallbackData *cbdata = OFstatic_cast(StoreCallbackData *, callbackData); | |
141 | |
142 DIC_UI sopClass; | |
143 DIC_UI sopInstance; | |
144 | |
145 // if this is the final call of this function, save the data which was received to a file | |
146 // (note that we could also save the image somewhere else, put it in database, etc.) | |
147 if (progress->state == DIMSE_StoreEnd) | |
148 { | |
149 OFString tmpStr; | |
150 | |
151 // do not send status detail information | |
152 *statusDetail = NULL; | |
153 | |
154 // Concerning the following line: an appropriate status code is already set in the resp structure, | |
155 // it need not be success. For example, if the caller has already detected an out of resources problem | |
156 // then the status will reflect this. The callback function is still called to allow cleanup. | |
157 //rsp->DimseStatus = STATUS_Success; | |
158 | |
159 // we want to write the received information to a file only if this information | |
160 // is present and the options opt_bitPreserving and opt_ignore are not set. | |
161 if ((imageDataSet != NULL) && (*imageDataSet != NULL)) | |
162 { | |
163 DicomMap summary; | |
164 Json::Value dicomJson; | |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
194
diff
changeset
|
165 std::string buffer; |
0 | 166 |
167 try | |
168 { | |
169 FromDcmtkBridge::Convert(summary, **imageDataSet); | |
170 FromDcmtkBridge::ToJson(dicomJson, **imageDataSet); | |
171 | |
1004
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
172 if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer, **imageDataSet)) |
0 | 173 { |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
174 LOG(ERROR) << "cannot write DICOM file to memory"; |
0 | 175 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; |
176 } | |
177 } | |
178 catch (...) | |
179 { | |
180 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; | |
181 } | |
182 | |
183 // check the image to make sure it is consistent, i.e. that its sopClass and sopInstance correspond | |
184 // to those mentioned in the request. If not, set the status in the response message variable. | |
1333
732b6a4ed541
clang warning removal
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
185 if (rsp->DimseStatus == STATUS_Success) |
0 | 186 { |
187 // which SOP class and SOP instance ? | |
188 if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sopInstance, /*opt_correctUIDPadding*/ OFFalse)) | |
189 { | |
101 | 190 //LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName); |
0 | 191 rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand; |
192 } | |
193 else if (strcmp(sopClass, req->AffectedSOPClassUID) != 0) | |
194 { | |
195 rsp->DimseStatus = STATUS_STORE_Error_DataSetDoesNotMatchSOPClass; | |
196 } | |
197 else if (strcmp(sopInstance, req->AffectedSOPInstanceUID) != 0) | |
198 { | |
199 rsp->DimseStatus = STATUS_STORE_Error_DataSetDoesNotMatchSOPClass; | |
200 } | |
201 else | |
202 { | |
203 try | |
204 { | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
205 cbdata->handler->Handle(buffer, summary, dicomJson, cbdata->remoteAET, cbdata->calledAET); |
0 | 206 } |
62 | 207 catch (OrthancException& e) |
0 | 208 { |
209 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; | |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
210 |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
211 if (e.GetErrorCode() == ErrorCode_InexistentTag) |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
212 { |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
213 LogMissingRequiredTag(summary); |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
214 } |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
215 else |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
216 { |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
217 LOG(ERROR) << "Exception while storing DICOM: " << e.What(); |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
218 } |
0 | 219 } |
220 } | |
221 } | |
222 } | |
223 } | |
224 } | |
225 } | |
226 | |
227 /* | |
228 * This function processes a DIMSE C-STORE-RQ commmand that was | |
229 * received over the network connection. | |
230 * | |
231 * Parameters: | |
232 * assoc - [in] The association (network connection to another DICOM application). | |
233 * msg - [in] The DIMSE C-STORE-RQ message that was received. | |
234 * presID - [in] The ID of the presentation context which was specified in the PDV which contained | |
235 * the DIMSE command. | |
236 */ | |
237 OFCondition Internals::storeScp(T_ASC_Association * assoc, | |
238 T_DIMSE_Message * msg, | |
239 T_ASC_PresentationContextID presID, | |
240 IStoreRequestHandler& handler) | |
241 { | |
242 OFCondition cond = EC_Normal; | |
243 T_DIMSE_C_StoreRQ *req; | |
244 | |
245 // assign the actual information of the C-STORE-RQ command to a local variable | |
246 req = &msg->msg.CStoreRQ; | |
247 | |
248 // intialize some variables | |
249 StoreCallbackData callbackData; | |
250 callbackData.handler = &handler; | |
101 | 251 callbackData.modality = dcmSOPClassUIDToModality(req->AffectedSOPClassUID/*, "UNKNOWN"*/); |
252 if (callbackData.modality == NULL) | |
253 callbackData.modality = "UNKNOWN"; | |
254 | |
0 | 255 callbackData.affectedSOPInstanceUID = req->AffectedSOPInstanceUID; |
256 callbackData.messageID = req->MessageID; | |
257 if (assoc && assoc->params) | |
258 { | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
259 callbackData.remoteAET = assoc->params->DULparams.callingAPTitle; |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
260 callbackData.calledAET = assoc->params->DULparams.calledAPTitle; |
0 | 261 } |
262 else | |
263 { | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
264 callbackData.remoteAET = ""; |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
265 callbackData.calledAET = ""; |
0 | 266 } |
267 | |
268 DcmFileFormat dcmff; | |
269 | |
270 // store SourceApplicationEntityTitle in metaheader | |
271 if (assoc && assoc->params) | |
272 { | |
273 const char *aet = assoc->params->DULparams.callingAPTitle; | |
274 if (aet) dcmff.getMetaInfo()->putAndInsertString(DCM_SourceApplicationEntityTitle, aet); | |
275 } | |
276 | |
277 // define an address where the information which will be received over the network will be stored | |
278 DcmDataset *dset = dcmff.getDataset(); | |
279 | |
280 cond = DIMSE_storeProvider(assoc, presID, req, NULL, /*opt_useMetaheader*/OFFalse, &dset, | |
281 storeScpCallback, &callbackData, | |
282 /*opt_blockMode*/ DIMSE_BLOCKING, | |
283 /*opt_dimse_timeout*/ 0); | |
284 | |
285 // if some error occured, dump corresponding information and remove the outfile if necessary | |
286 if (cond.bad()) | |
287 { | |
288 OFString temp_str; | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
289 LOG(ERROR) << "Store SCP Failed: " << cond.text(); |
0 | 290 } |
291 | |
292 // return return value | |
293 return cond; | |
294 } | |
295 } |