Mercurial > hg > orthanc
comparison OrthancServer/Internals/StoreScp.cpp @ 102:7593b57dc1bf
switch to google log
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Oct 2012 16:28:13 +0200 |
parents | 428784e59dcd |
children | f2ecbe7d50b8 |
comparison
equal
deleted
inserted
replaced
101:428784e59dcd | 102:7593b57dc1bf |
---|---|
21 #include "StoreScp.h" | 21 #include "StoreScp.h" |
22 | 22 |
23 #include "../FromDcmtkBridge.h" | 23 #include "../FromDcmtkBridge.h" |
24 #include "../ToDcmtkBridge.h" | 24 #include "../ToDcmtkBridge.h" |
25 #include "../../Core/OrthancException.h" | 25 #include "../../Core/OrthancException.h" |
26 #include "DcmtkLogging.h" | |
27 | 26 |
28 #include <dcmtk/dcmdata/dcfilefo.h> | 27 #include <dcmtk/dcmdata/dcfilefo.h> |
29 #include <dcmtk/dcmdata/dcmetinf.h> | 28 #include <dcmtk/dcmdata/dcmetinf.h> |
30 #include <dcmtk/dcmdata/dcostrmb.h> | 29 #include <dcmtk/dcmdata/dcostrmb.h> |
31 #include <dcmtk/dcmdata/dcdeftag.h> | 30 #include <dcmtk/dcmdata/dcdeftag.h> |
32 #include <dcmtk/dcmnet/diutil.h> | 31 #include <dcmtk/dcmnet/diutil.h> |
32 #include <glog/logging.h> | |
33 | 33 |
34 | 34 |
35 namespace Orthanc | 35 namespace Orthanc |
36 { | 36 { |
37 namespace | 37 namespace |
62 buffer.resize(s); | 62 buffer.resize(s); |
63 DcmOutputBufferStream ob(&buffer[0], s); | 63 DcmOutputBufferStream ob(&buffer[0], s); |
64 | 64 |
65 dataSet->transferInit(); | 65 dataSet->transferInit(); |
66 | 66 |
67 #if 0 | 67 #if 1 |
68 OFCondition c = dataSet->write(ob, xfer, encodingType, NULL, | 68 OFCondition c = dataSet->write(ob, xfer, encodingType, NULL, |
69 /*opt_groupLength*/ EGL_recalcGL, | 69 /*opt_groupLength*/ EGL_recalcGL, |
70 /*opt_paddingType*/ EPD_withoutPadding); | 70 /*opt_paddingType*/ EPD_withoutPadding); |
71 #else | |
72 OFCondition c = dataSet->write(ob, xfer, encodingType); | |
71 #endif | 73 #endif |
72 OFCondition c = dataSet->write(ob, xfer, encodingType); | |
73 | 74 |
74 dataSet->transferEnd(); | 75 dataSet->transferEnd(); |
75 if (c.good()) | 76 if (c.good()) |
76 { | 77 { |
77 return 0; | 78 return 0; |
153 FromDcmtkBridge::Convert(summary, **imageDataSet); | 154 FromDcmtkBridge::Convert(summary, **imageDataSet); |
154 FromDcmtkBridge::ToJson(dicomJson, **imageDataSet); | 155 FromDcmtkBridge::ToJson(dicomJson, **imageDataSet); |
155 | 156 |
156 if (SaveToMemoryBuffer(*imageDataSet, buffer) < 0) | 157 if (SaveToMemoryBuffer(*imageDataSet, buffer) < 0) |
157 { | 158 { |
158 LOG4CPP_ERROR(Internals::GetLogger(), "cannot write DICOM file to memory"); | 159 LOG(ERROR) << "cannot write DICOM file to memory"; |
159 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; | 160 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; |
160 } | 161 } |
161 } | 162 } |
162 catch (...) | 163 catch (...) |
163 { | 164 { |
189 cbdata->handler->Handle(buffer, summary, dicomJson, cbdata->distantAET); | 190 cbdata->handler->Handle(buffer, summary, dicomJson, cbdata->distantAET); |
190 } | 191 } |
191 catch (OrthancException& e) | 192 catch (OrthancException& e) |
192 { | 193 { |
193 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; | 194 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; |
194 LOG4CPP_ERROR(Internals::GetLogger(), "Exception while storing DICOM: " + std::string(e.What())); | 195 LOG(ERROR) << "Exception while storing DICOM: " << e.What(); |
195 } | 196 } |
196 } | 197 } |
197 } | 198 } |
198 } | 199 } |
199 } | 200 } |
258 | 259 |
259 // if some error occured, dump corresponding information and remove the outfile if necessary | 260 // if some error occured, dump corresponding information and remove the outfile if necessary |
260 if (cond.bad()) | 261 if (cond.bad()) |
261 { | 262 { |
262 OFString temp_str; | 263 OFString temp_str; |
263 LOG4CPP_ERROR(GetLogger(), "Store SCP Failed: " + std::string(cond.text())); | 264 LOG(ERROR) << "Store SCP Failed: " << cond.text(); |
264 } | 265 } |
265 | 266 |
266 // return return value | 267 // return return value |
267 return cond; | 268 return cond; |
268 } | 269 } |