comparison OrthancServer/Sources/Database/FindResponse.cpp @ 5619:1864b16bc7b1 find-refactoring

added FindRequest::ParentRetrieveSpecification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 11 May 2024 12:13:31 +0200
parents d4b570834d3a
children 732ec9feeea8
comparison
equal deleted inserted replaced
5618:824a5fb0774e 5619:1864b16bc7b1
475 if (request.IsRetrieveParentIdentifier()) 475 if (request.IsRetrieveParentIdentifier())
476 { 476 {
477 target["ParentID"] = GetParentIdentifier(); 477 target["ParentID"] = GetParentIdentifier();
478 } 478 }
479 479
480 if (request.IsRetrieveMainDicomTags(ResourceType_Patient)) 480 if (request.IsRetrieveMainDicomTags())
481 { 481 {
482 DicomMap m; 482 DicomMap m;
483 GetMainDicomTags(m, ResourceType_Patient); 483 GetMainDicomTags(m, request.GetLevel());
484 DebugDicomMap(target["Patient"]["MainDicomTags"], m); 484 DebugDicomMap(target[EnumerationToString(GetLevel())]["MainDicomTags"], m);
485 } 485 }
486 486
487 if (request.IsRetrieveMetadata(ResourceType_Patient)) 487 if (request.IsRetrieveMetadata())
488 { 488 {
489 DebugMetadata(target["Patient"]["Metadata"], GetMetadata(ResourceType_Patient)); 489 DebugMetadata(target[EnumerationToString(GetLevel())]["Metadata"], GetMetadata(request.GetLevel()));
490 } 490 }
491 491
492 if (request.GetLevel() != ResourceType_Patient) 492 static const ResourceType levels[4] = { ResourceType_Patient, ResourceType_Study, ResourceType_Series, ResourceType_Instance };
493 { 493
494 if (request.IsRetrieveMainDicomTags(ResourceType_Study)) 494 for (size_t i = 0; i < 4; i++)
495 { 495 {
496 DicomMap m; 496 if (levels[i] != request.GetLevel() &&
497 GetMainDicomTags(m, ResourceType_Study); 497 IsResourceLevelAboveOrEqual(levels[i], request.GetLevel()))
498 DebugDicomMap(target["Study"]["MainDicomTags"], m); 498 {
499 } 499 const char* level = EnumerationToString(levels[i]);
500 500
501 if (request.IsRetrieveMetadata(ResourceType_Study)) 501 if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags())
502 { 502 {
503 DebugMetadata(target["Study"]["Metadata"], GetMetadata(ResourceType_Study)); 503 DicomMap m;
504 } 504 GetMainDicomTags(m, levels[i]);
505 } 505 DebugDicomMap(target[level]["MainDicomTags"], m);
506 506 }
507 if (request.GetLevel() != ResourceType_Patient && 507
508 request.GetLevel() != ResourceType_Study) 508 if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags())
509 { 509 {
510 if (request.IsRetrieveMainDicomTags(ResourceType_Series)) 510 DebugMetadata(target[level]["Metadata"], GetMetadata(levels[i]));
511 { 511 }
512 DicomMap m;
513 GetMainDicomTags(m, ResourceType_Series);
514 DebugDicomMap(target["Series"]["MainDicomTags"], m);
515 }
516
517 if (request.IsRetrieveMetadata(ResourceType_Series))
518 {
519 DebugMetadata(target["Series"]["Metadata"], GetMetadata(ResourceType_Series));
520 }
521 }
522
523 if (request.GetLevel() != ResourceType_Patient &&
524 request.GetLevel() != ResourceType_Study &&
525 request.GetLevel() != ResourceType_Series)
526 {
527 if (request.IsRetrieveMainDicomTags(ResourceType_Instance))
528 {
529 DicomMap m;
530 GetMainDicomTags(m, ResourceType_Instance);
531 DebugDicomMap(target["Instance"]["MainDicomTags"], m);
532 }
533
534 if (request.IsRetrieveMetadata(ResourceType_Instance))
535 {
536 DebugMetadata(target["Instance"]["Metadata"], GetMetadata(ResourceType_Instance));
537 } 512 }
538 } 513 }
539 514
540 if (request.IsRetrieveChildrenIdentifiers()) 515 if (request.IsRetrieveChildrenIdentifiers())
541 { 516 {