Mercurial > hg > orthanc-dicomweb
changeset 771:e83719c40138
new configuration option "OtherBinaryMode"
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 07 Jul 2026 13:48:26 +0200 |
| parents | d7e2afd17a3b |
| children | 217ad391163a |
| files | NEWS Plugin/Configuration.cpp Plugin/Configuration.h Plugin/DicomWebFormatter.cpp Plugin/DicomWebFormatter.h |
| diffstat | 5 files changed, 102 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Jul 07 13:34:44 2026 +0200 +++ b/NEWS Tue Jul 07 13:48:26 2026 +0200 @@ -1,9 +1,16 @@ Pending changes in the mainline =============================== +* New configuration option "OtherBinaryMode" to control how OB, OD, + OF, OL, OV, or OW value representations are encoded in WADO-RS + responses. Possible values: "BulkDataURI" (new default), + "InlineBinary", "ArrayOfValues". Previous releases used the + "ArrayOfValues" mode, which was valid but could be problematic for + large datasets. (contribution by Yusuf Sayita, Philips) * Clarified error message when trying to access a single frame from a video in WADO-RS. * Fixed rendering of multiframe RGB48 images (TODO: requires the latest OrthancFramework) + Version 1.23 (2026-04-15) =========================
--- a/Plugin/Configuration.cpp Tue Jul 07 13:34:44 2026 +0200 +++ b/Plugin/Configuration.cpp Tue Jul 07 13:48:26 2026 +0200 @@ -43,6 +43,7 @@ static std::unique_ptr<OrthancPlugins::OrthancConfiguration> globalConfiguration_; static bool serversInDatabase_ = false; static const int32_t GLOBAL_PROPERTY_SERVERS = 5468; +static OrthancPluginDicomWebBinaryMode otherBinaryMode_ = OrthancPluginDicomWebBinaryMode_BulkDataUri; namespace OrthancPlugins @@ -299,6 +300,15 @@ } } + + static std::string GetStringValue(const std::string& key, + const std::string& defaultValue) + { + assert(dicomWebConfiguration_.get() != NULL); + return dicomWebConfiguration_->GetStringValue(key, defaultValue); + } + + void Initialize() { dicomWebConfiguration_.reset(new OrthancConfiguration); @@ -337,14 +347,44 @@ GetExtrapolatedMetadataTags(tags, Orthanc::ResourceType_Series); LoadMainDicomTags(globalConfiguration_->GetJson()); - } + { + // New in DICOMweb 1.24 + static const std::string OTHER_BINARY_MODE = "OtherBinaryMode"; + static const std::string BULK_DATA_URI = "BulkDataURI"; + static const std::string INLINE_BINARY = "InlineBinary"; + static const std::string ARRAY_OF_VALUES = "ArrayOfValues"; + + std::string value = GetStringValue(OTHER_BINARY_MODE, BULK_DATA_URI); - std::string GetStringValue(const std::string& key, - const std::string& defaultValue) - { - assert(dicomWebConfiguration_.get() != NULL); - return dicomWebConfiguration_->GetStringValue(key, defaultValue); + if (value == BULK_DATA_URI) + { + otherBinaryMode_ = OrthancPluginDicomWebBinaryMode_BulkDataUri; + } + else if (value == INLINE_BINARY) + { + otherBinaryMode_ = OrthancPluginDicomWebBinaryMode_InlineBinary; + } + else if (value == ARRAY_OF_VALUES) + { +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 12) + printf("******* ICI\n"); + otherBinaryMode_ = OrthancPluginDicomWebBinaryMode_ArrayOfValues; +#else + LOG(WARNING) << "You need to compile the DICOMweb plugin against Orthanc SDK >= 1.12.12 to use the \"" + << ARRAY_OF_VALUES << "\" value in option \"" << OTHER_BINARY_MODE + << "\", fallback to default \"" << BULK_DATA_URI << "\""; + otherBinaryMode_ = OrthancPluginDicomWebBinaryMode_BulkDataUri; +#endif + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange, + "Bad value for option \"" + OTHER_BINARY_MODE + "\"" + ": Should be either \"" + BULK_DATA_URI + "\" or \"" + + INLINE_BINARY + "\" or \"" + ARRAY_OF_VALUES + "\""); + } + } } @@ -845,5 +885,11 @@ } } } + + + OrthancPluginDicomWebBinaryMode GetOtherBinaryMode() + { + return otherBinaryMode_; + } } }
--- a/Plugin/Configuration.h Tue Jul 07 13:34:44 2026 +0200 +++ b/Plugin/Configuration.h Tue Jul 07 13:48:26 2026 +0200 @@ -148,5 +148,7 @@ bool IsReadOnly(); bool IsPerformanceLogsEnabled(); + + OrthancPluginDicomWebBinaryMode GetOtherBinaryMode(); } }
--- a/Plugin/DicomWebFormatter.cpp Tue Jul 07 13:34:44 2026 +0200 +++ b/Plugin/DicomWebFormatter.cpp Tue Jul 07 13:48:26 2026 +0200 @@ -22,6 +22,7 @@ #include "DicomWebFormatter.h" +#include "Configuration.h" #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" @@ -54,11 +55,36 @@ { const DicomWebFormatter& that = *reinterpret_cast<const DicomWebFormatter*>(payload); - switch (that.mode_) + /** + * For "Other" binary VRs (OF, OD, OL) that now come through + * VisitDoubles/VisitIntegers, apply the configured otherBinaryMode_. + **/ + OrthancPluginDicomWebBinaryMode effectiveMode = that.mode_; + + if (vr == OrthancPluginValueRepresentation_OB || + vr == OrthancPluginValueRepresentation_OF || + vr == OrthancPluginValueRepresentation_OW) { + effectiveMode = that.otherBinaryMode_; + } +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 12) + else if (vr == OrthancPluginValueRepresentation_OD || + vr == OrthancPluginValueRepresentation_OL || + vr == OrthancPluginValueRepresentation_OV) + { + effectiveMode = that.otherBinaryMode_; + } +#endif + + switch (effectiveMode) + { +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 12) + case OrthancPluginDicomWebBinaryMode_ArrayOfValues: +#endif + case OrthancPluginDicomWebBinaryMode_Ignore: case OrthancPluginDicomWebBinaryMode_InlineBinary: - setter(node, that.mode_, NULL); + setter(node, effectiveMode, NULL); break; case OrthancPluginDicomWebBinaryMode_BulkDataUri: @@ -73,16 +99,25 @@ uri += "/" + FormatTag(tagGroup, tagElement); - setter(node, that.mode_, uri.c_str()); + setter(node, effectiveMode, uri.c_str()); break; } - default: + default: PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(Orthanc::ErrorCode_ParameterOutOfRange); } } + DicomWebFormatter::DicomWebFormatter(OrthancPluginDicomWebBinaryMode mode, + const std::string& bulkRoot) : + mode_(mode), + otherBinaryMode_(Configuration::GetOtherBinaryMode()), + bulkRoot_(bulkRoot) + { + } + + void DicomWebFormatter::Apply(std::string& target, OrthancPluginContext* context, const void* data,
--- a/Plugin/DicomWebFormatter.h Tue Jul 07 13:34:44 2026 +0200 +++ b/Plugin/DicomWebFormatter.h Tue Jul 07 13:48:26 2026 +0200 @@ -39,6 +39,7 @@ { private: OrthancPluginDicomWebBinaryMode mode_; + OrthancPluginDicomWebBinaryMode otherBinaryMode_; std::string bulkRoot_; static void Callback(OrthancPluginDicomWebNode *node, @@ -53,11 +54,7 @@ void* payload); DicomWebFormatter(OrthancPluginDicomWebBinaryMode mode, - const std::string& bulkRoot) : - mode_(mode), - bulkRoot_(bulkRoot) - { - } + const std::string& bulkRoot); public: static void Apply(std::string& target,
