diff OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.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 1619cffd1948
children f75c63aa9de0
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Thu Feb 11 09:33:48 2021 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Thu Feb 11 11:00:05 2021 +0100
@@ -396,12 +396,11 @@
                                    ParsedDicomFile& dicom,
                                    bool sendAnswer)
   {
-    DicomInstanceToStore toStore;
-    toStore.SetOrigin(DicomInstanceOrigin::FromRest(call));
-    toStore.SetParsedDicomFile(dicom);
+    std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromParsedDicomFile(dicom));
+    toStore->SetOrigin(DicomInstanceOrigin::FromRest(call));
 
     ServerContext& context = OrthancRestApi::GetContext(call);
-    StoreStatus status = context.Store(id, toStore, StoreInstanceMode_Default);
+    StoreStatus status = context.Store(id, *toStore, StoreInstanceMode_Default);
 
     if (status == StoreStatus_Failure)
     {
@@ -410,7 +409,7 @@
 
     if (sendAnswer)
     {
-      OrthancRestApi::GetApi(call).AnswerStoredInstance(call, toStore, status, id);
+      OrthancRestApi::GetApi(call).AnswerStoredInstance(call, *toStore, status, id);
     }
   }