Mercurial > hg > orthanc
annotate UnitTestsSources/DicomMapTests.cpp @ 2194:3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Dec 2016 16:58:35 +0100 |
parents | 5a8840920121 |
children | a3a65de1840f |
rev | line source |
---|---|
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
1 /** |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1276
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
5 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
9 * License, or (at your option) any later version. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
10 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
11 * In addition, as a special exception, the copyright holders of this |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
12 * program give permission to link the code of its release with the |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
14 * that use the same license as the "OpenSSL" library), and distribute |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
15 * the linked executables. You must obey the GNU General Public License |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
16 * in all respects for all of the code used other than "OpenSSL". If you |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
17 * modify file(s) with this exception, you may extend this exception to |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
18 * your version of the file(s), but you are not obligated to do so. If |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
19 * you do not wish to do so, delete this exception statement from your |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
20 * version. If you delete this exception statement from all source files |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
21 * in the program, then also delete it here. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
22 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
23 * This program is distributed in the hope that it will be useful, but |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
26 * General Public License for more details. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
27 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
28 * You should have received a copy of the GNU General Public License |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
30 **/ |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
31 |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
32 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
827
diff
changeset
|
33 #include "PrecompiledHeadersUnitTests.h" |
711 | 34 #include "gtest/gtest.h" |
35 | |
36 #include "../Core/OrthancException.h" | |
37 #include "../Core/DicomFormat/DicomMap.h" | |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
38 #include "../OrthancServer/FromDcmtkBridge.h" |
711 | 39 |
40 #include <memory> | |
41 | |
42 using namespace Orthanc; | |
43 | |
44 TEST(DicomMap, MainTags) | |
45 { | |
46 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID)); | |
47 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Patient)); | |
48 ASSERT_FALSE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Study)); | |
49 | |
50 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_STUDY_INSTANCE_UID)); | |
51 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_ACCESSION_NUMBER)); | |
52 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_SERIES_INSTANCE_UID)); | |
53 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_SOP_INSTANCE_UID)); | |
54 | |
55 std::set<DicomTag> s; | |
56 DicomMap::GetMainDicomTags(s); | |
57 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_PATIENT_ID)); | |
58 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_STUDY_INSTANCE_UID)); | |
59 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_ACCESSION_NUMBER)); | |
60 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SERIES_INSTANCE_UID)); | |
61 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SOP_INSTANCE_UID)); | |
62 | |
63 DicomMap::GetMainDicomTags(s, ResourceType_Patient); | |
64 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_PATIENT_ID)); | |
65 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_STUDY_INSTANCE_UID)); | |
66 | |
67 DicomMap::GetMainDicomTags(s, ResourceType_Study); | |
68 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_STUDY_INSTANCE_UID)); | |
69 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_ACCESSION_NUMBER)); | |
70 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_PATIENT_ID)); | |
71 | |
72 DicomMap::GetMainDicomTags(s, ResourceType_Series); | |
73 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SERIES_INSTANCE_UID)); | |
74 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_PATIENT_ID)); | |
75 | |
76 DicomMap::GetMainDicomTags(s, ResourceType_Instance); | |
77 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SOP_INSTANCE_UID)); | |
78 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_PATIENT_ID)); | |
79 } | |
80 | |
81 | |
82 TEST(DicomMap, Tags) | |
83 { | |
1360 | 84 std::set<DicomTag> s; |
85 | |
711 | 86 DicomMap m; |
1360 | 87 m.GetTags(s); |
1492 | 88 ASSERT_EQ(0u, s.size()); |
1360 | 89 |
711 | 90 ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_NAME)); |
91 ASSERT_FALSE(m.HasTag(0x0010, 0x0010)); | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
92 m.SetValue(0x0010, 0x0010, "PatientName", false); |
711 | 93 ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_NAME)); |
94 ASSERT_TRUE(m.HasTag(0x0010, 0x0010)); | |
95 | |
1360 | 96 m.GetTags(s); |
1492 | 97 ASSERT_EQ(1u, s.size()); |
1360 | 98 ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin()); |
99 | |
711 | 100 ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_ID)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
101 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID", false); |
711 | 102 ASSERT_TRUE(m.HasTag(0x0010, 0x0020)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
103 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID2", false); |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
104 ASSERT_EQ("PatientID2", m.GetValue(0x0010, 0x0020).GetContent()); |
711 | 105 |
1360 | 106 m.GetTags(s); |
1492 | 107 ASSERT_EQ(2u, s.size()); |
1360 | 108 |
711 | 109 m.Remove(DICOM_TAG_PATIENT_ID); |
110 ASSERT_THROW(m.GetValue(0x0010, 0x0020), OrthancException); | |
111 | |
1360 | 112 m.GetTags(s); |
1492 | 113 ASSERT_EQ(1u, s.size()); |
1360 | 114 ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin()); |
115 | |
711 | 116 std::auto_ptr<DicomMap> mm(m.Clone()); |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
117 ASSERT_EQ("PatientName", mm->GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); |
711 | 118 |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
119 m.SetValue(DICOM_TAG_PATIENT_ID, "Hello", false); |
711 | 120 ASSERT_THROW(mm->GetValue(DICOM_TAG_PATIENT_ID), OrthancException); |
121 mm->CopyTagIfExists(m, DICOM_TAG_PATIENT_ID); | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
122 ASSERT_EQ("Hello", mm->GetValue(DICOM_TAG_PATIENT_ID).GetContent()); |
711 | 123 |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
124 DicomValue v; |
711 | 125 ASSERT_TRUE(v.IsNull()); |
126 } | |
127 | |
128 | |
129 TEST(DicomMap, FindTemplates) | |
130 { | |
131 DicomMap m; | |
132 | |
133 DicomMap::SetupFindPatientTemplate(m); | |
134 ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_ID)); | |
135 | |
136 DicomMap::SetupFindStudyTemplate(m); | |
137 ASSERT_TRUE(m.HasTag(DICOM_TAG_STUDY_INSTANCE_UID)); | |
138 ASSERT_TRUE(m.HasTag(DICOM_TAG_ACCESSION_NUMBER)); | |
139 | |
140 DicomMap::SetupFindSeriesTemplate(m); | |
141 ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID)); | |
142 | |
143 DicomMap::SetupFindInstanceTemplate(m); | |
144 ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID)); | |
145 } | |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
146 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
147 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
148 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
149 |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
150 static void TestModule(ResourceType level, |
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
151 DicomModule module) |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
152 { |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
153 // REFERENCE: DICOM PS3.3 2015c - Information Object Definitions |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
154 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
155 |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
156 std::set<DicomTag> moduleTags, main; |
1368 | 157 DicomTag::AddTagsForModule(moduleTags, module); |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
158 DicomMap::GetMainDicomTags(main, level); |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
159 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
160 // The main dicom tags are a subset of the module |
1304 | 161 for (std::set<DicomTag>::const_iterator it = main.begin(); it != main.end(); ++it) |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
162 { |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
163 bool ok = moduleTags.find(*it) != moduleTags.end(); |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
164 |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
165 // Exceptions for the Study level |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
166 if (level == ResourceType_Study && |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
167 (*it == DicomTag(0x0008, 0x0080) || /* InstitutionName, from Visit identification module, related to Visit */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
168 *it == DicomTag(0x0032, 0x1032) || /* RequestingPhysician, from Imaging Service Request module, related to Study */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
169 *it == DicomTag(0x0032, 0x1060))) /* RequestedProcedureDescription, from Requested Procedure module, related to Study */ |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
170 { |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
171 ok = true; |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
172 } |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
173 |
1849
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
174 // Exceptions for the Series level |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
175 if (level == ResourceType_Series && |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
176 (*it == DicomTag(0x0008, 0x0070) || /* Manufacturer, from General Equipment Module */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
177 *it == DicomTag(0x0008, 0x1010) || /* StationName, from General Equipment Module */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
178 *it == DicomTag(0x0018, 0x0024) || /* SequenceName, from MR Image Module (SIMPLIFICATION => Series) */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
179 *it == DicomTag(0x0018, 0x1090) || /* CardiacNumberOfImages, from MR Image Module (SIMPLIFICATION => Series) */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
180 *it == DicomTag(0x0020, 0x0037) || /* ImageOrientationPatient, from Image Plane Module (SIMPLIFICATION => Series) */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
181 *it == DicomTag(0x0020, 0x0105) || /* NumberOfTemporalPositions, from MR Image Module (SIMPLIFICATION => Series) */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
182 *it == DicomTag(0x0020, 0x1002) || /* ImagesInAcquisition, from General Image Module (SIMPLIFICATION => Series) */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
183 *it == DicomTag(0x0054, 0x0081) || /* NumberOfSlices, from PET Series module */ |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
184 *it == DicomTag(0x0054, 0x0101) || /* NumberOfTimeSlices, from PET Series module */ |
1850
68854412c7bc
new main dicomtags: AcquisitionDeviceProcessingDescription and ContrastBolusAgent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
185 *it == DicomTag(0x0054, 0x1000) || /* SeriesType, from PET Series module */ |
68854412c7bc
new main dicomtags: AcquisitionDeviceProcessingDescription and ContrastBolusAgent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
186 *it == DicomTag(0x0018, 0x1400) || /* AcquisitionDeviceProcessingDescription, from CR/X-Ray/DX/WholeSlideMicro Image (SIMPLIFICATION => Series) */ |
68854412c7bc
new main dicomtags: AcquisitionDeviceProcessingDescription and ContrastBolusAgent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
187 *it == DicomTag(0x0018, 0x0010))) /* ContrastBolusAgent, from Contrast/Bolus module (SIMPLIFICATION => Series) */ |
1849
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
188 { |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
189 ok = true; |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
190 } |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
191 |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
192 // Exceptions for the Instance level |
1704 | 193 if (level == ResourceType_Instance && |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
194 (*it == DicomTag(0x0020, 0x0012) || /* AccessionNumber, from General Image module */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
195 *it == DicomTag(0x0054, 0x1330) || /* ImageIndex, from PET Image module */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
196 *it == DicomTag(0x0020, 0x0100) || /* TemporalPositionIdentifier, from MR Image module */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
197 *it == DicomTag(0x0028, 0x0008) || /* NumberOfFrames, from Multi-frame module attributes, related to Image */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
198 *it == DicomTag(0x0020, 0x0032) || /* ImagePositionPatient, from Image Plan module, related to Image */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
199 *it == DicomTag(0x0020, 0x4000))) /* ImageComments, from General Image module */ |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
200 { |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
201 ok = true; |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
202 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
203 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
204 if (!ok) |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
205 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
206 std::cout << it->Format() << ": " << FromDcmtkBridge::GetTagName(*it, "") |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
207 << " not expected at level " << EnumerationToString(level) << std::endl; |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
208 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
209 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
210 EXPECT_TRUE(ok); |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
211 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
212 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
213 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
214 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
215 TEST(DicomMap, Modules) |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
216 { |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
217 TestModule(ResourceType_Patient, DicomModule_Patient); |
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
218 TestModule(ResourceType_Study, DicomModule_Study); |
1849
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
219 TestModule(ResourceType_Series, DicomModule_Series); // TODO |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
220 TestModule(ResourceType_Instance, DicomModule_Instance); |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
221 } |