Mercurial > hg > orthanc
comparison UnitTestsSources/DicomMap.cpp @ 963:81134ea872ff
retrieve values of modules
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 26 Jun 2014 16:42:05 +0200 |
parents | 84513f2ee1f3 |
children |
comparison
equal
deleted
inserted
replaced
962:b39c4837966e | 963:81134ea872ff |
---|---|
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" | 39 #include "../Core/DicomFormat/DicomNullValue.h" |
40 #include "../OrthancServer/FromDcmtkBridge.h" | |
40 | 41 |
41 #include <memory> | 42 #include <memory> |
42 | 43 |
43 using namespace Orthanc; | 44 using namespace Orthanc; |
44 | 45 |
126 ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID)); | 127 ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID)); |
127 | 128 |
128 DicomMap::SetupFindInstanceTemplate(m); | 129 DicomMap::SetupFindInstanceTemplate(m); |
129 ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID)); | 130 ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID)); |
130 } | 131 } |
132 | |
133 | |
134 | |
135 | |
136 static void TestModule(ResourceType level) | |
137 { | |
138 std::set<DicomTag> module, main; | |
139 DicomTag::GetTagsForModule(module, level); | |
140 DicomMap::GetMainDicomTags(main, level); | |
141 | |
142 // The main dicom tags are a subset of the module | |
143 for (std::set<DicomTag>::const_iterator it = main.begin(); it != main.end(); it++) | |
144 { | |
145 bool ok = module.find(*it) != module.end(); | |
146 | |
147 // Exceptions for the Series level | |
148 /*if ((// | |
149 *it == DicomTag(0x, 0x) && | |
150 level == ResourceType_Series)) | |
151 { | |
152 ok = true; | |
153 }*/ | |
154 | |
155 // Exceptions for the Instance level | |
156 if ((/* Accession number, from Image module */ | |
157 *it == DicomTag(0x0020, 0x0012) && | |
158 level == ResourceType_Instance) || | |
159 (/* Image Index, from PET Image module */ | |
160 *it == DicomTag(0x0054, 0x1330) && | |
161 level == ResourceType_Instance) || | |
162 (/* Temporal Position Identifier, from MR Image module */ | |
163 *it == DicomTag(0x0020, 0x0100) && | |
164 level == ResourceType_Instance) || | |
165 (/* Number of Frames, from Multi-frame module attributes, related to Image IOD */ | |
166 *it == DicomTag(0x0028, 0x0008) && | |
167 level == ResourceType_Instance )) | |
168 { | |
169 ok = true; | |
170 } | |
171 | |
172 if (!ok) | |
173 { | |
174 std::cout << it->Format() << ": " << FromDcmtkBridge::GetName(*it) | |
175 << " not expected at level " << EnumerationToString(level) << std::endl; | |
176 } | |
177 | |
178 EXPECT_TRUE(ok); | |
179 } | |
180 } | |
181 | |
182 | |
183 TEST(DicomMap, Modules) | |
184 { | |
185 TestModule(ResourceType_Patient); | |
186 TestModule(ResourceType_Study); | |
187 //TestModule(ResourceType_Series); // TODO | |
188 TestModule(ResourceType_Instance); | |
189 } |