changeset 5979:02f0953c027d

doc AcceptedSopClasses
author Alain Mazy <am@orthanc.team>
date Tue, 21 Jan 2025 10:34:09 +0100
parents 2d482a49232e
children f9ed33728c28
files OrthancServer/Resources/Configuration.json OrthancServer/UnitTestsSources/ServerConfigTests.cpp
diffstat 2 files changed, 39 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/Configuration.json	Mon Jan 20 10:15:03 2025 +0100
+++ b/OrthancServer/Resources/Configuration.json	Tue Jan 21 10:34:09 2025 +0100
@@ -207,11 +207,22 @@
   // to all storage classes defined in DCMTK in case of 
   // C-STORE SCP and to a reduced list of 120 common storage
   // classes in case of C-GET SCU.
+  // List of DCMTK default Storage SOP Classes:
+  // https://github.com/DCMTK/dcmtk/blob/410ffe2019b9db6a8f4036daac742a6f5e4d36c2/dcmdata/libsrc/dcuid.cc#L664
   // Each entry can contain wildcards ("?" or "*") to add
-  // subsets of SOP classes that are defined in DCMTK.
+  // subsets of SOP classes that are defined in DCMTK defaults.
+  // "?" accepts any single character at that position.
+  // "*" accepts any string value at that position.
   // If you want to add a a SOP class that is not defined in
-  // DCMTK, you must add it explicitely.
+  // DCMTK defaults, you must add it explicitely.
   // (new in Orthanc 1.12.6)
+  // Example to add a non standard class
+  // and keep the default ones:
+  // "AcceptedSopClasses" : [
+  //   "1.3.12.2.1107.5.9.1",
+  //   "1.2.840.*"
+  // ]
+  // Example to limit to 2 SOP Classes:
   // "AcceptedSopClasses" : [
   //   "1.2.840.10008.5.1.4.1.1.2",
   //   "1.2.840.10008.5.1.4.1.1.4"
--- a/OrthancServer/UnitTestsSources/ServerConfigTests.cpp	Mon Jan 20 10:15:03 2025 +0100
+++ b/OrthancServer/UnitTestsSources/ServerConfigTests.cpp	Tue Jan 21 10:34:09 2025 +0100
@@ -143,6 +143,32 @@
       ASSERT_TRUE(s.find("1.2.3.4") != s.end());
     }
 
+    { // accept the default ones + a custom one
+      acceptedStorageClasses.clear();
+      acceptedStorageClasses.push_back("1.2.840.*");
+      acceptedStorageClasses.push_back("1.2.3.4");
+      rejectedStorageClasses.clear();
+      context.SetAcceptedSopClasses(acceptedStorageClasses, rejectedStorageClasses);
+
+      context.GetAcceptedSopClasses(s, 0);
+      ASSERT_LE(100u, s.size());
+      ASSERT_TRUE(s.find("1.2.3.4") != s.end());
+      ASSERT_TRUE(s.find("1.2.840.10008.5.1.4.1.1.12.2.1") != s.end());
+    }
+
+    { // test the ? in regex to replace a single char
+      acceptedStorageClasses.clear();
+      acceptedStorageClasses.push_back("1.2.840.10008.5.1.4.1.1.12.2.?");
+      acceptedStorageClasses.push_back("1.2.3.4");
+      rejectedStorageClasses.clear();
+      context.SetAcceptedSopClasses(acceptedStorageClasses, rejectedStorageClasses);
+
+      context.GetAcceptedSopClasses(s, 0);
+      ASSERT_EQ(2u, s.size());
+      ASSERT_TRUE(s.find("1.2.3.4") != s.end());
+      ASSERT_TRUE(s.find("1.2.840.10008.5.1.4.1.1.12.2.1") != s.end());
+    }
+
   }
 
   context.Stop();