Mercurial > hg > orthanc
diff OrthancServer/Sources/main.cpp @ 4508:8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Feb 2021 11:00:05 +0100 |
parents | 97d103b57cd1 |
children | 350a22c094f2 |
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp Thu Feb 11 09:33:48 2021 +0100 +++ b/OrthancServer/Sources/main.cpp Thu Feb 11 11:00:05 2021 +0100 @@ -88,22 +88,15 @@ const std::string& remoteAet, const std::string& calledAet) ORTHANC_OVERRIDE { - std::string dicomFile; - - if (!FromDcmtkBridge::SaveToMemoryBuffer(dicomFile, dicom)) - { - throw OrthancException(ErrorCode_InternalError, "Cannot write DICOM file to memory"); - } + std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromDcmDataset(dicom)); - if (dicomFile.size() > 0) + if (toStore->GetBufferSize() > 0) { - DicomInstanceToStore toStore; - toStore.SetOrigin(DicomInstanceOrigin::FromDicomProtocol - (remoteIp.c_str(), remoteAet.c_str(), calledAet.c_str())); - toStore.SetBuffer(dicomFile.c_str(), dicomFile.size()); + toStore->SetOrigin(DicomInstanceOrigin::FromDicomProtocol + (remoteIp.c_str(), remoteAet.c_str(), calledAet.c_str())); std::string id; - context_.Store(id, toStore, StoreInstanceMode_Default); + context_.Store(id, *toStore, StoreInstanceMode_Default); } } };