Mercurial > hg > orthanc
comparison UnitTestsSources/DicomMapTests.cpp @ 1785:c131566b8252 dcmtk-3.6.1
integration mainline->dcmtk-3.6.1
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 18 Nov 2015 10:16:21 +0100 |
parents | ec66a16aa398 |
children | e39716f71d67 |
comparison
equal
deleted
inserted
replaced
1639:1b82bb0446d2 | 1785:c131566b8252 |
---|---|
34 #include "gtest/gtest.h" | 34 #include "gtest/gtest.h" |
35 | 35 |
36 #include "../Core/Uuid.h" | 36 #include "../Core/Uuid.h" |
37 #include "../Core/OrthancException.h" | 37 #include "../Core/OrthancException.h" |
38 #include "../Core/DicomFormat/DicomMap.h" | 38 #include "../Core/DicomFormat/DicomMap.h" |
39 #include "../Core/DicomFormat/DicomNullValue.h" | |
40 #include "../OrthancServer/FromDcmtkBridge.h" | 39 #include "../OrthancServer/FromDcmtkBridge.h" |
41 | 40 |
42 #include <memory> | 41 #include <memory> |
43 | 42 |
44 using namespace Orthanc; | 43 using namespace Orthanc; |
101 | 100 |
102 ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_ID)); | 101 ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_ID)); |
103 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID"); | 102 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID"); |
104 ASSERT_TRUE(m.HasTag(0x0010, 0x0020)); | 103 ASSERT_TRUE(m.HasTag(0x0010, 0x0020)); |
105 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID2"); | 104 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID2"); |
106 ASSERT_EQ("PatientID2", m.GetValue(0x0010, 0x0020).AsString()); | 105 ASSERT_EQ("PatientID2", m.GetValue(0x0010, 0x0020).GetContent()); |
107 | 106 |
108 m.GetTags(s); | 107 m.GetTags(s); |
109 ASSERT_EQ(2u, s.size()); | 108 ASSERT_EQ(2u, s.size()); |
110 | 109 |
111 m.Remove(DICOM_TAG_PATIENT_ID); | 110 m.Remove(DICOM_TAG_PATIENT_ID); |
114 m.GetTags(s); | 113 m.GetTags(s); |
115 ASSERT_EQ(1u, s.size()); | 114 ASSERT_EQ(1u, s.size()); |
116 ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin()); | 115 ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin()); |
117 | 116 |
118 std::auto_ptr<DicomMap> mm(m.Clone()); | 117 std::auto_ptr<DicomMap> mm(m.Clone()); |
119 ASSERT_EQ("PatientName", mm->GetValue(DICOM_TAG_PATIENT_NAME).AsString()); | 118 ASSERT_EQ("PatientName", mm->GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); |
120 | 119 |
121 m.SetValue(DICOM_TAG_PATIENT_ID, "Hello"); | 120 m.SetValue(DICOM_TAG_PATIENT_ID, "Hello"); |
122 ASSERT_THROW(mm->GetValue(DICOM_TAG_PATIENT_ID), OrthancException); | 121 ASSERT_THROW(mm->GetValue(DICOM_TAG_PATIENT_ID), OrthancException); |
123 mm->CopyTagIfExists(m, DICOM_TAG_PATIENT_ID); | 122 mm->CopyTagIfExists(m, DICOM_TAG_PATIENT_ID); |
124 ASSERT_EQ("Hello", mm->GetValue(DICOM_TAG_PATIENT_ID).AsString()); | 123 ASSERT_EQ("Hello", mm->GetValue(DICOM_TAG_PATIENT_ID).GetContent()); |
125 | 124 |
126 DicomNullValue v; | 125 DicomValue v; |
127 ASSERT_TRUE(v.IsNull()); | 126 ASSERT_TRUE(v.IsNull()); |
128 } | 127 } |
129 | 128 |
130 | 129 |
131 TEST(DicomMap, FindTemplates) | 130 TEST(DicomMap, FindTemplates) |
168 { | 167 { |
169 ok = true; | 168 ok = true; |
170 }*/ | 169 }*/ |
171 | 170 |
172 // Exceptions for the Instance level | 171 // Exceptions for the Instance level |
173 if ((/* Accession number, from Image module */ | 172 if (level == ResourceType_Instance && |
174 *it == DicomTag(0x0020, 0x0012) && | 173 (*it == DicomTag(0x0020, 0x0012) || /* Accession number, from Image module */ |
175 level == ResourceType_Instance) || | 174 *it == DicomTag(0x0054, 0x1330) || /* Image Index, from PET Image module */ |
176 (/* Image Index, from PET Image module */ | 175 *it == DicomTag(0x0020, 0x0100) || /* Temporal Position Identifier, from MR Image module */ |
177 *it == DicomTag(0x0054, 0x1330) && | 176 *it == DicomTag(0x0028, 0x0008) || /* Number of Frames, from Multi-frame module attributes, related to Image IOD */ |
178 level == ResourceType_Instance) || | 177 *it == DICOM_TAG_IMAGE_POSITION_PATIENT)) |
179 (/* Temporal Position Identifier, from MR Image module */ | |
180 *it == DicomTag(0x0020, 0x0100) && | |
181 level == ResourceType_Instance) || | |
182 (/* Number of Frames, from Multi-frame module attributes, related to Image IOD */ | |
183 *it == DicomTag(0x0028, 0x0008) && | |
184 level == ResourceType_Instance )) | |
185 { | 178 { |
186 ok = true; | 179 ok = true; |
187 } | 180 } |
188 | 181 |
189 if (!ok) | 182 if (!ok) |