Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 4509:98b7b9d21d83
removed ServerContext::ReadAttachment()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Feb 2021 17:11:37 +0100 |
parents | 8f9090b137f1 |
children | 1ec156a0da38 |
comparison
equal
deleted
inserted
replaced
4508:8f9090b137f1 | 4509:98b7b9d21d83 |
---|---|
811 const std::string& instancePublicId) | 811 const std::string& instancePublicId) |
812 { | 812 { |
813 FileInfo attachment; | 813 FileInfo attachment; |
814 if (index_.LookupAttachment(attachment, instancePublicId, FileContentType_DicomAsJson)) | 814 if (index_.LookupAttachment(attachment, instancePublicId, FileContentType_DicomAsJson)) |
815 { | 815 { |
816 ReadAttachment(result, attachment); | 816 StorageAccessor accessor(area_, GetMetricsRegistry()); |
817 accessor.Read(result, attachment); | |
817 } | 818 } |
818 else | 819 else |
819 { | 820 { |
820 // The "DICOM as JSON" summary is not available from the Orthanc | 821 // The "DICOM as JSON" summary is not available from the Orthanc |
821 // store (most probably deleted), reconstruct it from the DICOM file | 822 // store (most probably deleted), reconstruct it from the DICOM file |
884 OrthancConfiguration::DefaultDicomDatasetToJson(result, parsed, ignoreTagLength); | 885 OrthancConfiguration::DefaultDicomDatasetToJson(result, parsed, ignoreTagLength); |
885 } | 886 } |
886 } | 887 } |
887 | 888 |
888 | 889 |
890 void ServerContext::ReadDicom(std::string& dicom, | |
891 const std::string& instancePublicId) | |
892 { | |
893 ReadAttachment(dicom, instancePublicId, FileContentType_Dicom, true /* uncompress */); | |
894 } | |
895 | |
896 | |
889 void ServerContext::ReadAttachment(std::string& result, | 897 void ServerContext::ReadAttachment(std::string& result, |
890 const std::string& instancePublicId, | 898 const std::string& instancePublicId, |
891 FileContentType content, | 899 FileContentType content, |
892 bool uncompressIfNeeded) | 900 bool uncompressIfNeeded) |
893 { | 901 { |
899 " of instance " + instancePublicId); | 907 " of instance " + instancePublicId); |
900 } | 908 } |
901 | 909 |
902 assert(attachment.GetContentType() == content); | 910 assert(attachment.GetContentType() == content); |
903 | 911 |
904 if (uncompressIfNeeded) | 912 { |
905 { | |
906 ReadAttachment(result, attachment); | |
907 } | |
908 else | |
909 { | |
910 // Do not uncompress the content of the storage area, return the | |
911 // raw data | |
912 StorageAccessor accessor(area_, GetMetricsRegistry()); | 913 StorageAccessor accessor(area_, GetMetricsRegistry()); |
913 accessor.ReadRaw(result, attachment); | 914 |
914 } | 915 if (uncompressIfNeeded) |
915 } | 916 { |
916 | 917 accessor.Read(result, attachment); |
917 | 918 } |
918 void ServerContext::ReadAttachment(std::string& result, | 919 else |
919 const FileInfo& attachment) | 920 { |
920 { | 921 // Do not uncompress the content of the storage area, return the |
921 // This will decompress the attachment | 922 // raw data |
922 StorageAccessor accessor(area_, GetMetricsRegistry()); | 923 accessor.ReadRaw(result, attachment); |
923 accessor.Read(result, attachment); | 924 } |
925 } | |
924 } | 926 } |
925 | 927 |
926 | 928 |
927 ServerContext::DicomCacheLocker::DicomCacheLocker(ServerContext& context, | 929 ServerContext::DicomCacheLocker::DicomCacheLocker(ServerContext& context, |
928 const std::string& instancePublicId) : | 930 const std::string& instancePublicId) : |