Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi.cpp @ 291:4d7469f72a0b
embedding of dicom dictionaries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Dec 2012 15:15:48 +0100 |
parents | 4031f73fe0e4 |
children | f13eef8ce651 |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp Fri Dec 14 11:24:24 2012 +0100 +++ b/OrthancServer/OrthancRestApi.cpp Fri Dec 14 15:15:48 2012 +0100 @@ -758,22 +758,29 @@ RETRIEVE_CONTEXT(call); const std::string& postData = call.GetPostBody(); + if (postData.size() == 0) + { + return; + } LOG(INFO) << "Receiving a DICOM file of " << postData.size() << " bytes through HTTP"; - // Prepare an input stream for the memory buffer - DcmInputBufferStream is; - if (postData.size() > 0) + DcmFileFormat dicomFile; + { + // Prepare an input stream for the memory buffer + DcmInputBufferStream is; is.setBuffer(&postData[0], postData.size()); - } - is.setEos(); + is.setEos(); - DcmFileFormat dicomFile; - if (!dicomFile.read(is).good()) - { - call.GetOutput().SignalError(Orthanc_HttpStatus_415_UnsupportedMediaType); - return; + dicomFile.transferInit(); + if (!dicomFile.read(is).good()) + { + call.GetOutput().SignalError(Orthanc_HttpStatus_415_UnsupportedMediaType); + return; + } + dicomFile.loadAllDataIntoMemory(); + dicomFile.transferEnd(); } DicomMap dicomSummary; @@ -788,9 +795,9 @@ if (postData.size() > 0) { status = context.Store - (reinterpret_cast<const char*>(&postData[0]), - postData.size(), dicomSummary, dicomJson, ""); - } + (reinterpret_cast<const char*>(&postData[0]), postData.size(), + dicomSummary, dicomJson, ""); + } Json::Value result = Json::objectValue;