changeset 6957:17dba3e3c7e4 streaming

integration mainline -> streaming
author Alain Mazy <am@orthanc.team>
date Thu, 18 Jun 2026 17:04:38 +0200
parents 2b7c43addced (current diff) cd1a8195a03c (diff)
children 7b52e79a4aca
files NEWS OrthancServer/UnitTestsSources/UnitTestsMain.cpp
diffstat 16 files changed, 587 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Jun 17 18:00:52 2026 +0200
+++ b/NEWS	Thu Jun 18 17:04:38 2026 +0200
@@ -40,7 +40,6 @@
     A new "--logs-no-context" command line option can be used to get back to the previous behavior to
     keep backward compatibility and reduce the lines length.
 
-
 REST API
 --------
 
@@ -58,12 +57,14 @@
 Plugin SDK
 ----------
 
-* Added OrthancPluginClearCurrentThreadName() to avoid storing thousands of thread
+* Added OrthancPluginClearCurrentThreadName() to avoid storing many thread
   names when dynamically creating/killing threads in a plugin.
+* Added OD, OL, UC, UR, OV, SV, and UV values to the OrthancPluginValueRepresentation enumeration
 
 Maintenance
 -----------
 
+* Added internal support for OV, SV, and UV value representations
 * Fix resubmit/pause/cancel and reloading of OrthancPeerStore and DicomModalityStore jobs 
   (bug introduced in 1.12.10)
 * Fix OrthancPeerStore jobs that was using the loader threads only if transcoding
@@ -78,6 +79,8 @@
   https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=258
   Security issue reported by Jose Lopez Martinez (aka elpe_pinillo) from Deloitte.
 * Fixed various OOB read/write (TODO: finalize release notes)
+* Improved preview and rendering of multiframe instances a with a Color Lookup Table; 
+  notably, some cardiac US instances.
 * Lua: Fix the "ReceivedCStoreInstanceFilter" Lua callback whose return value was
   not taken into account.
 * Upgraded dependencies for static builds:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Resources/CheckValueRepresentations.py	Thu Jun 18 17:04:38 2026 +0200
@@ -0,0 +1,239 @@
+#!/usr/bin/env python3
+
+# Orthanc - A Lightweight, RESTful DICOM Store
+# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+# Department, University Hospital of Liege, Belgium
+# Copyright (C) 2017-2023 Osimis S.A., Belgium
+# Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+# Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+
+
+import lxml.etree
+import os
+import re
+import requests
+
+
+##
+## Download and parse the part of the DICOM spec containing the value
+## representations as XML
+##
+
+SOURCE = 'https://dicom.nema.org/medical/dicom/current/source/docbook/part05/part05.xml'
+TMP = '/tmp/dicom.xml'
+
+BASE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')
+
+if not os.path.isfile(TMP):
+    r = requests.get(SOURCE)
+    r.raise_for_status()
+    with open(TMP, 'wb') as f:
+        f.write(r.content)
+
+
+with open(TMP, 'rb') as f:
+    doc = lxml.etree.fromstring(f.read())
+
+
+# Grab the default namespace from the document root
+default_ns = doc.nsmap.get(None)  # e.g. "http://docbook.org/ns/docbook"
+
+ns = {
+    'xml': 'http://www.w3.org/XML/1998/namespace',
+    'db': default_ns,
+}
+
+
+
+##
+## Locate the list of all the VRs
+##
+
+table = doc.xpath('//*[@xml:id="table_6.2-1"]', namespaces=ns)
+
+all_vrs = table[0].xpath('.//db:tbody/db:tr/db:td[1]/db:para[1]/text()', namespaces=ns)
+
+
+##
+## Check for the enumerations
+##
+
+print('\nChecking Enumerations.h')
+
+vrs = []
+names = []
+
+with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'Enumerations.h'), 'r') as f:
+    for line in f.read().splitlines():
+        if 'ValueRepresentation_' in line:
+            m = re.search(r'(ValueRepresentation_.+?)\s*=.*// ([A-Z][A-Z])', line)
+            if m != None:
+                names.append(m.group(1))
+                vrs.append(m.group(2))
+
+for vr in all_vrs:
+    if not vr in vrs:
+        print('  - Value representation not defined:', vr)
+
+
+
+with open(os.path.join(BASE, 'OrthancServer', 'Plugins', 'Include', 'orthanc', 'OrthancCPlugin.h'), 'r') as f:
+    content = f.read()
+
+    print('\nChecking OrthancCPlugin.h')
+
+    func = re.search(r'OrthancPluginValueRepresentation.*?_OrthancPluginValueRepresentation_INTERNAL', content, re.DOTALL).group(0)
+
+    for vr in vrs:
+        if not ('OrthancPluginValueRepresentation_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+
+with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'Enumerations.cpp'), 'r') as f:
+    content = f.read()
+
+    print('\nChecking EnumerationToString()')
+
+    func = re.search(r'EnumerationToString\(ValueRepresentation.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('case %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+    for vr in vrs:
+        if not ('return "%s"' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+    print('\nChecking StringToValueRepresentation()')
+
+    func = re.search(r'StringToValueRepresentation\(.*?throw OrthancException', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('return %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+    for vr in vrs:
+        if not ('== "%s"' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+    print('\nChecking IsBinaryValueRepresentation()')
+
+    func = re.search(r'IsBinaryValueRepresentation\(.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('case %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+
+
+with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'DicomFormat', 'DicomMap.cpp'), 'r') as f:
+    content = f.read()
+
+    print('\nChecking DicomMap::ValidateTag()')
+
+    func = re.search(r'ValidateTag\(.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('case %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+
+
+with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'DicomParsing', 'FromDcmtkBridge.cpp'), 'r') as f:
+    content = f.read()
+
+    print('\nChecking FromDcmtkBridge::Convert()')
+
+    func = re.search(r'ValueRepresentation FromDcmtkBridge::Convert.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('return %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+    for vr in vrs:
+        if not ('case EVR_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+    print('\nChecking FromDcmtkBridge::ConvertLeafElement()')
+
+    func = re.search(r'FromDcmtkBridge::ConvertLeafElement.*?default', content, re.DOTALL).group(0)
+    for vr in vrs:
+        if not ('case EVR_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+    print('\nChecking FromDcmtkBridge::FillElementWithString()')
+
+    func = re.search(r'FromDcmtkBridge::FillElementWithString.*?boost::bad_lexical_cast', content, re.DOTALL).group(0)
+    for vr in vrs:
+        if not ('case EVR_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+    print('\nChecking FromDcmtkBridge::ApplyVisitorToLeaf()')
+
+    func = re.search(r'ApplyVisitorToLeaf.*?boost::bad_lexical_cast', content, re.DOTALL).group(0)
+    for vr in vrs:
+        if not ('case EVR_%s' % vr) and not ('== EVR_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+
+with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'DicomParsing', 'ToDcmtkBridge.cpp'), 'r') as f:
+    content = f.read()
+
+    print('\nChecking ToDcmtkBridge::Convert()')
+
+    func = re.search(r'ToDcmtkBridge::Convert\(ValueRepresentation.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('case %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+    for vr in vrs:
+        if not ('EVR_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+
+with open(os.path.join(BASE, 'OrthancServer', 'Plugins', 'Engine', 'PluginsEnumerations.cpp'), 'r') as f:
+    content = f.read()
+
+    print('\nChecking ConvertToDcmtkBridge::Convert(ValueRepresentation)')
+
+    func = re.search(r'OrthancPluginValueRepresentation Convert\(ValueRepresentation.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('case %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+    for vr in vrs:
+        if not ('return OrthancPluginValueRepresentation_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+    print('\nChecking ConvertToDcmtkBridge::Convert(OrthancPluginValueRepresentation)')
+
+    func = re.search(r'ValueRepresentation Convert\(OrthancPluginValueRepresentation.*?default', content, re.DOTALL).group(0)
+    for name in names:
+        if not ('return %s' % name) in func:
+            print('  - Value representation not handled:', name)
+
+    for vr in vrs:
+        if not ('case OrthancPluginValueRepresentation_%s' % vr) in func:
+            print('  - Value representation not handled:', vr)
+
+
+print('\nDone\n')
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -988,6 +988,15 @@
       case ValueRepresentation_UnlimitedText:
         return value.size() <= (static_cast<uint64_t>(1) << 32) - 2;
 
+      case ValueRepresentation_OtherVeryLong:
+        return true;
+
+      case ValueRepresentation_SignedVeryLong:
+        return value.size() == 8;
+
+      case ValueRepresentation_UnsignedVeryLong:
+        return value.size() == 8;
+
       default:
         // Assume unsupported tags are OK
         return true;
--- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -457,6 +457,7 @@
            vr == ValueRepresentation_OtherFloat ||
            vr == ValueRepresentation_OtherLong ||
            vr == ValueRepresentation_OtherWord ||
+           vr == ValueRepresentation_OtherVeryLong ||
            vr == ValueRepresentation_Unknown);
 
     if (tag.GetElement() != 0x0000)
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -823,6 +823,8 @@
         case EVR_UT:  // unlimited text
         case EVR_PN:  // person name
         case EVR_UI:  // unique identifier
+        case EVR_UR:  // URI / URL
+        case EVR_UC:  // Unlimited Characters
         case EVR_UNKNOWN: // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR)
         case EVR_UNKNOWN2B:  // used internally for elements with unknown VR with 2-byte length field in explicit VR
         {
@@ -2030,6 +2032,7 @@
 
 #if DCMTK_VERSION_NUMBER >= 362
       case EVR_OL:
+        // Even though EVR_OL was introduced in DCMTK 3.6.1, its implementation was broken
         return ValueRepresentation_OtherLong;
 #endif
 
@@ -2082,7 +2085,23 @@
       case EVR_UT:
         return ValueRepresentation_UnlimitedText;
 
+#if DCMTK_VERSION_NUMBER >= 365
+      case EVR_OV:
+        return ValueRepresentation_OtherVeryLong;
+#endif
+
+#if DCMTK_VERSION_NUMBER >= 365
+      case EVR_SV:
+        return ValueRepresentation_SignedVeryLong;
+#endif
+
+#if DCMTK_VERSION_NUMBER >= 365
+      case EVR_UV:
+        return ValueRepresentation_UnsignedVeryLong;
+#endif
+
       default:
+        // This notably happens if the version of DCMTK is too old
         return ValueRepresentation_NotSupported;
     }
   }
@@ -3067,6 +3086,8 @@
         case EVR_UT:  // unlimited text
         case EVR_PN:  // person name
         case EVR_UI:  // unique identifier
+        case EVR_UR:  // URI / URL
+        case EVR_UC:  // Unlimited Characters
         {
           Uint8* data = NULL;
           
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -404,9 +404,11 @@
                                           const DicomImageInformation& info,
                                           DcmDataset& dataset,
                                           const uint8_t* pixelData,
-                                          unsigned long pixelLength)
+                                          unsigned long pixelDataLength,
+                                          unsigned int numberOfFramesInPixelData,
+                                          unsigned int frameToDecode)
   {
-    LOG(INFO) << "Decoding a lookup table";
+    // LOG(INFO) << "Decoding a lookup table";
 
     OFString r, g, b;
     PixelFormat format;
@@ -417,14 +419,19 @@
     unsigned long gc = 0;
     unsigned long bc = 0;
 
-    if (pixelData == NULL &&
-        !dataset.findAndGetUint8Array(DCM_PixelData, pixelData, &pixelLength).good())
+    // note: info.GetNumberOfFrames() is not reliable when a single frame has been uncompressed but, in this case, we provide a pixelData and we must use numberOfFramesInPixelData
+    // If there are no pixelData, numberOfFramesInPixelData is set to 0 and we must use info.GetNumberOfFrames()
+    if (pixelData == NULL)
     {
-      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
+      numberOfFramesInPixelData = info.GetNumberOfFrames();
+      if (!dataset.findAndGetUint8Array(DCM_PixelData, pixelData, &pixelDataLength).good())
+      {
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
+      }
     }
 
     if (info.IsPlanar() ||
-        info.GetNumberOfFrames() != 1 ||
+        // info.GetNumberOfFrames() != 1 ||
         !info.ExtractPixelFormat(format, false) ||
         !dataset.findAndGetOFStringArray(DCM_BluePaletteColorLookupTableDescriptor, b).good() ||
         !dataset.findAndGetOFStringArray(DCM_GreenPaletteColorLookupTableDescriptor, g).good() ||
@@ -443,6 +450,29 @@
       throw OrthancException(ErrorCode_NotImplemented, "Inconsistent Palette Color Lookup Table");
     }
 
+    const uint64_t width = target->GetWidth();
+    const uint64_t height = target->GetHeight();
+
+    uint64_t frameSize = width * height * GetBytesPerPixel(target->GetFormat());
+
+    if (frameSize > MAX_IMAGE_FRAME_SIZE ||
+        static_cast<uint64_t>(static_cast<size_t>(frameSize)) != frameSize)
+    {
+      std::ostringstream errorMessage;
+      errorMessage << "DecodeLookupTable: max decoded frame size overflow  (" << frameSize << " vs. " << MAX_IMAGE_FRAME_SIZE << ")";
+      throw OrthancException(ErrorCode_BadFileFormat, errorMessage.str());
+    }
+
+    uint64_t frameEnd = frameSize * (frameToDecode + 1);
+
+    if (static_cast<uint64_t>(static_cast<size_t>(frameEnd)) != frameEnd)
+    {
+      std::ostringstream errorMessage;
+      errorMessage << "DecodeLookupTable: frameEnd larger than 4GB, which is too large for Orthanc running in 32bits (" << frameEnd << ")"; // can only happen on 32 bits
+      throw OrthancException(ErrorCode_BadFileFormat, errorMessage.str());
+    }
+
+
     switch (format)
     {
       case PixelFormat_RGB24:
@@ -472,10 +502,10 @@
           throw OrthancException(ErrorCode_NotImplemented, std::string("Palette Color Lookup Table Descriptor invalid palette size: '") + r.c_str() + "'");
         }
 
-        const uint64_t expectedSize = (static_cast<uint64_t>(target->GetWidth()) *
-                                       static_cast<uint64_t>(target->GetHeight()));
+        const uint64_t expectedFrameSourceSize = (static_cast<uint64_t>(target->GetWidth()) *
+                                                  static_cast<uint64_t>(target->GetHeight()));
         
-        if (pixelLength != expectedSize)
+        if (pixelDataLength != (expectedFrameSourceSize * numberOfFramesInPixelData))
         {
           DcmElement *elem = NULL;
           Uint16 bitsAllocated = 0;
@@ -496,15 +526,13 @@
           // seen in some Philips ClearVue 650 images (using 8 bits LUT)
           if (elem->getVR() != EVR_OW ||
               bitsAllocated != 8 ||
-              2 * pixelLength != expectedSize)
+              2 * pixelDataLength != (expectedFrameSourceSize * numberOfFramesInPixelData))
           {
             throw OrthancException(ErrorCode_BadFileFormat, "Invalid size");
           }
         }
 
-        const uint8_t* source = reinterpret_cast<const uint8_t*>(pixelData);
-        const unsigned int width = target->GetWidth();
-        const unsigned int height = target->GetHeight();
+        const uint8_t* source = reinterpret_cast<const uint8_t*>(pixelData + expectedFrameSourceSize * frameToDecode);
         
         for (unsigned int y = 0; y < height; y++)
         {
@@ -530,20 +558,24 @@
 
       case PixelFormat_RGB48:
       {
-        const uint64_t expectedSize = static_cast<uint64_t>(target->GetWidth()) * target->GetHeight() * 2;
+        const uint64_t expectedFrameSourceSize = static_cast<uint64_t>(target->GetWidth()) * target->GetHeight() * 2;
+
+        if ((expectedFrameSourceSize * numberOfFramesInPixelData) != pixelDataLength)
+        {
+          throw OrthancException(ErrorCode_InternalError, std::string("Palette Color Lookup Table Descriptor: invalid image size"));
+        }
 
         if (r != "0\\0\\16" ||
             rc != 65536 ||
             gc != 65536 ||
-            bc != 65536 ||
-            pixelLength != expectedSize)
+            bc != 65536)
         {
           throw OrthancException(ErrorCode_NotImplemented, std::string("Palette Color Lookup Table Descriptor not supported: '") + r.c_str() + "'");
         }
 
-        const uint16_t* source = reinterpret_cast<const uint16_t*>(pixelData);
         const unsigned int width = target->GetWidth();
         const unsigned int height = target->GetHeight();
+        const uint16_t* source = reinterpret_cast<const uint16_t*>(pixelData + expectedFrameSourceSize * frameToDecode);
         
         for (unsigned int y = 0; y < height; y++)
         {
@@ -597,7 +629,7 @@
 
     if (info.GetPhotometricInterpretation() == PhotometricInterpretation_Palette)
     {
-      return DecodeLookupTable(target, info, dataset, NULL, 0);
+      return DecodeLookupTable(target, info, dataset, NULL, 0, 0 /* we don't know the number of frames in the buffer */, frame);
     }       
 
 
@@ -809,7 +841,7 @@
 
       return DecodeLookupTable(target, info, dataset,
                                reinterpret_cast<const uint8_t*>(uncompressed.c_str()),
-                               uncompressed.size());
+                               uncompressed.size(), 1 /* a single frame has been decoded */, 0 /* decode the first frame of this buffer*/);
     }
     else
     {
--- a/OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -75,16 +75,23 @@
       case ValueRepresentation_OtherByte:
         return EVR_OB;
 
-        // Not supported as of DCMTK 3.6.0
-        /*case ValueRepresentation_OtherDouble:
-          return EVR_OD;*/
+      case ValueRepresentation_OtherDouble:
+ #if DCMTK_VERSION_NUMBER >= 361
+        return EVR_OD;
+#else
+        throw OrthancException(ErrorCode_NotImplemented, "OD value representation is not supported, as using DCMTK <= 3.6.0");
+#endif
 
       case ValueRepresentation_OtherFloat:
         return EVR_OF;
 
-        // Not supported as of DCMTK 3.6.0
-        /*case ValueRepresentation_OtherLong:
-          return EVR_OL;*/
+      case ValueRepresentation_OtherLong:
+#if DCMTK_VERSION_NUMBER >= 362
+        return EVR_OL;
+#else
+        // Even though EVR_OL was introduced in DCMTK 3.6.1, its implementation was broken
+        throw OrthancException(ErrorCode_NotImplemented, "OL value representation is not supported, as using DCMTK <= 3.6.1");
+#endif
 
       case ValueRepresentation_OtherWord:
         return EVR_OW;
@@ -110,9 +117,12 @@
       case ValueRepresentation_Time:
         return EVR_TM;
 
-        // Not supported as of DCMTK 3.6.0
-        /*case ValueRepresentation_UnlimitedCharacters:
-          return EVR_UC;*/
+      case ValueRepresentation_UnlimitedCharacters:
+#if DCMTK_VERSION_NUMBER >= 361
+        return EVR_UC;
+#else
+        throw OrthancException(ErrorCode_NotImplemented, "UC value representation is not supported, as using DCMTK <= 3.6.0");
+#endif
 
       case ValueRepresentation_UniqueIdentifier:
         return EVR_UI;
@@ -123,9 +133,12 @@
       case ValueRepresentation_Unknown:
         return EVR_UN;
 
-        // Not supported as of DCMTK 3.6.0
-        /*case ValueRepresentation_UniversalResource:
-          return EVR_UR;*/
+      case ValueRepresentation_UniversalResource:
+#if DCMTK_VERSION_NUMBER >= 361
+        return EVR_UR;
+#else
+        throw OrthancException(ErrorCode_NotImplemented, "UR value representation is not supported, as using DCMTK <= 3.6.0");
+#endif
 
       case ValueRepresentation_UnsignedShort:
         return EVR_US;
@@ -133,6 +146,27 @@
       case ValueRepresentation_UnlimitedText:
         return EVR_UT;
 
+      case ValueRepresentation_OtherVeryLong:
+#if DCMTK_VERSION_NUMBER >= 365
+        return EVR_OV;
+#else
+        throw OrthancException(ErrorCode_NotImplemented, "OV value representation is not supported, as using DCMTK <= 3.6.4");
+#endif
+
+      case ValueRepresentation_SignedVeryLong:
+#if DCMTK_VERSION_NUMBER >= 365
+        return EVR_SV;
+#else
+        throw OrthancException(ErrorCode_NotImplemented, "SV value representation is not supported, as using DCMTK <= 3.6.4");
+#endif
+
+      case ValueRepresentation_UnsignedVeryLong:
+#if DCMTK_VERSION_NUMBER >= 365
+        return EVR_UV;
+#else
+        throw OrthancException(ErrorCode_NotImplemented, "UV value representation is not supported, as using DCMTK <= 3.6.4");
+#endif
+
       default:
         throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
--- a/OrthancFramework/Sources/Enumerations.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/Enumerations.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -984,6 +984,15 @@
       case ValueRepresentation_UnlimitedText:         // UT
         return "UT";
 
+      case ValueRepresentation_OtherVeryLong:         // OV (new in Orthanc 1.12.12)
+        return "OV";
+
+      case ValueRepresentation_SignedVeryLong:        // SV (new in Orthanc 1.12.12)
+        return "SV";
+
+      case ValueRepresentation_UnsignedVeryLong:      // UV (new in Orthanc 1.12.12)
+        return "UV";
+
       case ValueRepresentation_NotSupported:
         return "Not supported";
 
@@ -1496,6 +1505,18 @@
     {
       return ValueRepresentation_UnlimitedText;
     }
+    else if (vr == "OV")
+    {
+      return ValueRepresentation_OtherVeryLong;
+    }
+    else if (vr == "SV")
+    {
+      return ValueRepresentation_SignedVeryLong;
+    }
+    else if (vr == "UV")
+    {
+      return ValueRepresentation_UnsignedVeryLong;
+    }
     else
     {
       std::string s = "Unsupported value representation encountered: " + vr;
@@ -2393,6 +2414,9 @@
       case ValueRepresentation_UnsignedLong:          // UL (uint32_t)
       case ValueRepresentation_Unknown:               // UN
       case ValueRepresentation_UnsignedShort:         // US (uint16_t)
+      case ValueRepresentation_OtherVeryLong:         // OL (8 bytes)
+      case ValueRepresentation_SignedVeryLong:        // SL (int64_t)
+      case ValueRepresentation_UnsignedVeryLong:      // UL (uint64_t)
       {
         return true;
       }
--- a/OrthancFramework/Sources/Enumerations.h	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/Enumerations.h	Thu Jun 18 17:04:38 2026 +0200
@@ -613,7 +613,11 @@
     ValueRepresentation_UniversalResource = 29,    // UR (URI or URL)
     ValueRepresentation_UnsignedShort = 30,        // US (uint16_t)
     ValueRepresentation_UnlimitedText = 31,        // UT
-    ValueRepresentation_NotSupported               // Not supported by Orthanc, or tag not in dictionary
+    ValueRepresentation_OtherVeryLong = 32,        // OV (8 bytes, new in Orthanc 1.12.12)
+    ValueRepresentation_SignedVeryLong = 33,       // SV (int64_t, new in Orthanc 1.12.12)
+    ValueRepresentation_UnsignedVeryLong = 34,     // UV (uint64_t, new in Orthanc 1.12.12)
+
+    ValueRepresentation_NotSupported               // Not supported by Orthanc, or tag not in dictionary (must be the last one)
   };
 
   enum DicomReplaceMode
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -166,11 +166,11 @@
   }
 
 
-  template <typename TargetType>
+  template <typename TargetType, typename SourceType>
   static void ConvertColorToGrayscale(ImageAccessor& target,
                                       const ImageAccessor& source)
   {
-    assert(source.GetFormat() == PixelFormat_RGB24);
+    assert(source.GetFormat() == PixelFormat_RGB24 || source.GetFormat() == PixelFormat_RGB48);
 
     // WARNING - "::min()" should be replaced by "::lowest()" if
     // dealing with float or double (which is not the case so far)
@@ -184,7 +184,7 @@
     for (unsigned int y = 0; y < height; y++)
     {
       TargetType* t = reinterpret_cast<TargetType*>(target.GetRow(y));
-      const uint8_t* s = reinterpret_cast<const uint8_t*>(source.GetConstRow(y));
+      const SourceType* s = reinterpret_cast<const SourceType*>(source.GetConstRow(y));
 
       for (unsigned int x = 0; x < width; x++, t++, s += 3)
       {
@@ -724,21 +724,35 @@
     if (target.GetFormat() == PixelFormat_Grayscale8 &&
         source.GetFormat() == PixelFormat_RGB24)
     {
-      ConvertColorToGrayscale<uint8_t>(target, source);
+      ConvertColorToGrayscale<uint8_t, uint8_t>(target, source);
       return;
     }
 
     if (target.GetFormat() == PixelFormat_Grayscale16 &&
         source.GetFormat() == PixelFormat_RGB24)
     {
-      ConvertColorToGrayscale<uint16_t>(target, source);
+      ConvertColorToGrayscale<uint16_t, uint8_t>(target, source);
+      return;
+    }
+
+    if (target.GetFormat() == PixelFormat_Grayscale16 &&
+        source.GetFormat() == PixelFormat_RGB48)
+    {
+      ConvertColorToGrayscale<uint16_t, uint16_t>(target, source);
+      return;
+    }
+
+    if (target.GetFormat() == PixelFormat_Grayscale8 &&
+        source.GetFormat() == PixelFormat_RGB48)
+    {
+      ConvertColorToGrayscale<uint8_t, uint16_t>(target, source);
       return;
     }
 
     if (target.GetFormat() == PixelFormat_SignedGrayscale16 &&
         source.GetFormat() == PixelFormat_RGB24)
     {
-      ConvertColorToGrayscale<int16_t>(target, source);
+      ConvertColorToGrayscale<int16_t, uint8_t>(target, source);
       return;
     }
 
@@ -1097,6 +1111,12 @@
         Set(image, v, v, v, v);  // Use the color version
         return;
       }
+      case PixelFormat_RGB48:
+      {
+        uint16_t v = static_cast<uint16_t>(value);
+        SetUint16(image, v, v, v, v);  // Use the color version
+        return;
+      }
 
       default:
         THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
@@ -1171,6 +1191,49 @@
     }
   }
 
+
+  void ImageProcessing::SetUint16(ImageAccessor& image,
+                                  uint16_t red,
+                                  uint16_t green,
+                                  uint16_t blue,
+                                  uint16_t alpha)
+  {
+    uint16_t p[4];
+    unsigned int size;
+
+    switch (image.GetFormat())
+    {
+      case PixelFormat_RGB48:
+        p[0] = red;
+        p[1] = green;
+        p[2] = blue;
+        size = 3;
+        break;
+
+      default:
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
+    }
+
+    const unsigned int width = image.GetWidth();
+    const unsigned int height = image.GetHeight();
+
+    for (unsigned int y = 0; y < height; y++)
+    {
+      uint16_t* q = reinterpret_cast<uint16_t*>(image.GetRow(y));
+
+      for (unsigned int x = 0; x < width; x++)
+      {
+        for (unsigned int i = 0; i < size; i++)
+        {
+          q[i] = p[i];
+        }
+
+        q += size;
+      }
+    }
+  }
+
+
   void ImageProcessing::Set(ImageAccessor& image,
                             uint8_t red,
                             uint8_t green,
--- a/OrthancFramework/Sources/Images/ImageProcessing.h	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageProcessing.h	Thu Jun 18 17:04:38 2026 +0200
@@ -101,6 +101,12 @@
                     uint8_t blue,
                     uint8_t alpha);
 
+    static void SetUint16(ImageAccessor& image,
+                          uint16_t red,
+                          uint16_t green,
+                          uint16_t blue,
+                          uint16_t alpha);
+
     static void Set(ImageAccessor& image,
                     uint8_t red,
                     uint8_t green,
--- a/OrthancServer/Plugins/Engine/PluginsEnumerations.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancServer/Plugins/Engine/PluginsEnumerations.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -400,16 +400,29 @@
         case OrthancPluginValueRepresentation_UT:
           return ValueRepresentation_UnlimitedText;
 
+        case OrthancPluginValueRepresentation_OD:
+          return ValueRepresentation_OtherDouble;
+
+        case OrthancPluginValueRepresentation_OL:
+          return ValueRepresentation_OtherLong;
+
+        case OrthancPluginValueRepresentation_UC:
+          return ValueRepresentation_UnlimitedCharacters;
+
+        case OrthancPluginValueRepresentation_UR:
+          return ValueRepresentation_UniversalResource;
+
+        case OrthancPluginValueRepresentation_OV:
+          return ValueRepresentation_OtherVeryLong;
+
+        case OrthancPluginValueRepresentation_SV:
+          return ValueRepresentation_SignedVeryLong;
+
+        case OrthancPluginValueRepresentation_UV:
+          return ValueRepresentation_UnsignedVeryLong;
+
         default:
           throw OrthancException(ErrorCode_ParameterOutOfRange);
-
-          /*
-          Not supported as of DCMTK 3.6.0:
-          return ValueRepresentation_OtherDouble
-          return ValueRepresentation_OtherLong
-          return ValueRepresentation_UniversalResource
-          return ValueRepresentation_UnlimitedCharacters
-          */
       }
     }
 
@@ -499,13 +512,26 @@
         case ValueRepresentation_Unknown:
           return OrthancPluginValueRepresentation_UN;  // Unknown
 
-          // These VR are not supported as of DCMTK 3.6.0, so they are
-          // mapped to "UN" (unknown) VR in the plugins
         case ValueRepresentation_OtherDouble:          
+          return OrthancPluginValueRepresentation_OD;
+
         case ValueRepresentation_OtherLong:
-        case ValueRepresentation_UniversalResource:
+          return OrthancPluginValueRepresentation_OL;
+
         case ValueRepresentation_UnlimitedCharacters:
-          return OrthancPluginValueRepresentation_UN;
+          return OrthancPluginValueRepresentation_UC;
+
+        case ValueRepresentation_UniversalResource:
+          return OrthancPluginValueRepresentation_UR;
+
+        case ValueRepresentation_OtherVeryLong:
+          return OrthancPluginValueRepresentation_OV;
+
+        case ValueRepresentation_SignedVeryLong:
+          return OrthancPluginValueRepresentation_SV;
+
+        case ValueRepresentation_UnsignedVeryLong:
+          return OrthancPluginValueRepresentation_UV;
 
         default:
           throw OrthancException(ErrorCode_ParameterOutOfRange);
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Thu Jun 18 17:04:38 2026 +0200
@@ -883,7 +883,7 @@
 
 
   /**
-   * The value representations present in the DICOM standard (version 2013).
+   * The value representations present in the DICOM standard.
    * @ingroup Toolbox
    **/
   typedef enum
@@ -915,6 +915,13 @@
     OrthancPluginValueRepresentation_UN = 25,  /*!< Unknown */
     OrthancPluginValueRepresentation_US = 26,  /*!< Unsigned Short */
     OrthancPluginValueRepresentation_UT = 27,  /*!< Unlimited Text */
+    OrthancPluginValueRepresentation_OD = 28,  /*!< Other Double           (new in Orthanc 1.12.12) */
+    OrthancPluginValueRepresentation_OL = 29,  /*!< Other Long             (new in Orthanc 1.12.12) */
+    OrthancPluginValueRepresentation_UC = 30,  /*!< Unlimited Characters   (new in Orthanc 1.12.12) */
+    OrthancPluginValueRepresentation_UR = 31,  /*!< URI / URL              (new in Orthanc 1.12.12) */
+    OrthancPluginValueRepresentation_OV = 32,  /*!< Other Very Long        (new in Orthanc 1.12.12) */
+    OrthancPluginValueRepresentation_SV = 33,  /*!< Signed Very Long       (new in Orthanc 1.12.12) */
+    OrthancPluginValueRepresentation_UV = 34,  /*!< Unsigned Very Long     (new in Orthanc 1.12.12) */
 
     _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
   } OrthancPluginValueRepresentation;
--- a/OrthancServer/Plugins/Samples/Common/OrthancPluginException.h	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginException.h	Thu Jun 18 17:04:38 2026 +0200
@@ -40,14 +40,30 @@
 #  define ORTHANC_PLUGINS_GET_ERROR_CODE(code)  ::OrthancPluginErrorCode_ ## code
 #endif
 
+#if HAS_ORTHANC_EXCEPTION == 1 && defined(__ORTHANC_FILE__)   // the OrthancException accepts a detail argument -> add the file and line number
+#  define PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE_HELPER(line) #line
+#  define PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(line) PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE_HELPER(line)
+#  define PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(errorCode)                    \
+    throw ::Orthanc::OrthancException(                                               \
+      errorCode, #errorCode " triggered from " __ORTHANC_FILE__ ":"       \
+      PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(__LINE__))
 
-#define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code)                   \
-  throw ORTHANC_PLUGINS_EXCEPTION_CLASS(static_cast<ORTHANC_PLUGINS_ERROR_ENUMERATION>(code));
+#  define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code)                   \
+  PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(static_cast<ORTHANC_PLUGINS_ERROR_ENUMERATION>(code))    
 
+#  define ORTHANC_PLUGINS_THROW_EXCEPTION(code)                           \
+  PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(ORTHANC_PLUGINS_GET_ERROR_CODE(code))    
 
-#define ORTHANC_PLUGINS_THROW_EXCEPTION(code)                           \
-  throw ORTHANC_PLUGINS_EXCEPTION_CLASS(ORTHANC_PLUGINS_GET_ERROR_CODE(code));
-                                                  
+#else // the PluginException does not accept a detail argument
+#  define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code)                   \
+    throw ORTHANC_PLUGINS_EXCEPTION_CLASS(static_cast<ORTHANC_PLUGINS_ERROR_ENUMERATION>(code));
+
+#  define PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(errorCode)                 \
+     ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(errorCode) 
+
+#  define ORTHANC_PLUGINS_THROW_EXCEPTION(code)                           \
+    throw ORTHANC_PLUGINS_EXCEPTION_CLASS(ORTHANC_PLUGINS_GET_ERROR_CODE(code));
+#endif                                                  
 
 #define ORTHANC_PLUGINS_CHECK_ERROR(code)                           \
   if (code != ORTHANC_PLUGINS_GET_ERROR_CODE(Success))              \
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -227,7 +227,7 @@
         .SetDescription("Trigger C-ECHO SCU command against the DICOM modality whose identifier is provided in URL: "
                         "https://orthanc.uclouvain.be/book/users/rest.html#performing-c-echo")
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the C-ECHO command, in seconds.  Orthanc will close the DICOM association if no C-ECHO answer is received within this time period.", false)
+                         "DICOM SCU Timeout for this C-ECHO command, in seconds.  Orthanc will close the DICOM association if no C-ECHO answer is received within this time period.", false)
         .SetUriArgument("id", "Identifier of the modality of interest");
       return;
     }
@@ -683,7 +683,7 @@
         .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
                          "Local AET that is used for this commands, defaults to `DicomAet` configuration option or `LocalAet` in the `DicomModalities`. ", false)
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the C-FIND command and subsequent C-GET/C-MOVE retrievals, in seconds (new in Orthanc 1.9.1).  Orthanc will close the related DICOM associations if no DICOM messages are received within this time period.", false)
+                         "DICOM SCU Timeout for this C-FIND command and subsequent C-GET/C-MOVE retrievals, in seconds (new in Orthanc 1.9.1).  Orthanc will close the related DICOM associations if no DICOM messages are received within this time period.", false)
         .SetAnswerField("ID", RestApiCallDocumentation::Type_String,
                         "Identifier of the query, to be used with `/queries/{id}`")
         .SetAnswerField("Path", RestApiCallDocumentation::Type_String,
@@ -1033,7 +1033,7 @@
                        "AET of the target modality. By default, the AET of Orthanc is used, as defined in the "
                        "`DicomAet` configuration option.", false)
       .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                       "Timeout for the C-MOVE command, in seconds.  Orthanc will close the DICOM association if no DICOM messages (e.g., C-STORE sub-operations or responses) are received within this time period.", false)
+                       "DICOM SCU Timeout for this C-MOVE or C-GET command, in seconds.  Orthanc will close the DICOM association if no DICOM messages (e.g., C-STORE sub-operations or responses) are received within this time period.", false)
       .SetRequestField(KEY_RETRIEVE_METHOD, RestApiCallDocumentation::Type_String,
                         "Force usage of C-MOVE or C-GET to retrieve the resource.  If note defined in the payload, "
                         "the retrieve method is defined in the DicomDefaultRetrieveMethod configuration or in "
@@ -1246,7 +1246,7 @@
         .SetRequestField(KEY_QUERY, RestApiCallDocumentation::Type_JsonObject,
                          "Associative array containing the filter on the values of the DICOM tags", true)
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the C-FIND command, in seconds (new in Orthanc 1.9.1)", false)
+                         "DICOM SCU Timeout for this C-FIND command, in seconds (new in Orthanc 1.9.1)", false)
         .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
                         "Identifier of the query, to be used with `/queries/{id}`")
         .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
@@ -1503,7 +1503,7 @@
                          "Whether to chain C-STORE with DICOM storage commitment to validate the success of the transmission: "
                          "https://orthanc.uclouvain.be/book/users/storage-commitment.html#chaining-c-store-with-storage-commitment", false)
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the C-STORE command, in seconds.  Orthanc will close the DICOM association if no DICOM messages (e.g., C-STORE responses) are received within this time period.", false)
+                         "DICOM SCU Timeout for this C-STORE command, in seconds.  Orthanc will close the DICOM association if no DICOM messages (e.g., C-STORE responses) are received within this time period.", false)
         .SetUriArgument("id", "Identifier of the modality of interest");
       return;
     }
@@ -1671,7 +1671,7 @@
                          "Target AET that will be used by the remote DICOM modality as a target for its C-STORE SCU "
                          "commands, defaults to `DicomAet` configuration option in order to do a simple query/retrieve", false)
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the C-MOVE command, in seconds.  Orthanc will close the DICOM association if no DICOM messages (e.g., C-STORE sub-operations or responses) are received within this time period.", false)
+                         "DICOM SCU Timeout for this C-MOVE command, in seconds.  Orthanc will close the DICOM association if no DICOM messages (e.g., C-STORE sub-operations or responses) are received within this time period.", false)
         .SetUriArgument("id", "Identifier of the modality of interest");
       return;
     }
@@ -1720,7 +1720,7 @@
         .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
                          "Local AET that is used for this commands, defaults to `DicomAet` configuration option or `LocalAet` in the `DicomModalities`. ", false)
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the C-GET command, in seconds.  Orthanc will close the DICOM association if no DICOM messages are received within this time period.", false)
+                         "DICOM SCU Timeout for this C-GET command, in seconds.  Orthanc will close the DICOM association if no DICOM messages are received within this time period.", false)
         .SetUriArgument("id", "Identifier of the modality of interest");
       return;
     }
@@ -2363,7 +2363,7 @@
                          "be checked by storage commitment. This is a list of JSON objects that must contain the "
                          "`SOPClassUID` and `SOPInstanceUID` fields.", true)
         .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
-                         "Timeout for the storage commitment command (new in Orthanc 1.9.1)", false)
+                         "DICOM SCU Timeout for this storage commitment command (new in Orthanc 1.9.1)", false)
         .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
                         "Identifier of the storage commitment report, to be used with `/storage-commitment/{id}`")
         .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
--- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp	Wed Jun 17 18:00:52 2026 +0200
+++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp	Thu Jun 18 17:04:38 2026 +0200
@@ -151,8 +151,9 @@
   ASSERT_EQ(1, ValueRepresentation_ApplicationEntity);
   ASSERT_EQ(1, OrthancPluginValueRepresentation_AE);
 
-  for (int i = ValueRepresentation_ApplicationEntity;
-       i <= ValueRepresentation_NotSupported; i++)
+  ASSERT_EQ(35, ValueRepresentation_NotSupported);  // New enum values were added, update this test
+
+  for (int i = ValueRepresentation_ApplicationEntity; i <= ValueRepresentation_NotSupported; i++)
   {
     ValueRepresentation vr = static_cast<ValueRepresentation>(i);
 
@@ -161,26 +162,45 @@
       ASSERT_THROW(ToDcmtkBridge::Convert(vr), OrthancException);
       ASSERT_THROW(Plugins::Convert(vr), OrthancException);
     }
-    else if (vr == ValueRepresentation_OtherDouble || 
-             vr == ValueRepresentation_OtherLong ||
-             vr == ValueRepresentation_UniversalResource ||
-             vr == ValueRepresentation_UnlimitedCharacters)
-    {
-      // These VR are not supported as of DCMTK 3.6.0
-      ASSERT_THROW(ToDcmtkBridge::Convert(vr), OrthancException);
-      ASSERT_EQ(OrthancPluginValueRepresentation_UN, Plugins::Convert(vr));
-    }
     else
     {
-      ASSERT_EQ(vr, FromDcmtkBridge::Convert(ToDcmtkBridge::Convert(vr)));
+      bool skip = false;
+
+#if DCMTK_VERSION_NUMBER < 361
+      if (i == ValueRepresentation_OtherDouble ||
+          i == ValueRepresentation_UnlimitedCharacters ||
+          i == ValueRepresentation_UniversalResource)
+      {
+        skip = true;
+      }
+#endif
 
-      OrthancPluginValueRepresentation plugins = Plugins::Convert(vr);
-      ASSERT_EQ(vr, Plugins::Convert(plugins));
+#if DCMTK_VERSION_NUMBER < 362
+      if (i == ValueRepresentation_OtherLong)
+      {
+        skip = true;
+      }
+#endif
+
+#if DCMTK_VERSION_NUMBER < 365
+      if (i == ValueRepresentation_OtherVeryLong ||
+          i == ValueRepresentation_SignedVeryLong ||
+          i == ValueRepresentation_UnsignedVeryLong)
+      {
+        skip = true;
+      }
+#endif
+
+      if (!skip)
+      {
+        ASSERT_EQ(vr, FromDcmtkBridge::Convert(ToDcmtkBridge::Convert(vr)));
+        OrthancPluginValueRepresentation plugins = Plugins::Convert(vr);
+        ASSERT_EQ(vr, Plugins::Convert(plugins));
+      }
     }
   }
 
-  for (int i = OrthancPluginValueRepresentation_AE;
-       i <= OrthancPluginValueRepresentation_UT; i++)
+  for (int i = OrthancPluginValueRepresentation_AE; i <= OrthancPluginValueRepresentation_UV; i++)
   {
     OrthancPluginValueRepresentation plugins = static_cast<OrthancPluginValueRepresentation>(i);
     ValueRepresentation orthanc = Plugins::Convert(plugins);