comparison OrthancServer/Sources/ServerContext.cpp @ 5333:816968b5a031

speeded up ServerContext::ReadDicomUntilPixelData() if storage compression is on
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Jun 2023 10:39:17 +0200
parents 808319c1e22b
children 5b2a5cc64cb1
comparison
equal deleted inserted replaced
5332:f5cb6310e0dc 5333:816968b5a031
1142 } 1142 }
1143 1143
1144 bool ServerContext::ReadDicomUntilPixelData(std::string& dicom, 1144 bool ServerContext::ReadDicomUntilPixelData(std::string& dicom,
1145 const std::string& instancePublicId) 1145 const std::string& instancePublicId)
1146 { 1146 {
1147 if (!area_.HasReadRange())
1148 {
1149 return false;
1150 }
1151
1152 FileInfo attachment; 1147 FileInfo attachment;
1153 int64_t revision; // Ignored 1148 int64_t revision; // Ignored
1149 if (index_.LookupAttachment(attachment, revision, instancePublicId, FileContentType_DicomUntilPixelData))
1150 {
1151 StorageAccessor accessor(area_, storageCache_, GetMetricsRegistry());
1152
1153 accessor.Read(dicom, attachment);
1154 assert(dicom.size() == attachment.GetUncompressedSize());
1155
1156 return true;
1157 }
1158
1159 if (!area_.HasReadRange())
1160 {
1161 return false;
1162 }
1163
1154 if (!index_.LookupAttachment(attachment, revision, instancePublicId, FileContentType_Dicom)) 1164 if (!index_.LookupAttachment(attachment, revision, instancePublicId, FileContentType_Dicom))
1155 { 1165 {
1156 throw OrthancException(ErrorCode_InternalError, 1166 throw OrthancException(ErrorCode_InternalError,
1157 "Unable to read the DICOM file of instance " + instancePublicId); 1167 "Unable to read the DICOM file of instance " + instancePublicId);
1158 } 1168 }