comparison 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
comparison
equal deleted inserted replaced
4507:b4c58795f3a8 4508:8f9090b137f1
394 static void StoreCreatedInstance(std::string& id /* out */, 394 static void StoreCreatedInstance(std::string& id /* out */,
395 RestApiPostCall& call, 395 RestApiPostCall& call,
396 ParsedDicomFile& dicom, 396 ParsedDicomFile& dicom,
397 bool sendAnswer) 397 bool sendAnswer)
398 { 398 {
399 DicomInstanceToStore toStore; 399 std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromParsedDicomFile(dicom));
400 toStore.SetOrigin(DicomInstanceOrigin::FromRest(call)); 400 toStore->SetOrigin(DicomInstanceOrigin::FromRest(call));
401 toStore.SetParsedDicomFile(dicom);
402 401
403 ServerContext& context = OrthancRestApi::GetContext(call); 402 ServerContext& context = OrthancRestApi::GetContext(call);
404 StoreStatus status = context.Store(id, toStore, StoreInstanceMode_Default); 403 StoreStatus status = context.Store(id, *toStore, StoreInstanceMode_Default);
405 404
406 if (status == StoreStatus_Failure) 405 if (status == StoreStatus_Failure)
407 { 406 {
408 throw OrthancException(ErrorCode_CannotStoreInstance); 407 throw OrthancException(ErrorCode_CannotStoreInstance);
409 } 408 }
410 409
411 if (sendAnswer) 410 if (sendAnswer)
412 { 411 {
413 OrthancRestApi::GetApi(call).AnswerStoredInstance(call, toStore, status, id); 412 OrthancRestApi::GetApi(call).AnswerStoredInstance(call, *toStore, status, id);
414 } 413 }
415 } 414 }
416 415
417 416
418 static void CreateDicomV1(ParsedDicomFile& dicom, 417 static void CreateDicomV1(ParsedDicomFile& dicom,