changeset 5179:1e406c23b352

added unit test DicomMap.SetupFindTemplates
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 25 Mar 2023 11:11:11 +0100
parents 02c7e4aa7946
children d2626a062809
files OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/UnitTestsSources/DicomMapTests.cpp
diffstat 2 files changed, 99 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Sat Mar 25 10:47:29 2023 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Sat Mar 25 11:11:11 2023 +0100
@@ -76,7 +76,8 @@
     DICOM_TAG_STUDY_DESCRIPTION,
     DICOM_TAG_ACCESSION_NUMBER,
     DICOM_TAG_STUDY_INSTANCE_UID,
-    // New in db v6
+    
+    // New in db v6 (Orthanc 0.9.5)
     DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION,
     DICOM_TAG_INSTITUTION_NAME,
     DICOM_TAG_REQUESTING_PHYSICIAN,
@@ -103,7 +104,7 @@
     DICOM_TAG_NUMBER_OF_TIME_SLICES,
     DICOM_TAG_SERIES_INSTANCE_UID,
 
-    // New in db v6
+    // New in db v6 (Orthanc 0.9.5)
     DICOM_TAG_IMAGE_ORIENTATION_PATIENT,
     DICOM_TAG_SERIES_TYPE,
     DICOM_TAG_OPERATOR_NAME,
@@ -123,7 +124,7 @@
     DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER,
     DICOM_TAG_SOP_INSTANCE_UID,
 
-    // New in db v6
+    // New in db v6 (Orthanc 0.9.5)
     DICOM_TAG_IMAGE_POSITION_PATIENT,
     DICOM_TAG_IMAGE_COMMENTS,
 
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Sat Mar 25 10:47:29 2023 +0100
+++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Sat Mar 25 11:11:11 2023 +0100
@@ -1066,6 +1066,101 @@
 }
 
 
+TEST(DicomMap, SetupFindTemplates)
+{
+  /**
+   * The templates for C-FIND must be common to all the Orthanc
+   * servers, and must not be altered by the "ExtraMainDicomTags"
+   * configuration option that was introduced in Orthanc 1.11.0.
+   **/
+  
+  {
+    DicomMap m;
+    DicomMap::SetupFindPatientTemplate(m);
+    std::set<DicomTag> tags;
+    m.GetTags(tags);
+
+    // This corresponds to the values of DEFAULT_PATIENT_MAIN_DICOM_TAGS
+    ASSERT_EQ(5u, tags.size());
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false));
+
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_OTHER_PATIENT_IDS, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_BIRTH_DATE, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_NAME, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_SEX, "nope", false));
+  }
+  
+  {
+    DicomMap m;
+    DicomMap::SetupFindStudyTemplate(m);
+    std::set<DicomTag> tags;
+    m.GetTags(tags);
+
+    // This corresponds to the values of DEFAULT_STUDY_MAIN_DICOM_TAGS
+    ASSERT_EQ(8u, tags.size());
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACCESSION_NUMBER, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_INSTANCE_UID, "nope", false));
+
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_REFERRING_PHYSICIAN_NAME, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_DATE, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_DESCRIPTION, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_ID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_TIME, "nope", false));
+  }
+  
+  {
+    DicomMap m;
+    DicomMap::SetupFindSeriesTemplate(m);
+    std::set<DicomTag> tags;
+    m.GetTags(tags);
+
+    // This corresponds to the values of DEFAULT_SERIES_MAIN_DICOM_TAGS
+    ASSERT_EQ(13u, tags.size());
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACCESSION_NUMBER, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_INSTANCE_UID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_INSTANCE_UID, "nope", false));
+
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_BODY_PART_EXAMINED, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_MODALITY, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_OPERATOR_NAME, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PROTOCOL_NAME, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_DATE, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_DESCRIPTION, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_NUMBER, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_TIME, "nope", false));
+  }
+  
+  {
+    DicomMap m;
+    DicomMap::SetupFindInstanceTemplate(m);
+    std::set<DicomTag> tags;
+    m.GetTags(tags);
+
+    // This corresponds to the values of DEFAULT_INSTANCE_MAIN_DICOM_TAGS
+    ASSERT_EQ(15u, tags.size());
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACCESSION_NUMBER, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_INSTANCE_UID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_INSTANCE_UID, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SOP_INSTANCE_UID, "nope", false));
+
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACQUISITION_NUMBER, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_COMMENTS, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_INDEX, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_POSITION_PATIENT, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_INSTANCE_CREATION_DATE, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_INSTANCE_CREATION_TIME, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_INSTANCE_NUMBER, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_NUMBER_OF_FRAMES, "nope", false));
+    ASSERT_EQ("", m.GetStringValue(DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, "nope", false));
+  }
+}
+
+
 #if ORTHANC_SANDBOXED != 1
 
 #include "../Sources/SystemToolbox.h"