changeset 4516:671ee7c1fd46

added DicomToJsonFlags_SkipGroupLengths
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 16 Feb 2021 15:01:13 +0100
parents 8734caa12448
children c494ee5d0101
files NEWS OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/Enumerations.h OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h
diffstat 6 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Feb 16 14:42:04 2021 +0100
+++ b/NEWS	Tue Feb 16 15:01:13 2021 +0100
@@ -19,6 +19,7 @@
 -------
 
 * New value in enumeration: OrthancPluginDicomToJsonFlags_StopAfterPixelData
+* New value in enumeration: OrthancPluginDicomToJsonFlags_SkipGroupLengths
 
 Maintenance
 -----------
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue Feb 16 14:42:04 2021 +0100
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue Feb 16 15:01:13 2021 +0100
@@ -1004,6 +1004,13 @@
         continue;
       }
 
+      // New flag in Orthanc 1.9.1
+      if ((flags & DicomToJsonFlags_SkipGroupLengths) &&
+          tag.GetElement() == 0x0000)
+      {
+        continue;
+      }
+
       /*element->getTag().isPrivate()*/
       if (tag.IsPrivate() &&
           !(flags & DicomToJsonFlags_IncludePrivateTags))    
--- a/OrthancFramework/Sources/Enumerations.h	Tue Feb 16 14:42:04 2021 +0100
+++ b/OrthancFramework/Sources/Enumerations.h	Tue Feb 16 15:01:13 2021 +0100
@@ -581,6 +581,7 @@
     DicomToJsonFlags_ConvertBinaryToAscii  = (1 << 4),
     DicomToJsonFlags_ConvertBinaryToNull   = (1 << 5),
     DicomToJsonFlags_StopAfterPixelData    = (1 << 6),  // New in Orthanc 1.9.1
+    DicomToJsonFlags_SkipGroupLengths      = (1 << 7),  // New in Orthanc 1.9.1
 
     // Some predefined combinations
     DicomToJsonFlags_None     = 0,
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Tue Feb 16 14:42:04 2021 +0100
+++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Tue Feb 16 15:01:13 2021 +0100
@@ -635,6 +635,7 @@
   {
     Uint8 v[2] = { 0, 0 };
     ASSERT_TRUE(f.GetDcmtkObject().getDataset()->putAndInsertString(DCM_PatientName, "HELLO^").good());
+    ASSERT_TRUE(f.GetDcmtkObject().getDataset()->putAndInsertUint32(DcmTag(0x4000, 0x0000), 42).good());
     ASSERT_TRUE(f.GetDcmtkObject().getDataset()->putAndInsertUint8Array(DCM_PixelData, v, 2).good());
     ASSERT_TRUE(f.GetDcmtkObject().getDataset()->putAndInsertString(DcmTag(0x07fe1, 0x0010), "WORLD^").good());
   }
@@ -646,14 +647,15 @@
     Json::Value v;
     f.DatasetToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePrivateTags | DicomToJsonFlags_IncludePixelData | DicomToJsonFlags_StopAfterPixelData), 0);
     ASSERT_EQ(Json::objectValue, v.type());
-    ASSERT_EQ(2u, v.size());
+    ASSERT_EQ(3u, v.size());
     ASSERT_EQ("HELLO^", v["0010,0010"].asString());
+    ASSERT_EQ("42", v["4000,0000"].asString());
     ASSERT_EQ(s, v["7fe0,0010"].asString());
   }
 
   {
     Json::Value v;
-    f.DatasetToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_IncludePrivateTags, 0);
+    f.DatasetToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePrivateTags | DicomToJsonFlags_SkipGroupLengths), 0);
     ASSERT_EQ(Json::objectValue, v.type());
     ASSERT_EQ(2u, v.size());
     ASSERT_EQ("HELLO^", v["0010,0010"].asString());
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Feb 16 14:42:04 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Feb 16 15:01:13 2021 +0100
@@ -1703,6 +1703,7 @@
         static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToNull) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToNull) ||
         static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToAscii) ||
         static_cast<int>(OrthancPluginDicomToJsonFlags_StopAfterPixelData) != static_cast<int>(DicomToJsonFlags_StopAfterPixelData) ||
+        static_cast<int>(OrthancPluginDicomToJsonFlags_SkipGroupLengths) != static_cast<int>(DicomToJsonFlags_SkipGroupLengths) ||
         static_cast<int>(OrthancPluginCreateDicomFlags_DecodeDataUriScheme) != static_cast<int>(DicomFromJsonFlags_DecodeDataUriScheme) ||
         static_cast<int>(OrthancPluginCreateDicomFlags_GenerateIdentifiers) != static_cast<int>(DicomFromJsonFlags_GenerateIdentifiers))
 
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Feb 16 14:42:04 2021 +0100
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Feb 16 15:01:13 2021 +0100
@@ -836,6 +836,7 @@
     OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii  = (1 << 4),  /*!< Output binary tags as-is, dropping non-ASCII */
     OrthancPluginDicomToJsonFlags_ConvertBinaryToNull   = (1 << 5),  /*!< Signal binary tags as null values */
     OrthancPluginDicomToJsonFlags_StopAfterPixelData    = (1 << 6),  /*!< Stop processing after pixel data (new in 1.9.1) */
+    OrthancPluginDicomToJsonFlags_SkipGroupLengths      = (1 << 7),  /*!< Skip tags whose element is zero (new in 1.9.1) */
 
     _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
   } OrthancPluginDicomToJsonFlags;