Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 4623:95ffe3b6ef7c db-changes
handling of revisions for metadata
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 16 Apr 2021 17:13:03 +0200 |
parents | f75c63aa9de0 |
children | f7d5372b59b3 |
comparison
equal
deleted
inserted
replaced
4622:9086aeb9d9d2 | 4623:95ffe3b6ef7c |
---|---|
858 bool hasPixelDataOffset; | 858 bool hasPixelDataOffset; |
859 uint64_t pixelDataOffset = 0; // dummy initialization | 859 uint64_t pixelDataOffset = 0; // dummy initialization |
860 | 860 |
861 { | 861 { |
862 std::string s; | 862 std::string s; |
863 if (index_.LookupMetadata(s, instancePublicId, ResourceType_Instance, | 863 int64_t revision; // Ignored |
864 if (index_.LookupMetadata(s, revision, instancePublicId, ResourceType_Instance, | |
864 MetadataType_Instance_PixelDataOffset)) | 865 MetadataType_Instance_PixelDataOffset)) |
865 { | 866 { |
866 hasPixelDataOffset = false; | 867 hasPixelDataOffset = false; |
867 | 868 |
868 if (!s.empty()) | 869 if (!s.empty()) |
969 * for future calls. | 970 * for future calls. |
970 **/ | 971 **/ |
971 if (DicomStreamReader::LookupPixelDataOffset(pixelDataOffset, dicom) && | 972 if (DicomStreamReader::LookupPixelDataOffset(pixelDataOffset, dicom) && |
972 pixelDataOffset < dicom.size()) | 973 pixelDataOffset < dicom.size()) |
973 { | 974 { |
974 index_.SetMetadata(instancePublicId, MetadataType_Instance_PixelDataOffset, | 975 index_.OverwriteMetadata(instancePublicId, MetadataType_Instance_PixelDataOffset, |
975 boost::lexical_cast<std::string>(pixelDataOffset)); | 976 boost::lexical_cast<std::string>(pixelDataOffset)); |
976 | 977 |
977 if (!area_.HasReadRange() || | 978 if (!area_.HasReadRange() || |
978 compressionEnabled_) | 979 compressionEnabled_) |
979 { | 980 { |
980 AddAttachment(instancePublicId, FileContentType_DicomUntilPixelData, | 981 AddAttachment(instancePublicId, FileContentType_DicomUntilPixelData, |
1016 throw OrthancException(ErrorCode_InternalError, | 1017 throw OrthancException(ErrorCode_InternalError, |
1017 "Unable to read the DICOM file of instance " + instancePublicId); | 1018 "Unable to read the DICOM file of instance " + instancePublicId); |
1018 } | 1019 } |
1019 | 1020 |
1020 std::string s; | 1021 std::string s; |
1022 int64_t revision; // Ignored | |
1021 | 1023 |
1022 if (attachment.GetCompressionType() == CompressionType_None && | 1024 if (attachment.GetCompressionType() == CompressionType_None && |
1023 index_.LookupMetadata(s, instancePublicId, ResourceType_Instance, | 1025 index_.LookupMetadata(s, revision, instancePublicId, ResourceType_Instance, |
1024 MetadataType_Instance_PixelDataOffset) && | 1026 MetadataType_Instance_PixelDataOffset) && |
1025 !s.empty()) | 1027 !s.empty()) |
1026 { | 1028 { |
1027 try | 1029 try |
1028 { | 1030 { |
1641 // release of Orthanc | 1643 // release of Orthanc |
1642 | 1644 |
1643 if (metadata == MetadataType_Instance_SopClassUid || | 1645 if (metadata == MetadataType_Instance_SopClassUid || |
1644 metadata == MetadataType_Instance_TransferSyntax) | 1646 metadata == MetadataType_Instance_TransferSyntax) |
1645 { | 1647 { |
1646 if (index_.LookupMetadata(target, publicId, level, metadata)) | 1648 int64_t revision; // Ignored |
1649 if (index_.LookupMetadata(target, revision, publicId, level, metadata)) | |
1647 { | 1650 { |
1648 return true; | 1651 return true; |
1649 } | 1652 } |
1650 else | 1653 else |
1651 { | 1654 { |
1683 !value->IsBinary()) | 1686 !value->IsBinary()) |
1684 { | 1687 { |
1685 target = value->GetContent(); | 1688 target = value->GetContent(); |
1686 | 1689 |
1687 // Store for reuse | 1690 // Store for reuse |
1688 index_.SetMetadata(publicId, metadata, target); | 1691 index_.OverwriteMetadata(publicId, metadata, target); |
1689 return true; | 1692 return true; |
1690 } | 1693 } |
1691 else | 1694 else |
1692 { | 1695 { |
1693 // Should never happen | 1696 // Should never happen |
1696 } | 1699 } |
1697 } | 1700 } |
1698 else | 1701 else |
1699 { | 1702 { |
1700 // No backward | 1703 // No backward |
1701 return index_.LookupMetadata(target, publicId, level, metadata); | 1704 int64_t revision; // Ignored |
1705 return index_.LookupMetadata(target, revision, publicId, level, metadata); | |
1702 } | 1706 } |
1703 } | 1707 } |
1704 | 1708 |
1705 | 1709 |
1706 void ServerContext::AddChildInstances(SetOfInstancesJob& job, | 1710 void ServerContext::AddChildInstances(SetOfInstancesJob& job, |