comparison OrthancFramework/Sources/DicomParsing/DicomModification.cpp @ 5334:5b2a5cc64cb1

upgraded anonymization to Basic Profile of PS 3.15-2023b Table E.1-1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Jun 2023 15:12:39 +0200
parents 0ea402b4d901
children 59e3b6f8c5be
comparison
equal deleted inserted replaced
5333:816968b5a031 5334:5b2a5cc64cb1
40 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2017c = 40 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2017c =
41 "Orthanc " ORTHANC_VERSION " - PS 3.15-2017c Table E.1-1 Basic Profile"; 41 "Orthanc " ORTHANC_VERSION " - PS 3.15-2017c Table E.1-1 Basic Profile";
42 42
43 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2021b = 43 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2021b =
44 "Orthanc " ORTHANC_VERSION " - PS 3.15-2021b Table E.1-1 Basic Profile"; 44 "Orthanc " ORTHANC_VERSION " - PS 3.15-2021b Table E.1-1 Basic Profile";
45
46 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2023b =
47 "Orthanc " ORTHANC_VERSION " - PS 3.15-2023b Table E.1-1 Basic Profile";
45 48
46 namespace Orthanc 49 namespace Orthanc
47 { 50 {
48 namespace 51 namespace
49 { 52 {
425 { 428 {
426 assert(it->second != NULL); 429 assert(it->second != NULL);
427 430
428 if (it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2008 || 431 if (it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2008 ||
429 it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2017c || 432 it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2017c ||
430 it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2021b) 433 it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2021b ||
434 it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2023b)
431 { 435 {
432 delete it->second; 436 delete it->second;
433 replacements_.erase(it); 437 replacements_.erase(it);
434 } 438 }
435 } 439 }
829 * This is Table E.1-1 from PS 3.15-2021b (DICOM Part 15: Security 833 * This is Table E.1-1 from PS 3.15-2021b (DICOM Part 15: Security
830 * and System Management Profiles), "basic profile" column. It was 834 * and System Management Profiles), "basic profile" column. It was
831 * generated automatically by calling: 835 * generated automatically by calling:
832 * "../../../OrthancServer/Resources/GenerateAnonymizationProfile.py 836 * "../../../OrthancServer/Resources/GenerateAnonymizationProfile.py
833 * https://raw.githubusercontent.com/jodogne/dicom-specification/master/2021b/part15.xml" 837 * https://raw.githubusercontent.com/jodogne/dicom-specification/master/2021b/part15.xml"
834 *
835 * http://dicom.nema.org/medical/dicom/2021b/output/chtml/part15/chapter_E.html#table_E.1-1a
836 * http://dicom.nema.org/medical/dicom/2021b/output/chtml/part15/chapter_E.html#table_E.1-1
837 **/ 838 **/
838 839
839 #include "DicomModification_Anonymization2021b.impl.h" 840 #include "DicomModification_Anonymization2021b.impl.h"
840 841
841 // Set the DeidentificationMethod tag 842 // Set the DeidentificationMethod tag
842 ReplaceInternal(DICOM_TAG_DEIDENTIFICATION_METHOD, ORTHANC_DEIDENTIFICATION_METHOD_2021b); 843 ReplaceInternal(DICOM_TAG_DEIDENTIFICATION_METHOD, ORTHANC_DEIDENTIFICATION_METHOD_2021b);
844 }
845
846
847 void DicomModification::SetupAnonymization2023b()
848 {
849 /**
850 * This is Table E.1-1 from PS 3.15-2023b (DICOM Part 15: Security
851 * and System Management Profiles), "basic profile" column. It was
852 * generated automatically by calling:
853 * "../../../OrthancServer/Resources/GenerateAnonymizationProfile.py
854 * https://raw.githubusercontent.com/jodogne/dicom-specification/master/2023b/part15.xml"
855 *
856 * http://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_E.html#table_E.1-1a
857 * http://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_E.html#table_E.1-1
858 **/
859
860 #include "DicomModification_Anonymization2023b.impl.h"
861
862 // Set the DeidentificationMethod tag
863 ReplaceInternal(DICOM_TAG_DEIDENTIFICATION_METHOD, ORTHANC_DEIDENTIFICATION_METHOD_2023b);
843 } 864 }
844 865
845 866
846 void DicomModification::SetupAnonymization(DicomVersion version) 867 void DicomModification::SetupAnonymization(DicomVersion version)
847 { 868 {
872 893
873 case DicomVersion_2021b: 894 case DicomVersion_2021b:
874 SetupAnonymization2021b(); 895 SetupAnonymization2021b();
875 break; 896 break;
876 897
898 case DicomVersion_2023b:
899 SetupAnonymization2023b();
900 break;
901
877 default: 902 default:
878 throw OrthancException(ErrorCode_ParameterOutOfRange); 903 throw OrthancException(ErrorCode_ParameterOutOfRange);
879 } 904 }
880 905
881 // Set the PatientIdentityRemoved tag 906 // Set the PatientIdentityRemoved tag
1342 1367
1343 bool force = GetBooleanValue("Force", request, false); 1368 bool force = GetBooleanValue("Force", request, false);
1344 1369
1345 // DicomVersion version = DicomVersion_2008; // For Orthanc <= 1.2.0 1370 // DicomVersion version = DicomVersion_2008; // For Orthanc <= 1.2.0
1346 // DicomVersion version = DicomVersion_2017c; // For Orthanc between 1.3.0 and 1.9.3 1371 // DicomVersion version = DicomVersion_2017c; // For Orthanc between 1.3.0 and 1.9.3
1347 DicomVersion version = DicomVersion_2021b; // For Orthanc >= 1.9.4 1372 // DicomVersion version = DicomVersion_2021b; // For Orthanc >= 1.9.4
1373 DicomVersion version = DicomVersion_2023b; // For Orthanc >= 1.12.1
1374
1348 if (request.isMember("DicomVersion")) 1375 if (request.isMember("DicomVersion"))
1349 { 1376 {
1350 if (request["DicomVersion"].type() != Json::stringValue) 1377 if (request["DicomVersion"].type() != Json::stringValue)
1351 { 1378 {
1352 throw OrthancException(ErrorCode_BadFileFormat); 1379 throw OrthancException(ErrorCode_BadFileFormat);