# HG changeset patch # User Sebastien Jodogne # Date 1780378916 -7200 # Node ID ce2494cb70ad39cc81c806d11346f3046449210f # Parent 26f91b7e621dbd30d55d70109f3c7526bdbdc36f# Parent 4d044e9e0da1a1b8a00a29b0b03145cdd0b5e52c integration mainline->streaming diff -r 26f91b7e621d -r ce2494cb70ad NEWS --- a/NEWS Tue Jun 02 07:40:35 2026 +0200 +++ b/NEWS Tue Jun 02 07:41:56 2026 +0200 @@ -27,6 +27,7 @@ * The "LocalAet" field of the payload to "/modalities/../move", "/modalities/../store", "/modalities/../get", "queries/../answers/../retrieve" now always overwrites the "DicomAet" and the "DicomModalities.LocalAet" configurations. +* Optimized the "/patients|studies|series|instances/../statistics" routes. Maintenance @@ -39,6 +40,8 @@ * Fix usage of "LocalAet" in C-Find and "queries/../answers/../retrieve". * Fix Orthanc::ImageAccessor that was broken in Orthanc Framework 1.12.11 * Fix a memory leak in C-GET (https://github.com/orthanc-server/orthanc-builder/issues/36) +* Fix slow ingest of files containing huge arrays of float/double values in their + DICOM tags (https://discourse.orthanc-server.org/t/orthanc-1-12-11-performance-issues-with-deformable-registrations/6448) * Fix a Denial of Service via Deeply Nested DICOM Sequences https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=258 Security issue reported by Jose Lopez Martinez (aka elpe_pinillo) from Deloitte. diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Resources/CMake/DownloadPackage.cmake --- a/OrthancFramework/Resources/CMake/DownloadPackage.cmake Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Resources/CMake/DownloadPackage.cmake Tue Jun 02 07:41:56 2026 +0200 @@ -92,7 +92,7 @@ set(TMP_PATH "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${TMP_FILENAME}") if (NOT EXISTS "${TMP_PATH}") - message("Downloading ${Url}") + message("Downloading ${Url} since the file was not found in ${TMP_PATH}") # This fixes issue 6: "I think cmake shouldn't download the # packages which are not in the system, it should stop and let diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/DicomFormat/DicomArray.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomArray.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomArray.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -83,7 +83,7 @@ void DicomArray::Print(FILE* fp) const { - for (size_t i = 0; i < elements_.size(); i++) + for (size_t i = 0; i < elements_.size(); i++) { DicomTag t = elements_[i]->GetTag(); const DicomValue& v = elements_[i]->GetValue(); @@ -103,7 +103,7 @@ s = v.GetContent(); } - printf("0x%04x 0x%04x [%s]\n", t.GetGroup(), t.GetElement(), s.c_str()); + fprintf(fp, "0x%04x 0x%04x [%s]\n", t.GetGroup(), t.GetElement(), s.c_str()); } } } diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -634,8 +634,8 @@ { target.SetValueInternal(element->getTag().getGTag(), element->getTag().getETag(), - ConvertLeafElement(*element, DicomToJsonFlags_Default, maxStringLength, encoding, - hasCodeExtensions, ignoreTagLength, Convert(element->getVR()))); + ConvertLeafElement(*element, DicomToJsonFlags_Default, maxStringLength, maxStringLength /* maxBinaryArrayLength: consider the same value as the maxStringLength */, + encoding, hasCodeExtensions, ignoreTagLength, Convert(element->getVR()))); } else { @@ -694,6 +694,7 @@ DicomValue* FromDcmtkBridge::ConvertLeafElement(DcmElement& element, DicomToJsonFlags flags, unsigned int maxStringLength, + unsigned int maxBinaryArrayLength, Encoding encoding, bool hasCodeExtensions, const std::set& ignoreTagLength, @@ -894,8 +895,21 @@ throw OrthancException(ErrorCode_BadFileFormat); } - const unsigned long numFloats = element.getLength() / sizeof(Float32); + uint64_t numFloats = static_cast(element.getLength()) / sizeof(Float32); + numFloats = std::min(numFloats, static_cast(maxBinaryArrayLength)); + + uint64_t preAllocateStringSize = static_cast(maxStringLength); // We have seen files with 100M floats: https://discourse.orthanc-server.org/t/orthanc-1-12-11-performance-issues-with-deformable-registrations/6448 + if (maxStringLength == 0) // no limit, use an heuristic to reserve the string: 12 chars per float + { + preAllocateStringSize = 12ull * numFloats; + if (preAllocateStringSize > static_cast(std::numeric_limits::max())) + { + throw OrthancException(ErrorCode_BadFileFormat, "Too many values in binary array"); + } + } + std::string result; + result.reserve(static_cast(preAllocateStringSize)); for (unsigned long i = 0; i < numFloats; i++) { if (i > 0) @@ -927,8 +941,21 @@ throw OrthancException(ErrorCode_BadFileFormat); } - const unsigned long numDoubles = element.getLength() / sizeof(Float64); + uint64_t numDoubles = static_cast(element.getLength()) / sizeof(Float64); + numDoubles = std::min(numDoubles, static_cast(maxBinaryArrayLength)); + + uint64_t preAllocateStringSize = static_cast(maxStringLength); // We have seen files with 100M floats: https://discourse.orthanc-server.org/t/orthanc-1-12-11-performance-issues-with-deformable-registrations/6448 + if (maxStringLength == 0) // no limit, use an heuristic to reserve the string: 20 chars per float + { + preAllocateStringSize = 20ull * numDoubles; + if (preAllocateStringSize > static_cast(std::numeric_limits::max())) + { + throw OrthancException(ErrorCode_BadFileFormat, "Too many values in binary array"); + } + } + std::string result; + result.reserve(static_cast(preAllocateStringSize)); for (unsigned long i = 0; i < numDoubles; i++) { if (i > 0) @@ -961,7 +988,19 @@ throw OrthancException(ErrorCode_BadFileFormat); } - const unsigned long numValues = element.getLength() / sizeof(Uint32); + uint64_t numValues = static_cast(element.getLength()) / sizeof(Uint32); + numValues = std::min(numValues, static_cast(maxBinaryArrayLength)); + + uint64_t preAllocateStringSize = static_cast(maxStringLength); // We have seen files with 100M floats: https://discourse.orthanc-server.org/t/orthanc-1-12-11-performance-issues-with-deformable-registrations/6448 + if (maxStringLength == 0) // no limit, use an heuristic to reserve the string: 10 chars per float + { + preAllocateStringSize = 10ull * numValues; + if (preAllocateStringSize > static_cast(std::numeric_limits::max())) + { + throw OrthancException(ErrorCode_BadFileFormat, "Too many values in binary array"); + } + } + std::string result; for (unsigned long i = 0; i < numValues; i++) { @@ -1203,9 +1242,14 @@ if (element.isLeaf()) { - // The "0" below lets "LeafValueToJson()" take care of "TooLong" values + // The "maxStringLength=0" below lets "LeafValueToJson()" take care of "TooLong" values + // And the "maxBinaryArrayLength=maxStringLength" is there to limit the size of binary arrays that are actually returned + // as string that is later clipped in LeafValueToJson. + // Since we have seen files with 100M float values, we don't want to generate a 1GB string that would be clipped to 256 bytes + // in LeafValueToJson. + // https://discourse.orthanc-server.org/t/orthanc-1-12-11-performance-issues-with-deformable-registrations/6448 std::unique_ptr v(FromDcmtkBridge::ConvertLeafElement - (element, flags, 0, encoding, hasCodeExtensions, ignoreTagLength, Convert(element.getVR()))); + (element, flags, 0, maxStringLength /* maxBinaryArrayLength: consider the same value as the maxStringLength */, encoding, hasCodeExtensions, ignoreTagLength, Convert(element.getVR()))); if (ignoreTagLength.find(GetTag(element)) == ignoreTagLength.end()) { diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Tue Jun 02 07:41:56 2026 +0200 @@ -190,6 +190,7 @@ static DicomValue* ConvertLeafElement(DcmElement& element, DicomToJsonFlags flags, unsigned int maxStringLength, + unsigned int maxBinaryArrayLength, Encoding encoding, bool hasCodeExtensions, const std::set& ignoreTagLength, diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp --- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -892,7 +892,7 @@ std::set tmp; std::unique_ptr v(FromDcmtkBridge::ConvertLeafElement (*element, DicomToJsonFlags_Default, - 0, encoding, hasCodeExtensions, tmp, FromDcmtkBridge::Convert(element->getVR()))); + 0, 0, encoding, hasCodeExtensions, tmp, FromDcmtkBridge::Convert(element->getVR()))); if (v.get() == NULL || v->IsNull()) diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/MetricsRegistry.cpp --- a/OrthancFramework/Sources/MetricsRegistry.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/MetricsRegistry.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -152,7 +152,7 @@ } break; default: - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "Unsupported metrics policy"); } } @@ -179,7 +179,7 @@ break; default: - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "Unsupported metrics policy"); } } diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/OrthancException.cpp diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/RestApi/RestApiOutput.cpp --- a/OrthancFramework/Sources/RestApi/RestApiOutput.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/RestApi/RestApiOutput.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -212,7 +212,7 @@ value.find(";") != std::string::npos || value.find(" ") != std::string::npos) { - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "Cookies may not contain space or semicolon"); } CheckStatus(); diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/Toolbox.cpp --- a/OrthancFramework/Sources/Toolbox.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/Toolbox.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -851,7 +851,7 @@ return "GB2312"; default: - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "Unsupported Boost locale encoding"); } } #endif diff -r 26f91b7e621d -r ce2494cb70ad OrthancFramework/Sources/Toolbox.h --- a/OrthancFramework/Sources/Toolbox.h Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancFramework/Sources/Toolbox.h Tue Jun 02 07:41:56 2026 +0200 @@ -86,7 +86,7 @@ class ORTHANC_PUBLIC MD5Context : public boost::noncopyable { private: - class PImpl; + struct PImpl; PImpl* pimpl_; // Don't use "boost::shared_ptr" here to speed up compilation time of this common header public: diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -1597,7 +1597,7 @@ } else { - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "No count support"); } } @@ -1823,7 +1823,7 @@ } else { - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "No find support"); } } diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/Database/BaseCompatibilityTransaction.cpp --- a/OrthancServer/Sources/Database/BaseCompatibilityTransaction.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/Database/BaseCompatibilityTransaction.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -32,7 +32,7 @@ int64_t increment, bool shared) { - throw OrthancException(ErrorCode_NotImplemented); // Not supported + throw OrthancException(ErrorCode_NotImplemented, "BaseCompatibilityTransaction::IncrementGlobalProperty"); // Not supported } void BaseCompatibilityTransaction::UpdateAndGetStatistics(int64_t& patientsCount, @@ -42,7 +42,7 @@ int64_t& compressedSize, int64_t& uncompressedSize) { - throw OrthancException(ErrorCode_NotImplemented); // Not supported + throw OrthancException(ErrorCode_NotImplemented, "BaseCompatibilityTransaction::UpdateAndGetStatistics"); // Not supported } void BaseCompatibilityTransaction::GetChangesExtended(std::list& target /*out*/, @@ -52,21 +52,21 @@ uint32_t limit, const std::set& filterType) { - throw OrthancException(ErrorCode_NotImplemented); // Not supported + throw OrthancException(ErrorCode_NotImplemented, "BaseCompatibilityTransaction::GetChangesExtended"); // Not supported } void BaseCompatibilityTransaction::ExecuteCount(uint64_t& count, const FindRequest& request, const IDatabaseWrapper::Capabilities& capabilities) { - throw OrthancException(ErrorCode_NotImplemented); // Not supported + throw OrthancException(ErrorCode_NotImplemented, "BaseCompatibilityTransaction::ExecuteCount"); // Not supported } void BaseCompatibilityTransaction::ExecuteFind(FindResponse& response, const FindRequest& request, const IDatabaseWrapper::Capabilities& capabilities) { - throw OrthancException(ErrorCode_NotImplemented); // Not supported + throw OrthancException(ErrorCode_NotImplemented, "BaseCompatibilityTransaction::ExecuteFind"); // Not supported } void BaseCompatibilityTransaction::ExecuteFind(std::list& identifiers, diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/Database/Compatibility/GenericFind.cpp --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -198,7 +198,7 @@ } else { - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented, "ExecuteFind - unhandled request"); } } diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -1086,20 +1086,19 @@ } - void StatelessDatabaseOperations::GetResourceStatistics(/* out */ ResourceType& type, - /* out */ uint64_t& diskSize, + void StatelessDatabaseOperations::GetResourceStatistics(/* out */ uint64_t& diskSize, /* out */ uint64_t& uncompressedSize, /* out */ unsigned int& countStudies, /* out */ unsigned int& countSeries, /* out */ unsigned int& countInstances, /* out */ uint64_t& dicomDiskSize, - /* out */ uint64_t& dicomUncompressedSize, + /* out */ uint64_t& dicomUncompressedSize, + ResourceType type, const std::string& publicId) { class Operations : public IReadOnlyOperations { private: - ResourceType& type_; uint64_t& diskSize_; uint64_t& uncompressedSize_; unsigned int& countStudies_; @@ -1108,18 +1107,20 @@ uint64_t& dicomDiskSize_; uint64_t& dicomUncompressedSize_; const std::string& publicId_; - + ResourceType type_; + const IDatabaseWrapper::Capabilities& dbCapabilities_; + public: - explicit Operations(ResourceType& type, - uint64_t& diskSize, + explicit Operations(uint64_t& diskSize, uint64_t& uncompressedSize, unsigned int& countStudies, unsigned int& countSeries, unsigned int& countInstances, uint64_t& dicomDiskSize, uint64_t& dicomUncompressedSize, - const std::string& publicId) : - type_(type), + ResourceType type, + const std::string& publicId, + const IDatabaseWrapper::Capabilities& dbCapabilities) : diskSize_(diskSize), uncompressedSize_(uncompressedSize), countStudies_(countStudies), @@ -1127,105 +1128,88 @@ countInstances_(countInstances), dicomDiskSize_(dicomDiskSize), dicomUncompressedSize_(dicomUncompressedSize), - publicId_(publicId) + publicId_(publicId), + type_(type), + dbCapabilities_(dbCapabilities) { } - + + void AddAttachmentSizes(const FindResponse::Resource& resource) + { + const std::map& attachments = resource.GetAttachments(); + + for (std::map::const_iterator it = attachments.begin(); it != attachments.end(); ++it) + { + if (it->first == FileContentType_Dicom) + { + dicomDiskSize_ += it->second.GetCompressedSize(); + dicomUncompressedSize_ += it->second.GetUncompressedSize(); + } + + diskSize_ += it->second.GetCompressedSize(); + uncompressedSize_ += it->second.GetUncompressedSize(); + } + } + virtual void Apply(ReadOnlyTransaction& transaction) ORTHANC_OVERRIDE { - int64_t top; - if (!transaction.LookupResource(top, type_, publicId_)) - { - throw OrthancException(ErrorCode_UnknownResource); - } - else + countInstances_ = 0; + countSeries_ = 0; + countStudies_ = 0; + diskSize_ = 0; + uncompressedSize_ = 0; + dicomDiskSize_ = 0; + dicomUncompressedSize_ = 0; + + ResourceType currentLevel = type_; + bool hasProcessedInstanceLevel = false; + while (!hasProcessedInstanceLevel) { - countInstances_ = 0; - countSeries_ = 0; - countStudies_ = 0; - diskSize_ = 0; - uncompressedSize_ = 0; - dicomDiskSize_ = 0; - dicomUncompressedSize_ = 0; - - std::stack toExplore; - toExplore.push(top); - - while (!toExplore.empty()) + // get the attachments at the currentLevel (but the parent remains the same resource) + FindRequest request(currentLevel); + request.SetOrthancId(type_, publicId_); + request.SetRetrieveAttachments(true); + + FindResponse response; + transaction.ExecuteFind(response, request, dbCapabilities_); + + for (size_t i = 0; i < response.GetSize(); i++) { - // Get the internal ID of the current resource - int64_t resource = toExplore.top(); - toExplore.pop(); - - ResourceType thisType = transaction.GetResourceType(resource); - - std::set f; - transaction.ListAvailableAttachments(f, resource); - - for (std::set::const_iterator - it = f.begin(); it != f.end(); ++it) + AddAttachmentSizes(response.GetResourceByIndex(i)); + + switch (currentLevel) { - FileInfo attachment; - int64_t revision; // ignored - if (transaction.LookupAttachment(attachment, revision, resource, *it)) - { - if (attachment.GetContentType() == FileContentType_Dicom) - { - dicomDiskSize_ += attachment.GetCompressedSize(); - dicomUncompressedSize_ += attachment.GetUncompressedSize(); - } - - diskSize_ += attachment.GetCompressedSize(); - uncompressedSize_ += attachment.GetUncompressedSize(); - } - } - - if (thisType == ResourceType_Instance) - { - countInstances_++; - } - else - { - switch (thisType) - { - case ResourceType_Study: - countStudies_++; - break; - - case ResourceType_Series: - countSeries_++; - break; - - default: - break; - } - - // Tag all the children of this resource as to be explored - std::list tmp; - transaction.GetChildrenInternalId(tmp, resource); - for (std::list::const_iterator - it = tmp.begin(); it != tmp.end(); ++it) - { - toExplore.push(*it); - } + case ResourceType_Study: + ++countStudies_; + break; + case ResourceType_Series: + ++countSeries_; + break; + case ResourceType_Instance: + ++countInstances_; + break; + case ResourceType_Patient: + // don't count patients + break; + default: + throw OrthancException(ErrorCode_InternalError); } } - if (countStudies_ == 0) + if (currentLevel == ResourceType_Instance) { - countStudies_ = 1; + hasProcessedInstanceLevel = true; } - - if (countSeries_ == 0) + else { - countSeries_ = 1; + currentLevel = GetChildResourceType(currentLevel); } } } }; - Operations operations(type, diskSize, uncompressedSize, countStudies, countSeries, - countInstances, dicomDiskSize, dicomUncompressedSize, publicId); + Operations operations(diskSize, uncompressedSize, countStudies, countSeries, + countInstances, dicomDiskSize, dicomUncompressedSize, type, publicId, db_.GetDatabaseCapabilities()); Apply(operations); } diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/Database/StatelessDatabaseOperations.h --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Jun 02 07:41:56 2026 +0200 @@ -683,14 +683,14 @@ bool LookupParent(std::string& target, const std::string& publicId); - void GetResourceStatistics(/* out */ ResourceType& type, - /* out */ uint64_t& diskSize, + void GetResourceStatistics(/* out */ uint64_t& diskSize, /* out */ uint64_t& uncompressedSize, /* out */ unsigned int& countStudies, /* out */ unsigned int& countSeries, /* out */ unsigned int& countInstances, /* out */ uint64_t& dicomDiskSize, /* out */ uint64_t& dicomUncompressedSize, + ResourceType type, const std::string& publicId); void LookupIdentifierExact(std::vector& result, diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -1616,6 +1616,7 @@ } + template static void GetResourceStatistics(RestApiGetCall& call) { const ResourceType level = GetResourceTypeFromUri(call); @@ -1672,13 +1673,12 @@ std::string publicId = call.GetUriComponent("id", ""); - ResourceType type; uint64_t diskSize, uncompressedSize, dicomDiskSize, dicomUncompressedSize; unsigned int countStudies, countSeries, countInstances; + OrthancRestApi::GetIndex(call).GetResourceStatistics( - type, diskSize, uncompressedSize, countStudies, countSeries, - countInstances, dicomDiskSize, dicomUncompressedSize, publicId); - + diskSize, uncompressedSize, countStudies, countSeries, + countInstances, dicomDiskSize, dicomUncompressedSize, resourceType, publicId); Json::Value result = Json::objectValue; result["DiskSize"] = boost::lexical_cast(diskSize); result["DiskSizeMB"] = static_cast(diskSize / MEGABYTE); @@ -1690,7 +1690,7 @@ result["DicomUncompressedSize"] = boost::lexical_cast(dicomUncompressedSize); result["DicomUncompressedSizeMB"] = static_cast(dicomUncompressedSize / MEGABYTE); - switch (type) + switch (resourceType) { // Do NOT add "break" below this point! case ResourceType_Patient: @@ -4305,13 +4305,13 @@ Register("/series/{id}", GetSingleResource); Register("/studies/{id}", GetSingleResource); - Register("/instances/{id}/statistics", GetResourceStatistics); + Register("/instances/{id}/statistics", GetResourceStatistics); if (context_.IsPatientLevelEnabled()) { - Register("/patients/{id}/statistics", GetResourceStatistics); + Register("/patients/{id}/statistics", GetResourceStatistics); } - Register("/studies/{id}/statistics", GetResourceStatistics); - Register("/series/{id}/statistics", GetResourceStatistics); + Register("/studies/{id}/statistics", GetResourceStatistics); + Register("/series/{id}/statistics", GetResourceStatistics); if (context_.IsPatientLevelEnabled()) { diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/Search/DatabaseLookup.cpp --- a/OrthancServer/Sources/Search/DatabaseLookup.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/Search/DatabaseLookup.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -111,7 +111,7 @@ std::set ignoreTagLength; std::unique_ptr value(FromDcmtkBridge::ConvertLeafElement - (*element, DicomToJsonFlags_None, 0, encoding, hasCodeExtensions, + (*element, DicomToJsonFlags_None, 0, 0, encoding, hasCodeExtensions, ignoreTagLength, FromDcmtkBridge::Convert(element->getVR()))); // WARNING: Also modify "HierarchicalMatcher::Setup()" if modifying this code diff -r 26f91b7e621d -r ce2494cb70ad OrthancServer/Sources/Search/HierarchicalMatcher.cpp --- a/OrthancServer/Sources/Search/HierarchicalMatcher.cpp Tue Jun 02 07:40:35 2026 +0200 +++ b/OrthancServer/Sources/Search/HierarchicalMatcher.cpp Tue Jun 02 07:41:56 2026 +0200 @@ -114,7 +114,7 @@ std::set ignoreTagLength; std::unique_ptr value(FromDcmtkBridge::ConvertLeafElement - (*element, DicomToJsonFlags_None, 0, encoding, hasCodeExtensions, + (*element, DicomToJsonFlags_None, 0, 0, encoding, hasCodeExtensions, ignoreTagLength, FromDcmtkBridge::Convert(element->getVR()))); // WARNING: Also modify "DatabaseLookup::IsMatch()" if modifying this code