diff OrthancFramework/Sources/DicomParsing/DicomModification.cpp @ 4677:521e39b3f2c0

Fix issue #146 (Update Anonyization to 2019c) - was actually updated to 2021b
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 03 Jun 2021 21:06:34 +0200
parents caf963ee3de9
children 2e850edf03d6
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Jun 03 19:44:43 2021 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Jun 03 21:06:34 2021 +0200
@@ -39,6 +39,9 @@
 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2017c =
   "Orthanc " ORTHANC_VERSION " - PS 3.15-2017c Table E.1-1 Basic Profile";
 
+static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2021b =
+  "Orthanc " ORTHANC_VERSION " - PS 3.15-2021b Table E.1-1 Basic Profile";
+
 namespace Orthanc
 {
   class DicomModification::RelationshipsVisitor : public ITagVisitor
@@ -252,7 +255,8 @@
 
     if (it != replacements_.end() &&
         (it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2008 ||
-         it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2017c))
+         it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2017c ||
+         it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2021b))
     {
       delete it->second;
       replacements_.erase(it);
@@ -591,6 +595,26 @@
   }
   
 
+  void DicomModification::SetupAnonymization2021b()
+  {
+    /**
+     * This is Table E.1-1 from PS 3.15-2021b (DICOM Part 15: Security
+     * and System Management Profiles), "basic profile" column. It was
+     * generated automatically by calling:
+     * "../../../OrthancServer/Resources/GenerateAnonymizationProfile.py
+     * https://raw.githubusercontent.com/jodogne/dicom-specification/master/2021b/part15.xml"
+     *
+     * http://dicom.nema.org/medical/dicom/2021b/output/chtml/part15/chapter_E.html#table_E.1-1a
+     * http://dicom.nema.org/medical/dicom/2021b/output/chtml/part15/chapter_E.html#table_E.1-1
+     **/
+    
+#include "DicomModification_Anonymization2021b.impl.h"
+    
+    // Set the DeidentificationMethod tag
+    ReplaceInternal(DICOM_TAG_DEIDENTIFICATION_METHOD, ORTHANC_DEIDENTIFICATION_METHOD_2021b);
+  }
+  
+
   void DicomModification::SetupAnonymization(DicomVersion version)
   {
     isAnonymization_ = true;
@@ -613,6 +637,10 @@
         SetupAnonymization2017c();
         break;
 
+      case DicomVersion_2021b:
+        SetupAnonymization2021b();
+        break;
+
       default:
         throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
@@ -1029,9 +1057,9 @@
 
     bool force = GetBooleanValue("Force", request, false);
       
-    // As of Orthanc 1.3.0, the default anonymization is done
-    // according to PS 3.15-2017c Table E.1-1 (basic profile)
-    DicomVersion version = DicomVersion_2017c;
+    // DicomVersion version = DicomVersion_2008;   // For Orthanc <= 1.2.0
+    // DicomVersion version = DicomVersion_2017c;  // For Orthanc between 1.3.0 and 1.9.3
+    DicomVersion version = DicomVersion_2021b;     // For Orthanc >= 1.9.4
     if (request.isMember("DicomVersion"))
     {
       if (request["DicomVersion"].type() != Json::stringValue)