Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 4505:97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Feb 2021 12:07:03 +0100 |
parents | 7d1eabfac6e0 |
children | ac69c9f76c71 |
comparison
equal
deleted
inserted
replaced
4504:7d1eabfac6e0 | 4505:97d103b57cd1 |
---|---|
510 | 510 |
511 default: | 511 default: |
512 throw OrthancException(ErrorCode_ParameterOutOfRange); | 512 throw OrthancException(ErrorCode_ParameterOutOfRange); |
513 } | 513 } |
514 | 514 |
515 | |
516 bool hasPixelDataOffset; | 515 bool hasPixelDataOffset; |
517 uint64_t pixelDataOffset; | 516 uint64_t pixelDataOffset; |
518 hasPixelDataOffset = DicomStreamReader::LookupPixelDataOffset( | 517 hasPixelDataOffset = DicomStreamReader::LookupPixelDataOffset( |
519 pixelDataOffset, dicom.GetBufferData(), dicom.GetBufferSize()); | 518 pixelDataOffset, dicom.GetBufferData(), dicom.GetBufferSize()); |
520 | 519 |
521 | 520 DicomMap summary; |
521 OrthancConfiguration::DefaultExtractDicomSummary(summary, dicom.GetParsedDicomFile()); | |
522 | |
522 try | 523 try |
523 { | 524 { |
524 MetricsRegistry::Timer timer(GetMetricsRegistry(), "orthanc_store_dicom_duration_ms"); | 525 MetricsRegistry::Timer timer(GetMetricsRegistry(), "orthanc_store_dicom_duration_ms"); |
525 StorageAccessor accessor(area_, GetMetricsRegistry()); | 526 StorageAccessor accessor(area_, GetMetricsRegistry()); |
526 | 527 |
527 resultPublicId = dicom.GetHasher().HashInstance(); | 528 DicomInstanceHasher hasher(summary); |
529 resultPublicId = hasher.HashInstance(); | |
528 | 530 |
529 Json::Value dicomAsJson; | 531 Json::Value dicomAsJson; |
530 OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, dicom.GetParsedDicomFile()); | 532 OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, dicom.GetParsedDicomFile()); |
531 | 533 |
532 Json::Value simplifiedTags; | 534 Json::Value simplifiedTags; |
586 attachments.push_back(jsonInfo); | 588 attachments.push_back(jsonInfo); |
587 } | 589 } |
588 | 590 |
589 typedef std::map<MetadataType, std::string> InstanceMetadata; | 591 typedef std::map<MetadataType, std::string> InstanceMetadata; |
590 InstanceMetadata instanceMetadata; | 592 InstanceMetadata instanceMetadata; |
591 StoreStatus status = index_.Store( | 593 StoreStatus status = index_.Store(instanceMetadata, dicom, summary, hasher, attachments, |
592 instanceMetadata, dicom, attachments, overwrite, hasPixelDataOffset, pixelDataOffset); | 594 overwrite, hasPixelDataOffset, pixelDataOffset); |
593 | 595 |
594 // Only keep the metadata for the "instance" level | 596 // Only keep the metadata for the "instance" level |
595 dicom.GetMetadata().clear(); | 597 dicom.GetMetadata().clear(); |
596 | 598 |
597 for (InstanceMetadata::const_iterator it = instanceMetadata.begin(); | 599 for (InstanceMetadata::const_iterator it = instanceMetadata.begin(); |
654 } | 656 } |
655 catch (OrthancException& e) | 657 catch (OrthancException& e) |
656 { | 658 { |
657 if (e.GetErrorCode() == ErrorCode_InexistentTag) | 659 if (e.GetErrorCode() == ErrorCode_InexistentTag) |
658 { | 660 { |
659 dicom.GetSummary().LogMissingTagsForStore(); | 661 summary.LogMissingTagsForStore(); |
660 } | 662 } |
661 | 663 |
662 throw; | 664 throw; |
663 } | 665 } |
664 } | 666 } |
665 | 667 |
666 | 668 |