Mercurial > hg > orthanc
annotate OrthancFramework/UnitTestsSources/DicomMapTests.cpp @ 5420:d37dff2c0028 am-new-cache
Optimized the MemoryStringCache to prevent loading the same file multiple times if multiple users request the same file at the same time
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 13 Nov 2023 17:01:59 +0100 |
parents | 03501a258d9e |
children | 48b8dae6dc77 |
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 |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5180
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5180
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
7 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
11 * the License, or (at your option) any later version. |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
12 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
13 * 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
|
14 * 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
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
16 * Lesser General Public License for more details. |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
19 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
711
diff
changeset
|
21 **/ |
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 |
4057
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
24 #if ORTHANC_UNIT_TESTS_LINK_FRAMEWORK == 1 |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4062
diff
changeset
|
25 // Must be the first to be sure to use the Orthanc framework shared library |
4057
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
26 # include <OrthancFramework.h> |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
27 #endif |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
28 |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4062
diff
changeset
|
29 #if !defined(DCMTK_VERSION_NUMBER) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4062
diff
changeset
|
30 # error DCMTK_VERSION_NUMBER is not defined |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4062
diff
changeset
|
31 #endif |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4062
diff
changeset
|
32 |
4062 | 33 #include <gtest/gtest.h> |
711 | 34 |
4057
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
35 #include "../Sources/Compatibility.h" |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
36 #include "../Sources/OrthancException.h" |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
37 #include "../Sources/DicomFormat/DicomMap.h" |
4220
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
38 #include "../Sources/DicomFormat/DicomStreamReader.h" |
4057
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
39 #include "../Sources/DicomParsing/FromDcmtkBridge.h" |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
40 #include "../Sources/DicomParsing/ToDcmtkBridge.h" |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
41 #include "../Sources/DicomParsing/ParsedDicomFile.h" |
8b7cd69806f2
move DicomMapTests from OrthancServer to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
42 #include "../Sources/DicomParsing/DicomWebJsonVisitor.h" |
711 | 43 |
4304 | 44 #include <boost/lexical_cast.hpp> |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
45 #include <boost/tuple/tuple.hpp> |
711 | 46 |
47 using namespace Orthanc; | |
48 | |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
49 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
50 namespace Orthanc |
711 | 51 { |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
52 // The namespace is necessary because of FRIEND_TEST |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
53 // http://code.google.com/p/googletest/wiki/AdvancedGuide#Private_Class_Members |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
54 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
55 class DicomMapMainTagsTests : public ::testing::Test |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
56 { |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
57 public: |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
58 DicomMapMainTagsTests() |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
59 { |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
60 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
61 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
62 virtual void SetUp() ORTHANC_OVERRIDE |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
63 { |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
64 DicomMap::ResetDefaultMainDicomTags(); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
65 } |
711 | 66 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
67 virtual void TearDown() ORTHANC_OVERRIDE |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
68 { |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
69 DicomMap::ResetDefaultMainDicomTags(); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
70 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
71 }; |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
72 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
73 TEST_F(DicomMapMainTagsTests, MainTags) |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
74 { |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
75 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
76 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Patient)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
77 ASSERT_FALSE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Study)); |
711 | 78 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
79 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_STUDY_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
80 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_ACCESSION_NUMBER)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
81 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_SERIES_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
82 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_SOP_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
83 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
84 { |
5176 | 85 std::set<DicomTag> s; |
86 DicomMap::GetAllMainDicomTags(s); | |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
87 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_PATIENT_ID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
88 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_STUDY_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
89 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_ACCESSION_NUMBER)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
90 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SERIES_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
91 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SOP_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
92 } |
711 | 93 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
94 { |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
95 std::set<DicomTag> s; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
96 DicomMap::GetMainDicomTags(s, ResourceType_Patient); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
97 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_PATIENT_ID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
98 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_STUDY_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
99 } |
711 | 100 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
101 { |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
102 std::set<DicomTag> s; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
103 DicomMap::GetMainDicomTags(s, ResourceType_Study); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
104 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_STUDY_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
105 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_ACCESSION_NUMBER)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
106 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_PATIENT_ID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
107 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
108 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
109 { |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
110 std::set<DicomTag> s; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
111 DicomMap::GetMainDicomTags(s, ResourceType_Series); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
112 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SERIES_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
113 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_PATIENT_ID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
114 } |
711 | 115 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
116 { |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
117 std::set<DicomTag> s; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
118 DicomMap::GetMainDicomTags(s, ResourceType_Instance); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
119 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SOP_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
120 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_PATIENT_ID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
121 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
122 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
123 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
124 TEST_F(DicomMapMainTagsTests, AddMainTags) |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
125 { |
5040
1c08cd68250a
removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents:
5036
diff
changeset
|
126 DicomMap::AddMainDicomTag(DICOM_TAG_BITS_ALLOCATED, ResourceType_Instance); |
711 | 127 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
128 { |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
129 std::set<DicomTag> s; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
130 DicomMap::GetMainDicomTags(s, ResourceType_Instance); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
131 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_BITS_ALLOCATED)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
132 ASSERT_TRUE(s.end() != s.find(DICOM_TAG_SOP_INSTANCE_UID)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
133 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
134 { |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
135 std::set<DicomTag> s; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
136 DicomMap::GetMainDicomTags(s, ResourceType_Series); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
137 ASSERT_TRUE(s.end() == s.find(DICOM_TAG_BITS_ALLOCATED)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
138 } |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
139 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
140 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_BITS_ALLOCATED)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
141 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_BITS_ALLOCATED, ResourceType_Instance)); |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
142 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
143 // adding the same tag should throw |
5040
1c08cd68250a
removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents:
5036
diff
changeset
|
144 ASSERT_THROW(DicomMap::AddMainDicomTag(DICOM_TAG_BITS_ALLOCATED, ResourceType_Instance), OrthancException); |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
145 |
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
146 } |
4933 | 147 |
148 TEST_F(DicomMapMainTagsTests, Signatures) | |
149 { | |
150 std::string defaultPatientSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Patient); | |
151 std::string defaultStudySignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Study); | |
152 std::string defaultSeriesSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Series); | |
153 std::string defaultInstanceSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Instance); | |
154 | |
155 ASSERT_NE(defaultInstanceSignature, defaultPatientSignature); | |
156 ASSERT_NE(defaultSeriesSignature, defaultStudySignature); | |
157 ASSERT_NE(defaultSeriesSignature, defaultPatientSignature); | |
158 | |
159 std::string patientSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Patient); | |
160 std::string studySignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Study); | |
161 std::string seriesSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Series); | |
162 std::string instanceSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance); | |
163 | |
164 // at start, default and current signature should be equal | |
165 ASSERT_EQ(defaultPatientSignature, patientSignature); | |
166 ASSERT_EQ(defaultStudySignature, studySignature); | |
167 ASSERT_EQ(defaultSeriesSignature, seriesSignature); | |
168 ASSERT_EQ(defaultInstanceSignature, instanceSignature); | |
169 | |
5040
1c08cd68250a
removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents:
5036
diff
changeset
|
170 DicomMap::AddMainDicomTag(DICOM_TAG_BITS_ALLOCATED, ResourceType_Instance); |
4933 | 171 instanceSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance); |
172 | |
173 ASSERT_NE(defaultInstanceSignature, instanceSignature); | |
174 } | |
175 | |
711 | 176 } |
177 | |
5036
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4944
diff
changeset
|
178 |
711 | 179 TEST(DicomMap, Tags) |
180 { | |
1360 | 181 std::set<DicomTag> s; |
182 | |
711 | 183 DicomMap m; |
1360 | 184 m.GetTags(s); |
1492 | 185 ASSERT_EQ(0u, s.size()); |
1360 | 186 |
711 | 187 ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_NAME)); |
188 ASSERT_FALSE(m.HasTag(0x0010, 0x0010)); | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
189 m.SetValue(0x0010, 0x0010, "PatientName", false); |
711 | 190 ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_NAME)); |
191 ASSERT_TRUE(m.HasTag(0x0010, 0x0010)); | |
192 | |
1360 | 193 m.GetTags(s); |
1492 | 194 ASSERT_EQ(1u, s.size()); |
1360 | 195 ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin()); |
196 | |
711 | 197 ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_ID)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
198 m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID", false); |
711 | 199 ASSERT_TRUE(m.HasTag(0x0010, 0x0020)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
200 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
|
201 ASSERT_EQ("PatientID2", m.GetValue(0x0010, 0x0020).GetContent()); |
711 | 202 |
1360 | 203 m.GetTags(s); |
1492 | 204 ASSERT_EQ(2u, s.size()); |
1360 | 205 |
711 | 206 m.Remove(DICOM_TAG_PATIENT_ID); |
207 ASSERT_THROW(m.GetValue(0x0010, 0x0020), OrthancException); | |
208 | |
1360 | 209 m.GetTags(s); |
1492 | 210 ASSERT_EQ(1u, s.size()); |
1360 | 211 ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin()); |
212 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3694
diff
changeset
|
213 std::unique_ptr<DicomMap> mm(m.Clone()); |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
214 ASSERT_EQ("PatientName", mm->GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); |
711 | 215 |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
216 m.SetValue(DICOM_TAG_PATIENT_ID, "Hello", false); |
711 | 217 ASSERT_THROW(mm->GetValue(DICOM_TAG_PATIENT_ID), OrthancException); |
218 mm->CopyTagIfExists(m, DICOM_TAG_PATIENT_ID); | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
219 ASSERT_EQ("Hello", mm->GetValue(DICOM_TAG_PATIENT_ID).GetContent()); |
711 | 220 |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
221 DicomValue v; |
711 | 222 ASSERT_TRUE(v.IsNull()); |
223 } | |
224 | |
225 | |
226 TEST(DicomMap, FindTemplates) | |
227 { | |
228 DicomMap m; | |
229 | |
230 DicomMap::SetupFindPatientTemplate(m); | |
231 ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_ID)); | |
232 | |
233 DicomMap::SetupFindStudyTemplate(m); | |
234 ASSERT_TRUE(m.HasTag(DICOM_TAG_STUDY_INSTANCE_UID)); | |
235 ASSERT_TRUE(m.HasTag(DICOM_TAG_ACCESSION_NUMBER)); | |
236 | |
237 DicomMap::SetupFindSeriesTemplate(m); | |
238 ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID)); | |
239 | |
240 DicomMap::SetupFindInstanceTemplate(m); | |
241 ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID)); | |
242 } | |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
243 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
244 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
245 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
246 |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
247 static void TestModule(ResourceType level, |
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
248 DicomModule module) |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
249 { |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
250 // REFERENCE: DICOM PS3.3 2015c - Information Object Definitions |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
251 // 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
|
252 |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
253 std::set<DicomTag> main; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
254 DicomMap::GetMainDicomTags(main, level); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
255 |
4932
b7ce2bb6b881
refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
256 std::set<DicomTag> moduleTags; |
1368 | 257 DicomTag::AddTagsForModule(moduleTags, module); |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
258 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
259 // The main dicom tags are a subset of the module |
1304 | 260 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
|
261 { |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
262 bool ok = moduleTags.find(*it) != moduleTags.end(); |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
263 |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
264 // Exceptions for the Study level |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
265 if (level == ResourceType_Study && |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
266 (*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
|
267 *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
|
268 *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
|
269 { |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
270 ok = true; |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
271 } |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
272 |
1849
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
273 // Exceptions for the Series level |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
274 if (level == ResourceType_Series && |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
275 (*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
|
276 *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
|
277 *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
|
278 *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
|
279 *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
|
280 *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
|
281 *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
|
282 *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
|
283 *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
|
284 *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
|
285 *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
|
286 *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
|
287 { |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
288 ok = true; |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
289 } |
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
290 |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
291 // Exceptions for the Instance level |
1704 | 292 if (level == ResourceType_Instance && |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
293 (*it == DicomTag(0x0020, 0x0012) || /* AccessionNumber, from General Image module */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
294 *it == DicomTag(0x0054, 0x1330) || /* ImageIndex, from PET Image module */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
295 *it == DicomTag(0x0020, 0x0100) || /* TemporalPositionIdentifier, from MR Image module */ |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
296 *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
|
297 *it == DicomTag(0x0020, 0x0032) || /* ImagePositionPatient, from Image Plan module, related to Image */ |
2804
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
298 *it == DicomTag(0x0020, 0x0037) || /* ImageOrientationPatient, from Image Plane Module (Orthanc 1.4.2) */ |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
299 *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
|
300 { |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
301 ok = true; |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
302 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
303 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
304 if (!ok) |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
305 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
306 std::cout << it->Format() << ": " << FromDcmtkBridge::GetTagName(*it, "") |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
307 << " not expected at level " << EnumerationToString(level) << std::endl; |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
308 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
309 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
310 EXPECT_TRUE(ok); |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
311 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
312 } |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
313 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
314 |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
315 TEST(DicomMap, Modules) |
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
316 { |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
317 TestModule(ResourceType_Patient, DicomModule_Patient); |
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
318 TestModule(ResourceType_Study, DicomModule_Study); |
1849
6394a2f8f1e1
test main dicom tags at series level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
319 TestModule(ResourceType_Series, DicomModule_Series); // TODO |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
320 TestModule(ResourceType_Instance, DicomModule_Instance); |
963
81134ea872ff
retrieve values of modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
321 } |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
322 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
323 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
324 TEST(DicomMap, Parse) |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
325 { |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
326 DicomMap m; |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
327 float f; |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
328 double d; |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
329 int32_t i; |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
330 int64_t j; |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
331 uint32_t k; |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
332 uint64_t l; |
3519
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
333 unsigned int ui; |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
334 std::string s; |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
335 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
336 m.SetValue(DICOM_TAG_PATIENT_NAME, " ", false); // Empty value |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
337 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
338 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
339 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
340 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
341 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
342 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
343 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
344 m.SetValue(DICOM_TAG_PATIENT_NAME, "0", true); // Binary value |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
345 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
346 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
347 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
348 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
349 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
350 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
351 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
352 ASSERT_FALSE(m.LookupStringValue(s, DICOM_TAG_PATIENT_NAME, false)); |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
353 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_PATIENT_NAME, true)); |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
354 ASSERT_EQ("0", s); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
355 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
356 |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
357 // 2**31-1 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
358 m.SetValue(DICOM_TAG_PATIENT_NAME, "2147483647", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
359 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
360 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
361 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
362 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
363 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
364 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
365 ASSERT_FLOAT_EQ(2147483647.0f, f); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
366 ASSERT_DOUBLE_EQ(2147483647.0, d); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
367 ASSERT_EQ(2147483647, i); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
368 ASSERT_EQ(2147483647ll, j); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
369 ASSERT_EQ(2147483647u, k); |
2418 | 370 ASSERT_EQ(2147483647ull, l); |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
371 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
372 // Test shortcuts |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
373 m.SetValue(DICOM_TAG_PATIENT_NAME, "42", false); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
374 ASSERT_TRUE(m.ParseFloat(f, DICOM_TAG_PATIENT_NAME)); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
375 ASSERT_TRUE(m.ParseDouble(d, DICOM_TAG_PATIENT_NAME)); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
376 ASSERT_TRUE(m.ParseInteger32(i, DICOM_TAG_PATIENT_NAME)); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
377 ASSERT_TRUE(m.ParseInteger64(j, DICOM_TAG_PATIENT_NAME)); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
378 ASSERT_TRUE(m.ParseUnsignedInteger32(k, DICOM_TAG_PATIENT_NAME)); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
379 ASSERT_TRUE(m.ParseUnsignedInteger64(l, DICOM_TAG_PATIENT_NAME)); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
380 ASSERT_FLOAT_EQ(42.0f, f); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
381 ASSERT_DOUBLE_EQ(42.0, d); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
382 ASSERT_EQ(42, i); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
383 ASSERT_EQ(42ll, j); |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
384 ASSERT_EQ(42u, k); |
2418 | 385 ASSERT_EQ(42ull, l); |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
386 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
387 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_PATIENT_NAME, false)); |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
388 ASSERT_EQ("42", s); |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
389 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_PATIENT_NAME, true)); |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
390 ASSERT_EQ("42", s); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2410
diff
changeset
|
391 |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
392 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
393 // 2**31 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
394 m.SetValue(DICOM_TAG_PATIENT_NAME, "2147483648", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
395 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
396 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
397 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
398 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
399 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
400 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
401 ASSERT_FLOAT_EQ(2147483648.0f, f); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
402 ASSERT_DOUBLE_EQ(2147483648.0, d); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
403 ASSERT_EQ(2147483648ll, j); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
404 ASSERT_EQ(2147483648u, k); |
2418 | 405 ASSERT_EQ(2147483648ull, l); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
406 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
407 // 2**32-1 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
408 m.SetValue(DICOM_TAG_PATIENT_NAME, "4294967295", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
409 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
410 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
411 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
412 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
413 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
414 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
415 ASSERT_FLOAT_EQ(4294967295.0f, f); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
416 ASSERT_DOUBLE_EQ(4294967295.0, d); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
417 ASSERT_EQ(4294967295ll, j); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
418 ASSERT_EQ(4294967295u, k); |
2418 | 419 ASSERT_EQ(4294967295ull, l); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
420 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
421 // 2**32 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
422 m.SetValue(DICOM_TAG_PATIENT_NAME, "4294967296", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
423 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
424 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
425 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
426 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
427 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
428 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
429 ASSERT_FLOAT_EQ(4294967296.0f, f); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
430 ASSERT_DOUBLE_EQ(4294967296.0, d); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
431 ASSERT_EQ(4294967296ll, j); |
2418 | 432 ASSERT_EQ(4294967296ull, l); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
433 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
434 m.SetValue(DICOM_TAG_PATIENT_NAME, "-1", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
435 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
436 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
437 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
438 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
439 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
440 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
441 ASSERT_FLOAT_EQ(-1.0f, f); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
442 ASSERT_DOUBLE_EQ(-1.0, d); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
443 ASSERT_EQ(-1, i); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
444 ASSERT_EQ(-1ll, j); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
445 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
446 // -2**31 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
447 m.SetValue(DICOM_TAG_PATIENT_NAME, "-2147483648", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
448 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
449 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
450 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
451 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
452 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
453 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
454 ASSERT_FLOAT_EQ(-2147483648.0f, f); |
2829 | 455 ASSERT_DOUBLE_EQ(-2147483648.0, d); |
456 ASSERT_EQ(static_cast<int32_t>(-2147483648ll), i); | |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
457 ASSERT_EQ(-2147483648ll, j); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
458 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
459 // -2**31 - 1 |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
460 m.SetValue(DICOM_TAG_PATIENT_NAME, "-2147483649", false); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
461 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseFloat(f)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
462 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseDouble(d)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
463 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger32(i)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
464 ASSERT_TRUE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseInteger64(j)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
465 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger32(k)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
466 ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).ParseUnsignedInteger64(l)); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
467 ASSERT_FLOAT_EQ(-2147483649.0f, f); |
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
468 ASSERT_DOUBLE_EQ(-2147483649.0, d); |
2416
feb0d2dcfa9b
try and fix compiler bugs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2412
diff
changeset
|
469 ASSERT_EQ(-2147483649ll, j); |
3519
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
470 |
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
471 |
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
472 // "800\0" in US COLMUNS tag |
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
473 m.SetValue(DICOM_TAG_COLUMNS, "800\0", false); |
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
474 ASSERT_TRUE(m.GetValue(DICOM_TAG_COLUMNS).ParseFirstUnsignedInteger(ui)); |
3541 | 475 ASSERT_EQ(800u, ui); |
3519
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
476 m.SetValue(DICOM_TAG_COLUMNS, "800", false); |
fc26659493b6
added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents:
3497
diff
changeset
|
477 ASSERT_TRUE(m.GetValue(DICOM_TAG_COLUMNS).ParseFirstUnsignedInteger(ui)); |
3541 | 478 ASSERT_EQ(800u, ui); |
2410
3590c936e56f
parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
479 } |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
480 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
481 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
482 TEST(DicomMap, Serialize) |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
483 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
484 Json::Value s; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
485 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
486 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
487 DicomMap m; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
488 m.SetValue(DICOM_TAG_PATIENT_NAME, "Hello", false); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
489 m.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "Binary", true); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
490 m.SetNullValue(DICOM_TAG_SERIES_DESCRIPTION); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
491 m.Serialize(s); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
492 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
493 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
494 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
495 DicomMap m; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
496 m.Unserialize(s); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
497 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
498 const DicomValue* v = m.TestAndGetValue(DICOM_TAG_ACCESSION_NUMBER); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
499 ASSERT_TRUE(v == NULL); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
500 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
501 v = m.TestAndGetValue(DICOM_TAG_PATIENT_NAME); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
502 ASSERT_TRUE(v != NULL); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
503 ASSERT_FALSE(v->IsNull()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
504 ASSERT_FALSE(v->IsBinary()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
505 ASSERT_EQ("Hello", v->GetContent()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
506 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
507 v = m.TestAndGetValue(DICOM_TAG_STUDY_DESCRIPTION); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
508 ASSERT_TRUE(v != NULL); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
509 ASSERT_FALSE(v->IsNull()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
510 ASSERT_TRUE(v->IsBinary()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
511 ASSERT_EQ("Binary", v->GetContent()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
512 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
513 v = m.TestAndGetValue(DICOM_TAG_SERIES_DESCRIPTION); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
514 ASSERT_TRUE(v != NULL); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
515 ASSERT_TRUE(v->IsNull()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
516 ASSERT_FALSE(v->IsBinary()); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
517 ASSERT_THROW(v->GetContent(), OrthancException); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
518 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2829
diff
changeset
|
519 } |
3005
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
520 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
521 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
522 |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
523 TEST(DicomMap, ExtractMainDicomTags) |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
524 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
525 DicomMap b; |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
526 b.SetValue(DICOM_TAG_PATIENT_NAME, "E", false); |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
527 ASSERT_TRUE(b.HasOnlyMainDicomTags()); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
528 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
529 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
530 DicomMap a; |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
531 a.SetValue(DICOM_TAG_PATIENT_NAME, "A", false); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
532 a.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "B", false); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
533 a.SetValue(DICOM_TAG_SERIES_DESCRIPTION, "C", false); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
534 a.SetValue(DICOM_TAG_NUMBER_OF_FRAMES, "D", false); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
535 a.SetValue(DICOM_TAG_SLICE_THICKNESS, "F", false); |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
536 ASSERT_FALSE(a.HasOnlyMainDicomTags()); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
537 b.ExtractMainDicomTags(a); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
538 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
539 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
540 ASSERT_EQ(4u, b.GetSize()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
541 ASSERT_EQ("A", b.GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
542 ASSERT_EQ("B", b.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
543 ASSERT_EQ("C", b.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
544 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
545 ASSERT_FALSE(b.HasTag(DICOM_TAG_SLICE_THICKNESS)); |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
546 ASSERT_TRUE(b.HasOnlyMainDicomTags()); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
547 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
548 b.SetValue(DICOM_TAG_PATIENT_NAME, "G", false); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
549 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
550 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
551 DicomMap a; |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
552 a.SetValue(DICOM_TAG_PATIENT_NAME, "A", false); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
553 a.SetValue(DICOM_TAG_SLICE_THICKNESS, "F", false); |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
554 ASSERT_FALSE(a.HasOnlyMainDicomTags()); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
555 b.Merge(a); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
556 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
557 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
558 ASSERT_EQ(5u, b.GetSize()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
559 ASSERT_EQ("G", b.GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
560 ASSERT_EQ("B", b.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
561 ASSERT_EQ("C", b.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
562 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent()); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
563 ASSERT_EQ("F", b.GetValue(DICOM_TAG_SLICE_THICKNESS).GetContent()); |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
564 ASSERT_FALSE(b.HasOnlyMainDicomTags()); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
565 } |
3187
4bbadcd03966
refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
566 |
4bbadcd03966
refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
567 |
4940
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
568 TEST(DicomMap, ComputedTags) |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
569 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
570 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
571 std::set<DicomTag> tags; |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
572 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
573 ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
574 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
575 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
576 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Study)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
577 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
578 } |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
579 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
580 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
581 std::set<DicomTag> tags; |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
582 tags.insert(DICOM_TAG_ACCESSION_NUMBER); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
583 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
584 ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
585 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
586 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
587 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Study)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
588 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
589 } |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
590 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
591 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
592 std::set<DicomTag> tags; |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
593 tags.insert(DICOM_TAG_MODALITIES_IN_STUDY); |
4944
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
594 tags.insert(DICOM_TAG_RETRIEVE_URL); |
4940
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
595 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
596 ASSERT_TRUE(DicomMap::HasOnlyComputedTags(tags)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
597 ASSERT_TRUE(DicomMap::HasComputedTags(tags, ResourceType_Study)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
598 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
599 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
600 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
601 } |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
602 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
603 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
604 std::set<DicomTag> tags; |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
605 tags.insert(DICOM_TAG_ACCESSION_NUMBER); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
606 tags.insert(DICOM_TAG_MODALITIES_IN_STUDY); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
607 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
608 ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
609 ASSERT_TRUE(DicomMap::HasComputedTags(tags, ResourceType_Study)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
610 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
611 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
612 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance)); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
613 } |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
614 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
615 } |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4933
diff
changeset
|
616 |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
617 TEST(DicomMap, RemoveBinary) |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
618 { |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
619 DicomMap b; |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
620 b.SetValue(DICOM_TAG_PATIENT_NAME, "A", false); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
621 b.SetValue(DICOM_TAG_PATIENT_ID, "B", true); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
622 b.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, DicomValue()); // NULL |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
623 b.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, DicomValue("C", false)); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
624 b.SetValue(DICOM_TAG_SOP_INSTANCE_UID, DicomValue("D", true)); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
625 |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
626 b.RemoveBinaryTags(); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
627 |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
628 std::string s; |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
629 ASSERT_EQ(2u, b.GetSize()); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
630 ASSERT_TRUE(b.LookupStringValue(s, DICOM_TAG_PATIENT_NAME, false)); ASSERT_EQ("A", s); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
631 ASSERT_TRUE(b.LookupStringValue(s, DICOM_TAG_SERIES_INSTANCE_UID, false)); ASSERT_EQ("C", s); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
632 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
633 |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3541
diff
changeset
|
634 |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
635 TEST(DicomMap, FromDicomAsJsonAndSequences) |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
636 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
637 DicomMap m; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
638 std::string jsonFullString = "{" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
639 "\"0008,1090\" : " |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
640 "{" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
641 "\"Name\" : \"ManufacturerModelName\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
642 "\"Type\" : \"String\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
643 "\"Value\" : \"MyModel\"" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
644 "}," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
645 "\"0008,1111\" : " |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
646 "{" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
647 "\"Name\" : \"ReferencedPerformedProcedureStepSequence\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
648 "\"Type\" : \"Sequence\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
649 "\"Value\" : " |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
650 "[" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
651 "{" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
652 "\"0008,1150\" : " |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
653 "{" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
654 "\"Name\" : \"ReferencedSOPClassUID\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
655 "\"Type\" : \"String\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
656 "\"Value\" : \"1.2.4\"" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
657 "}," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
658 "\"0008,1155\" : " |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
659 "{" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
660 "\"Name\" : \"ReferencedSOPInstanceUID\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
661 "\"Type\" : \"String\"," |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
662 "\"Value\" : \"1.2.3\"" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
663 "}" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
664 "}" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
665 "]" |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
666 "}}"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
667 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
668 Json::Value parsedJson; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
669 bool ret = Toolbox::ReadJson(parsedJson, jsonFullString); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
670 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
671 m.FromDicomAsJson(parsedJson, false /* append */, true /* parseSequences*/); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
672 ASSERT_TRUE(ret); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
673 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
674 ASSERT_TRUE(m.HasTag(DicomTag(0x0008, 0x1090))); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
675 ASSERT_EQ("MyModel", m.GetValue(0x0008,0x1090).GetContent()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
676 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
677 ASSERT_TRUE(m.HasTag(DicomTag(0x0008, 0x1111))); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
678 const Json::Value& jsonSequence = m.GetValue(0x0008, 0x1111).GetSequenceContent(); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
679 ASSERT_EQ("ReferencedSOPClassUID", jsonSequence[0]["0008,1150"]["Name"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
680 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
681 {// serialize to human dicomAsJson |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
682 Json::Value dicomAsJson = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
683 FromDcmtkBridge::ToJson(dicomAsJson, m, DicomToJsonFormat_Human); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
684 // printf("%s", dicomAsJson.toStyledString().c_str()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
685 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
686 ASSERT_TRUE(dicomAsJson.isMember("ManufacturerModelName")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
687 ASSERT_TRUE(dicomAsJson.isMember("ReferencedPerformedProcedureStepSequence")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
688 ASSERT_TRUE(dicomAsJson["ReferencedPerformedProcedureStepSequence"][0].isMember("ReferencedSOPClassUID")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
689 ASSERT_EQ("1.2.4", dicomAsJson["ReferencedPerformedProcedureStepSequence"][0]["ReferencedSOPClassUID"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
690 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
691 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
692 {// serialize to full dicomAsJson |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
693 Json::Value dicomAsJson = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
694 FromDcmtkBridge::ToJson(dicomAsJson, m, DicomToJsonFormat_Full); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
695 // printf("%s", dicomAsJson.toStyledString().c_str()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
696 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
697 ASSERT_TRUE(dicomAsJson.isMember("0008,1090")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
698 ASSERT_TRUE(dicomAsJson.isMember("0008,1111")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
699 ASSERT_TRUE(dicomAsJson["0008,1111"]["Value"][0].isMember("0008,1150")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
700 ASSERT_EQ("1.2.4", dicomAsJson["0008,1111"]["Value"][0]["0008,1150"]["Value"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
701 ASSERT_EQ("MyModel", dicomAsJson["0008,1090"]["Value"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
702 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
703 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
704 {// serialize to short dicomAsJson |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
705 Json::Value dicomAsJson = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
706 FromDcmtkBridge::ToJson(dicomAsJson, m, DicomToJsonFormat_Short); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
707 // printf("%s", dicomAsJson.toStyledString().c_str()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
708 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
709 ASSERT_TRUE(dicomAsJson.isMember("0008,1090")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
710 ASSERT_TRUE(dicomAsJson.isMember("0008,1111")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
711 ASSERT_TRUE(dicomAsJson["0008,1111"][0].isMember("0008,1150")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
712 ASSERT_EQ("1.2.4", dicomAsJson["0008,1111"][0]["0008,1150"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
713 ASSERT_EQ("MyModel", dicomAsJson["0008,1090"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
714 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
715 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
716 {// extract sequence |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
717 DicomMap sequencesOnly; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
718 m.ExtractSequences(sequencesOnly); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
719 |
5230 | 720 ASSERT_EQ(1u, sequencesOnly.GetSize()); |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
721 ASSERT_TRUE(sequencesOnly.HasTag(0x0008, 0x1111)); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
722 ASSERT_TRUE(sequencesOnly.GetValue(0x0008, 0x1111).GetSequenceContent()[0].isMember("0008,1150")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
723 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
724 // copy sequence |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
725 DicomMap sequencesCopy; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
726 sequencesCopy.SetValue(0x0008, 0x1111, sequencesOnly.GetValue(0x0008, 0x1111)); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
727 |
5230 | 728 ASSERT_EQ(1u, sequencesCopy.GetSize()); |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
729 ASSERT_TRUE(sequencesCopy.HasTag(0x0008, 0x1111)); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
730 ASSERT_TRUE(sequencesCopy.GetValue(0x0008, 0x1111).GetSequenceContent()[0].isMember("0008,1150")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
731 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
732 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
733 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
734 TEST(DicomMap, ExtractSummary) |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
735 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
736 Json::Value v = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
737 v["PatientName"] = "Hello"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
738 v["ReferencedSOPClassUID"] = "1.2.840.10008.5.1.4.1.1.4"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
739 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
740 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
741 Json::Value a = Json::arrayValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
742 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
743 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
744 Json::Value item = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
745 item["ReferencedSOPClassUID"] = "1.2.840.10008.5.1.4.1.1.4"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
746 item["ReferencedSOPInstanceUID"] = "1.2.840.113619.2.176.2025.1499492.7040.1171286241.719"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
747 a.append(item); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
748 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
749 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
750 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
751 Json::Value item = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
752 item["ReferencedSOPClassUID"] = "1.2.840.10008.5.1.4.1.1.4"; // ReferencedSOPClassUID |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
753 item["ReferencedSOPInstanceUID"] = "1.2.840.113619.2.176.2025.1499492.7040.1171286241.726"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
754 a.append(item); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
755 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
756 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
757 v["ReferencedImageSequence"] = a; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
758 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
759 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
760 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
761 Json::Value a = Json::arrayValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
762 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
763 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
764 Json::Value item = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
765 item["StudyInstanceUID"] = "1.2.840.113704.1.111.7016.1342451220.40"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
766 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
767 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
768 Json::Value b = Json::arrayValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
769 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
770 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
771 Json::Value c = Json::objectValue; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
772 c["CodeValue"] = "122403"; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
773 c["0008,103e"] = "WORLD"; // Series description |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
774 b.append(c); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
775 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
776 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
777 item["PurposeOfReferenceCodeSequence"] = b; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
778 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
779 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
780 a.append(item); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
781 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
782 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
783 v["RelatedSeriesSequence"] = a; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
784 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
785 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
786 std::unique_ptr<ParsedDicomFile> dicom(ParsedDicomFile::CreateFromJson(v, DicomFromJsonFlags_None, "")); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
787 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
788 DicomMap summary; |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
789 std::set<DicomTag> ignoreTagLength; |
5045 | 790 dicom->ExtractDicomSummary(summary, 256, ignoreTagLength); |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
791 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
792 ASSERT_TRUE(summary.HasTag(0x0008, 0x1140)); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
793 ASSERT_EQ("1.2.840.10008.5.1.4.1.1.4", summary.GetValue(0x0008, 0x1140).GetSequenceContent()[0]["0008,1150"]["Value"].asString()); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
794 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
795 |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
796 |
3187
4bbadcd03966
refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
797 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
798 TEST(DicomWebJson, Multiplicity) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
799 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
800 // http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_F.2.4.html |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
801 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
802 ParsedDicomFile dicom(false); |
3201
b69fe409cb4d
dicomweb json to xml
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3200
diff
changeset
|
803 dicom.ReplacePlainString(DICOM_TAG_PATIENT_NAME, "SB1^SB2^SB3^SB4^SB5"); |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
804 dicom.ReplacePlainString(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "1\\2.3\\4"); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
805 dicom.ReplacePlainString(DICOM_TAG_IMAGE_POSITION_PATIENT, ""); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
806 |
3581
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
807 DicomWebJsonVisitor visitor; |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
808 dicom.Apply(visitor); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
809 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
810 { |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
811 const Json::Value& tag = visitor.GetResult() ["00200037"]; // ImageOrientationPatient |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
812 const Json::Value& value = tag["Value"]; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
813 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
814 ASSERT_EQ(EnumerationToString(ValueRepresentation_DecimalString), tag["vr"].asString()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
815 ASSERT_EQ(2u, tag.getMemberNames().size()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
816 ASSERT_EQ(3u, value.size()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
817 ASSERT_EQ(Json::realValue, value[1].type()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
818 ASSERT_FLOAT_EQ(1.0f, value[0].asFloat()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
819 ASSERT_FLOAT_EQ(2.3f, value[1].asFloat()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
820 ASSERT_FLOAT_EQ(4.0f, value[2].asFloat()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
821 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
822 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
823 { |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
824 const Json::Value& tag = visitor.GetResult() ["00200032"]; // ImagePositionPatient |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
825 ASSERT_EQ(EnumerationToString(ValueRepresentation_DecimalString), tag["vr"].asString()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
826 ASSERT_EQ(1u, tag.getMemberNames().size()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
827 } |
3201
b69fe409cb4d
dicomweb json to xml
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3200
diff
changeset
|
828 |
3203
810772486249
URI "/instances/.../file" can return DICOMweb JSON or XML, depending on Accept header
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3202
diff
changeset
|
829 std::string xml; |
3201
b69fe409cb4d
dicomweb json to xml
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3200
diff
changeset
|
830 visitor.FormatXml(xml); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
831 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
832 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
833 DicomMap m; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
834 m.FromDicomWeb(visitor.GetResult()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
835 ASSERT_EQ(3u, m.GetSize()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
836 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
837 std::string s; |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
838 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_PATIENT_NAME, false)); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
839 ASSERT_EQ("SB1^SB2^SB3^SB4^SB5", s); |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
840 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_IMAGE_POSITION_PATIENT, false)); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
841 ASSERT_TRUE(s.empty()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
842 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
843 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_IMAGE_ORIENTATION_PATIENT, false)); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
844 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
845 std::vector<std::string> v; |
3581
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
846 Toolbox::TokenizeString(v, s, '\\'); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
847 ASSERT_FLOAT_EQ(1.0f, boost::lexical_cast<float>(v[0])); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
848 ASSERT_FLOAT_EQ(2.3f, boost::lexical_cast<float>(v[1])); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
849 ASSERT_FLOAT_EQ(4.0f, boost::lexical_cast<float>(v[2])); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
850 } |
3187
4bbadcd03966
refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
851 } |
4bbadcd03966
refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
852 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
853 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
854 TEST(DicomWebJson, NullValue) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
855 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
856 // http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_F.2.5.html |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
857 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
858 ParsedDicomFile dicom(false); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
859 dicom.ReplacePlainString(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "1.5\\\\\\2.5"); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
860 |
3581
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
861 DicomWebJsonVisitor visitor; |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
862 dicom.Apply(visitor); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
863 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
864 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
865 const Json::Value& tag = visitor.GetResult() ["00200037"]; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
866 const Json::Value& value = tag["Value"]; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
867 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
868 ASSERT_EQ(EnumerationToString(ValueRepresentation_DecimalString), tag["vr"].asString()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
869 ASSERT_EQ(2u, tag.getMemberNames().size()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
870 ASSERT_EQ(4u, value.size()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
871 ASSERT_EQ(Json::realValue, value[0].type()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
872 ASSERT_EQ(Json::nullValue, value[1].type()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
873 ASSERT_EQ(Json::nullValue, value[2].type()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
874 ASSERT_EQ(Json::realValue, value[3].type()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
875 ASSERT_FLOAT_EQ(1.5f, value[0].asFloat()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
876 ASSERT_FLOAT_EQ(2.5f, value[3].asFloat()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
877 } |
3201
b69fe409cb4d
dicomweb json to xml
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3200
diff
changeset
|
878 |
3203
810772486249
URI "/instances/.../file" can return DICOMweb JSON or XML, depending on Accept header
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3202
diff
changeset
|
879 std::string xml; |
3201
b69fe409cb4d
dicomweb json to xml
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3200
diff
changeset
|
880 visitor.FormatXml(xml); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
881 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
882 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
883 DicomMap m; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
884 m.FromDicomWeb(visitor.GetResult()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
885 ASSERT_EQ(1u, m.GetSize()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
886 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
887 std::string s; |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3497
diff
changeset
|
888 ASSERT_TRUE(m.LookupStringValue(s, DICOM_TAG_IMAGE_ORIENTATION_PATIENT, false)); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
889 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
890 std::vector<std::string> v; |
3581
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
891 Toolbox::TokenizeString(v, s, '\\'); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
892 ASSERT_FLOAT_EQ(1.5f, boost::lexical_cast<float>(v[0])); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
893 ASSERT_TRUE(v[1].empty()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
894 ASSERT_TRUE(v[2].empty()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
895 ASSERT_FLOAT_EQ(2.5f, boost::lexical_cast<float>(v[3])); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
896 } |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
897 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
898 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3197
diff
changeset
|
899 |
3581
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
900 TEST(DicomWebJson, PixelSpacing) |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
901 { |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
902 // Test related to locales: Make sure that decimal separator is |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
903 // correctly handled (dot "." vs comma ",") |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
904 ParsedDicomFile source(false); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
905 source.ReplacePlainString(DICOM_TAG_PIXEL_SPACING, "1.5\\1.3"); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
906 |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
907 DicomWebJsonVisitor visitor; |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
908 source.Apply(visitor); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
909 |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
910 DicomMap target; |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
911 target.FromDicomWeb(visitor.GetResult()); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
912 |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
913 ASSERT_EQ("DS", visitor.GetResult() ["00280030"]["vr"].asString()); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
914 ASSERT_FLOAT_EQ(1.5f, visitor.GetResult() ["00280030"]["Value"][0].asFloat()); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
915 ASSERT_FLOAT_EQ(1.3f, visitor.GetResult() ["00280030"]["Value"][1].asFloat()); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
916 |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
917 std::string s; |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
918 ASSERT_TRUE(target.LookupStringValue(s, DICOM_TAG_PIXEL_SPACING, false)); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
919 ASSERT_EQ(s, "1.5\\1.3"); |
4de1b019ca71
unit test DicomWebJson.PixelSpacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3551
diff
changeset
|
920 } |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
921 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
922 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
923 TEST(DicomMap, MainTagNames) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
924 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
925 ASSERT_EQ(3, ResourceType_Instance - ResourceType_Patient); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
926 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
927 for (int i = ResourceType_Patient; i <= ResourceType_Instance; i++) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
928 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
929 ResourceType level = static_cast<ResourceType>(i); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
930 |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
931 std::set<DicomTag> tags; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5045
diff
changeset
|
932 DicomMap::GetMainDicomTags(tags, level); |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
933 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
934 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
935 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
936 DicomMap a; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
937 a.SetValue(*it, "TEST", false); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
938 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
939 Json::Value json; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
940 a.DumpMainDicomTags(json, level); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
941 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
942 ASSERT_EQ(Json::objectValue, json.type()); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
943 ASSERT_EQ(1u, json.getMemberNames().size()); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
944 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
945 std::string name = json.getMemberNames() [0]; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
946 EXPECT_EQ(name, FromDcmtkBridge::GetTagName(*it, "")); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
947 |
4696
dd6274412ff4
new configuration option "ExternalDictionaries" to load external DICOM dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4494
diff
changeset
|
948 std::string main = FromDcmtkBridge::GetTagName(*it, ""); |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
949 if (!main.empty()) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
950 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
951 ASSERT_EQ(main, name); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
952 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
953 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
954 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
955 } |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
956 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
957 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
958 |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
959 TEST(DicomTag, Comparisons) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
960 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
961 DicomTag a(0x0000, 0x0000); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
962 DicomTag b(0x0010, 0x0010); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
963 DicomTag c(0x0010, 0x0020); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
964 DicomTag d(0x0020, 0x0000); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
965 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
966 // operator==() |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
967 ASSERT_TRUE(a == a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
968 ASSERT_FALSE(a == b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
969 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
970 // operator!=() |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
971 ASSERT_FALSE(a != a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
972 ASSERT_TRUE(a != b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
973 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
974 // operator<=() |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
975 ASSERT_TRUE(a <= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
976 ASSERT_TRUE(a <= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
977 ASSERT_TRUE(a <= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
978 ASSERT_TRUE(a <= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
979 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
980 ASSERT_FALSE(b <= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
981 ASSERT_TRUE(b <= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
982 ASSERT_TRUE(b <= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
983 ASSERT_TRUE(b <= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
984 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
985 ASSERT_FALSE(c <= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
986 ASSERT_FALSE(c <= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
987 ASSERT_TRUE(c <= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
988 ASSERT_TRUE(c <= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
989 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
990 ASSERT_FALSE(d <= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
991 ASSERT_FALSE(d <= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
992 ASSERT_FALSE(d <= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
993 ASSERT_TRUE(d <= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
994 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
995 // operator<() |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
996 ASSERT_FALSE(a < a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
997 ASSERT_TRUE(a < b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
998 ASSERT_TRUE(a < c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
999 ASSERT_TRUE(a < d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1000 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1001 ASSERT_FALSE(b < a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1002 ASSERT_FALSE(b < b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1003 ASSERT_TRUE(b < c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1004 ASSERT_TRUE(b < d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1005 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1006 ASSERT_FALSE(c < a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1007 ASSERT_FALSE(c < b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1008 ASSERT_FALSE(c < c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1009 ASSERT_TRUE(c < d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1010 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1011 ASSERT_FALSE(d < a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1012 ASSERT_FALSE(d < b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1013 ASSERT_FALSE(d < c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1014 ASSERT_FALSE(d < d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1015 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1016 // operator>=() |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1017 ASSERT_TRUE(a >= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1018 ASSERT_FALSE(a >= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1019 ASSERT_FALSE(a >= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1020 ASSERT_FALSE(a >= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1021 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1022 ASSERT_TRUE(b >= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1023 ASSERT_TRUE(b >= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1024 ASSERT_FALSE(b >= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1025 ASSERT_FALSE(b >= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1026 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1027 ASSERT_TRUE(c >= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1028 ASSERT_TRUE(c >= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1029 ASSERT_TRUE(c >= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1030 ASSERT_FALSE(c >= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1031 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1032 ASSERT_TRUE(d >= a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1033 ASSERT_TRUE(d >= b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1034 ASSERT_TRUE(d >= c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1035 ASSERT_TRUE(d >= d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1036 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1037 // operator>() |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1038 ASSERT_FALSE(a > a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1039 ASSERT_FALSE(a > b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1040 ASSERT_FALSE(a > c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1041 ASSERT_FALSE(a > d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1042 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1043 ASSERT_TRUE(b > a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1044 ASSERT_FALSE(b > b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1045 ASSERT_FALSE(b > c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1046 ASSERT_FALSE(b > d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1047 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1048 ASSERT_TRUE(c > a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1049 ASSERT_TRUE(c > b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1050 ASSERT_FALSE(c > c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1051 ASSERT_FALSE(c > d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1052 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1053 ASSERT_TRUE(d > a); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1054 ASSERT_TRUE(d > b); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1055 ASSERT_TRUE(d > c); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1056 ASSERT_FALSE(d > d); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1057 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1058 |
4845
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1059 TEST(ParsedDicomFile, canIncludeXsVrTags) |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1060 { |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1061 Json::Value tags; |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1062 tags["0028,0034"] = "1\\1"; // PixelAspectRatio |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1063 tags["0028,1101"] = "256\\0\\16"; // RedPaletteColorLookupTableDescriptor which is declared as xs VR in dicom.dic |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1064 |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1065 std::unique_ptr<ParsedDicomFile> dicom(ParsedDicomFile::CreateFromJson(tags, DicomFromJsonFlags_DecodeDataUriScheme, "")); |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1066 // simply make sure it does not throw ! |
02d77189d8ba
added ReceivedInstanceCallback + sample C++ plugin
Alain Mazy <am@osimis.io>
parents:
4831
diff
changeset
|
1067 } |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1068 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1069 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1070 TEST(DicomMap, SetupFindTemplates) |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1071 { |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1072 /** |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1073 * The templates for C-FIND must be common to all the Orthanc |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1074 * servers, and must not be altered by the "ExtraMainDicomTags" |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1075 * configuration option that was introduced in Orthanc 1.11.0. |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1076 **/ |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1077 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1078 { |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1079 DicomMap m; |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1080 m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1081 m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1082 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1083 DicomMap::SetupFindPatientTemplate(m); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1084 std::set<DicomTag> tags; |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1085 m.GetTags(tags); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1086 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1087 // This corresponds to the values of DEFAULT_PATIENT_MAIN_DICOM_TAGS |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1088 ASSERT_EQ(5u, tags.size()); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1089 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1090 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1091 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_OTHER_PATIENT_IDS, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1092 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_BIRTH_DATE, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1093 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_NAME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1094 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_SEX, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1095 } |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1096 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1097 { |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1098 DicomMap m; |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1099 m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1100 m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1101 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1102 DicomMap::SetupFindStudyTemplate(m); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1103 std::set<DicomTag> tags; |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1104 m.GetTags(tags); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1105 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1106 // This corresponds to the values of DEFAULT_STUDY_MAIN_DICOM_TAGS |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1107 ASSERT_EQ(8u, tags.size()); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1108 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1109 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACCESSION_NUMBER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1110 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_INSTANCE_UID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1111 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1112 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_REFERRING_PHYSICIAN_NAME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1113 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_DATE, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1114 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_DESCRIPTION, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1115 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_ID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1116 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_TIME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1117 } |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1118 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1119 { |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1120 DicomMap m; |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1121 m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1122 m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1123 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1124 DicomMap::SetupFindSeriesTemplate(m); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1125 std::set<DicomTag> tags; |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1126 m.GetTags(tags); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1127 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1128 // This corresponds to the values of DEFAULT_SERIES_MAIN_DICOM_TAGS |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1129 ASSERT_EQ(13u, tags.size()); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1130 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1131 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACCESSION_NUMBER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1132 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_INSTANCE_UID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1133 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_INSTANCE_UID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1134 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1135 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_BODY_PART_EXAMINED, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1136 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_MODALITY, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1137 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_OPERATOR_NAME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1138 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1139 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PROTOCOL_NAME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1140 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_DATE, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1141 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_DESCRIPTION, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1142 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_NUMBER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1143 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_TIME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1144 } |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1145 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1146 { |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1147 DicomMap m; |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1148 m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1149 m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
1150 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1151 DicomMap::SetupFindInstanceTemplate(m); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1152 std::set<DicomTag> tags; |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1153 m.GetTags(tags); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1154 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1155 // This corresponds to the values of DEFAULT_INSTANCE_MAIN_DICOM_TAGS |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1156 ASSERT_EQ(15u, tags.size()); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1157 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_PATIENT_ID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1158 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACCESSION_NUMBER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1159 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_STUDY_INSTANCE_UID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1160 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SERIES_INSTANCE_UID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1161 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_SOP_INSTANCE_UID, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1162 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1163 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_ACQUISITION_NUMBER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1164 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_COMMENTS, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1165 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_INDEX, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1166 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1167 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_IMAGE_POSITION_PATIENT, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1168 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_INSTANCE_CREATION_DATE, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1169 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_INSTANCE_CREATION_TIME, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1170 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_INSTANCE_NUMBER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1171 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_NUMBER_OF_FRAMES, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1172 ASSERT_EQ("", m.GetStringValue(DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, "nope", false)); |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1173 } |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1174 } |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1175 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5176
diff
changeset
|
1176 |
4325
b96aedfa8cc1
unit tests now running in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
1177 #if ORTHANC_SANDBOXED != 1 |
b96aedfa8cc1
unit tests now running in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
1178 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1179 #include "../Sources/SystemToolbox.h" |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1180 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1181 TEST(DicomMap, DISABLED_ParseDicomMetaInformation) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1182 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1183 static const std::string PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/"; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1184 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1185 std::map<std::string, DicomTransferSyntax> f; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1186 f.insert(std::make_pair(PATH + "../ColorTestMalaterre.dcm", DicomTransferSyntax_LittleEndianImplicit)); // 1.2.840.10008.1.2 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1187 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.1.dcm", DicomTransferSyntax_LittleEndianExplicit)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1188 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.2.dcm", DicomTransferSyntax_BigEndianExplicit)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1189 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.50.dcm", DicomTransferSyntax_JPEGProcess1)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1190 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.51.dcm", DicomTransferSyntax_JPEGProcess2_4)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1191 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.57.dcm", DicomTransferSyntax_JPEGProcess14)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1192 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.70.dcm", DicomTransferSyntax_JPEGProcess14SV1)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1193 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.80.dcm", DicomTransferSyntax_JPEGLSLossless)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1194 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.81.dcm", DicomTransferSyntax_JPEGLSLossy)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1195 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.90.dcm", DicomTransferSyntax_JPEG2000LosslessOnly)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1196 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.4.91.dcm", DicomTransferSyntax_JPEG2000)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1197 f.insert(std::make_pair(PATH + "1.2.840.10008.1.2.5.dcm", DicomTransferSyntax_RLELossless)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1198 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1199 for (std::map<std::string, DicomTransferSyntax>::const_iterator it = f.begin(); it != f.end(); ++it) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1200 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1201 printf("\n== %s ==\n\n", it->first.c_str()); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1202 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1203 std::string dicom; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1204 SystemToolbox::ReadFile(dicom, it->first, false); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1205 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1206 DicomMap d; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1207 ASSERT_TRUE(DicomMap::ParseDicomMetaInformation(d, dicom.c_str(), dicom.size())); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1208 d.Print(stdout); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1209 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1210 std::string s; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1211 ASSERT_TRUE(d.LookupStringValue(s, DICOM_TAG_TRANSFER_SYNTAX_UID, false)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1212 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1213 DicomTransferSyntax ts; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1214 ASSERT_TRUE(LookupTransferSyntax(ts, s)); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1215 ASSERT_EQ(ts, it->second); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1216 } |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
1217 } |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1218 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1219 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1220 namespace |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1221 { |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1222 class V : public DicomStreamReader::IVisitor |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1223 { |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1224 private: |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1225 DicomMap map_; |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1226 uint64_t pixelDataOffset_; |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1227 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1228 public: |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1229 V() : |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1230 pixelDataOffset_(0) |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1231 { |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1232 } |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1233 |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1234 const DicomMap& GetDicomMap() const |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1235 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1236 return map_; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1237 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1238 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1239 virtual void VisitMetaHeaderTag(const DicomTag& tag, |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1240 const ValueRepresentation& vr, |
4215
28e9457dc7ab
working on sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
1241 const std::string& value) ORTHANC_OVERRIDE |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1242 { |
4215
28e9457dc7ab
working on sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
1243 std::cout << "Header: " << tag.Format() << " [" << Toolbox::ConvertToAscii(value).c_str() << "] (" << value.size() << ")" << std::endl; |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1244 } |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1245 |
4220
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1246 virtual void VisitTransferSyntax(DicomTransferSyntax transferSyntax) ORTHANC_OVERRIDE |
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1247 { |
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1248 printf("TRANSFER SYNTAX: %s\n", GetTransferSyntaxUid(transferSyntax)); |
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1249 } |
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1250 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1251 virtual bool VisitDatasetTag(const DicomTag& tag, |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1252 const ValueRepresentation& vr, |
4215
28e9457dc7ab
working on sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
1253 const std::string& value, |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1254 bool isLittleEndian, |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1255 uint64_t fileOffset) ORTHANC_OVERRIDE |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1256 { |
4215
28e9457dc7ab
working on sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
1257 if (!isLittleEndian) |
28e9457dc7ab
working on sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
1258 printf("** "); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1259 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1260 if (tag == DICOM_TAG_PIXEL_DATA) |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1261 { |
4216 | 1262 std::cout << "Dataset: " << tag.Format() << " " << EnumerationToString(vr) |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1263 << " [PIXEL] (" << value.size() << "), offset: " << std::hex << fileOffset << std::dec << std::endl; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1264 pixelDataOffset_ = fileOffset; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1265 return false; |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1266 } |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1267 else |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1268 { |
4216 | 1269 std::cout << "Dataset: " << tag.Format() << " " << EnumerationToString(vr) |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1270 << " [" << Toolbox::ConvertToAscii(value).c_str() << "] (" << value.size() |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1271 << "), offset: " << std::hex << fileOffset << std::dec << std::endl; |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1272 } |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1273 |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1274 map_.SetValue(tag, value, Toolbox::IsAsciiString(value)); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1275 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1276 return true; |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1277 } |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1278 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1279 uint64_t GetPixelDataOffset() const |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1280 { |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1281 return pixelDataOffset_; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1282 } |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1283 }; |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1284 } |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1285 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1286 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1287 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1288 TEST(DicomStreamReader, DISABLED_Tutu) |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1289 { |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1290 static const std::string PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/"; |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1291 |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1292 typedef boost::tuple<std::string, uint64_t, ValueRepresentation> Source; |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1293 typedef std::list<Source> Sources; |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1294 |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1295 // $ ~/Subversion/orthanc-tests/Tests/GetPixelDataVR.py ~/Subversion/orthanc-tests/Database/ColorTestMalaterre.dcm ~/Subversion/orthanc-tests/Database/ColorTestImageJ.dcm ~/Subversion/orthanc-tests/Database/Knee/T1/IM-0001-0001.dcm ~/Subversion/orthanc-tests/Database/TransferSyntaxes/*.dcm |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1296 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1297 Sources sources; |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1298 sources.push_back(Source(PATH + "../ColorTestMalaterre.dcm", 0x03a0u, ValueRepresentation_Unknown)); // This file has strange VR |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1299 sources.push_back(Source(PATH + "../ColorTestImageJ.dcm", 0x00924, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1300 sources.push_back(Source(PATH + "../Knee/T1/IM-0001-0001.dcm", 0x00c78, ValueRepresentation_OtherWord)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1301 sources.push_back(Source(PATH + "1.2.840.10008.1.2.1.dcm", 0x037cu, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1302 sources.push_back(Source(PATH + "1.2.840.10008.1.2.2.dcm", 0x03e8u, ValueRepresentation_OtherByte)); // Big Endian |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1303 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.50.dcm", 0x04acu, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1304 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.51.dcm", 0x072cu, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1305 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.57.dcm", 0x0620u, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1306 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.70.dcm", 0x065au, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1307 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.80.dcm", 0x0b46u, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1308 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.81.dcm", 0x073eu, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1309 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.90.dcm", 0x0b66u, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1310 sources.push_back(Source(PATH + "1.2.840.10008.1.2.4.91.dcm", 0x19b8u, ValueRepresentation_OtherByte)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1311 sources.push_back(Source(PATH + "1.2.840.10008.1.2.5.dcm", 0x0b0au, ValueRepresentation_OtherByte)); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1312 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1313 { |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1314 std::string dicom; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1315 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1316 uint64_t offset; |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1317 ValueRepresentation vr; |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1318 |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1319 // Not a DICOM image |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1320 SystemToolbox::ReadFile(dicom, PATH + "1.2.840.10008.1.2.4.50.png", false); |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1321 ASSERT_FALSE(DicomStreamReader::LookupPixelDataOffset(offset, vr, dicom)); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1322 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1323 // Image without valid DICOM preamble |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1324 SystemToolbox::ReadFile(dicom, PATH + "1.2.840.10008.1.2.dcm", false); |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1325 ASSERT_FALSE(DicomStreamReader::LookupPixelDataOffset(offset, vr, dicom)); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1326 } |
4216 | 1327 |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1328 for (Sources::const_iterator it = sources.begin(); it != sources.end(); ++it) |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1329 { |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1330 std::string dicom; |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1331 SystemToolbox::ReadFile(dicom, it->get<0>(), false); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1332 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1333 { |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1334 uint64_t offset; |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1335 ValueRepresentation vr; |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1336 ASSERT_TRUE(DicomStreamReader::LookupPixelDataOffset(offset, vr, dicom)); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1337 ASSERT_EQ(it->get<1>(), offset); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1338 ASSERT_EQ(it->get<2>(), vr); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1339 } |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1340 |
4494
39192eb9b43d
New metadata automatically computed at the instance level: "PixelDataOffset"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4493
diff
changeset
|
1341 { |
39192eb9b43d
New metadata automatically computed at the instance level: "PixelDataOffset"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4493
diff
changeset
|
1342 uint64_t offset; |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1343 ValueRepresentation vr; |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1344 ASSERT_TRUE(DicomStreamReader::LookupPixelDataOffset(offset, vr, dicom.c_str(), dicom.size())); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1345 ASSERT_EQ(it->get<1>(), offset); |
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1346 ASSERT_EQ(it->get<2>(), vr); |
4494
39192eb9b43d
New metadata automatically computed at the instance level: "PixelDataOffset"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4493
diff
changeset
|
1347 } |
39192eb9b43d
New metadata automatically computed at the instance level: "PixelDataOffset"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4493
diff
changeset
|
1348 |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1349 ParsedDicomFile a(dicom); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1350 Json::Value aa; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1351 a.DatasetToJson(aa, DicomToJsonFormat_Short, DicomToJsonFlags_Default, 0); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1352 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1353 std::stringstream stream; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1354 size_t pos = 0; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1355 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1356 DicomStreamReader r(stream); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1357 V visitor; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1358 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1359 // Test reading byte per byte |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1360 while (pos < dicom.size() && |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1361 !r.IsDone()) |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1362 { |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1363 r.Consume(visitor); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1364 stream.clear(); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1365 stream.put(dicom[pos++]); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1366 } |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1367 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1368 r.Consume(visitor); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1369 |
5316
03501a258d9e
added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5230
diff
changeset
|
1370 ASSERT_EQ(it->get<1>(), visitor.GetPixelDataOffset()); |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1371 |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1372 // Truncate the original DICOM up to pixel data |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1373 dicom.resize(visitor.GetPixelDataOffset()); |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1374 |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1375 ParsedDicomFile b(dicom); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1376 Json::Value bb; |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1377 b.DatasetToJson(bb, DicomToJsonFormat_Short, DicomToJsonFlags_Default, 0); |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1378 |
4493
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1379 aa.removeMember("7fe0,0010"); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1380 aa.removeMember("fffc,fffc"); // For "1.2.840.10008.1.2.5.dcm" |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1381 ASSERT_EQ(aa.toStyledString(), bb.toStyledString()); |
b57ca702a430
DicomStreamReader::LookupPixelDataOffset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1382 } |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1383 } |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1384 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1385 TEST(DicomStreamReader, DISABLED_Tutu2) |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1386 { |
4223 | 1387 //static const std::string PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/"; |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1388 |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1389 //const std::string path = PATH + "1.2.840.10008.1.2.4.50.dcm"; |
4217 | 1390 //const std::string path = PATH + "1.2.840.10008.1.2.2.dcm"; |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1391 const std::string path = "/home/jodogne/Subversion/orthanc-tests/Database/HierarchicalAnonymization/RTH/RT.dcm"; |
4217 | 1392 |
1393 std::ifstream stream(path.c_str()); | |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1394 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1395 DicomStreamReader r(stream); |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1396 V visitor; |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1397 |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1398 r.Consume(visitor); |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1399 |
4223 | 1400 printf(">> %d\n", static_cast<int>(r.GetProcessedBytes())); |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
1401 } |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1402 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1403 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1404 #include <boost/filesystem.hpp> |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1405 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1406 TEST(DicomStreamReader, DISABLED_Tutu3) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1407 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1408 static const std::string PATH = "/home/jodogne/Subversion/orthanc-tests/Database/"; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1409 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1410 std::set<std::string> errors; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1411 unsigned int success = 0; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1412 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1413 for (boost::filesystem::recursive_directory_iterator current(PATH), end; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1414 current != end ; ++current) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1415 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1416 if (SystemToolbox::IsRegularFile(current->path().string())) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1417 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1418 try |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1419 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1420 if (current->path().extension() == ".dcm") |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1421 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1422 const std::string path = current->path().string(); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1423 printf("[%s]\n", path.c_str()); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1424 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1425 DicomMap m1; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1426 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1427 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1428 std::ifstream stream(path.c_str()); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1429 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1430 DicomStreamReader r(stream); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1431 V visitor; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1432 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1433 try |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1434 { |
4220
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1435 r.Consume(visitor, DICOM_TAG_PIXEL_DATA); |
92a21efa5c96
reorganization of DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4219
diff
changeset
|
1436 //r.Consume(visitor); |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1437 success++; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1438 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1439 catch (OrthancException& e) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1440 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1441 errors.insert(path); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1442 continue; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1443 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1444 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1445 m1.Assign(visitor.GetDicomMap()); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1446 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1447 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1448 m1.SetValue(DICOM_TAG_PIXEL_DATA, "", true); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1449 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1450 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1451 DicomMap m2; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1452 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1453 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1454 std::string dicom; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1455 SystemToolbox::ReadFile(dicom, path); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1456 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1457 ParsedDicomFile f(dicom); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1458 f.ExtractDicomSummary(m2, 256); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1459 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1460 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1461 std::set<DicomTag> tags; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1462 m2.GetTags(tags); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1463 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1464 bool first = true; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1465 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1466 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1467 if (!m1.HasTag(*it)) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1468 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1469 if (first) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1470 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1471 fprintf(stderr, "[%s]\n", path.c_str()); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1472 first = false; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1473 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1474 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1475 std::cerr << "ERROR: " << it->Format() << std::endl; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1476 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1477 else if (!m2.GetValue(*it).IsNull() && |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1478 !m2.GetValue(*it).IsBinary() && |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1479 Toolbox::IsAsciiString(m1.GetValue(*it).GetContent())) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1480 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1481 const std::string& v1 = m1.GetValue(*it).GetContent(); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1482 const std::string& v2 = m2.GetValue(*it).GetContent(); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1483 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1484 if (v1 != v2 && |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1485 (v1.size() != v2.size() + 1 || |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1486 v1.substr(0, v2.size()) != v2)) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1487 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1488 std::cerr << "ERROR: [" << v1 << "] [" << v2 << "]" << std::endl; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1489 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1490 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1491 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1492 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1493 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1494 catch (boost::filesystem::filesystem_error&) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1495 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1496 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1497 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1498 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1499 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1500 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1501 printf("\n== ERRORS ==\n"); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1502 for (std::set<std::string>::const_iterator |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1503 it = errors.begin(); it != errors.end(); ++it) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1504 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1505 printf("[%s]\n", it->c_str()); |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1506 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1507 |
4223 | 1508 printf("\n== SUCCESSES: %u ==\n\n", success); |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4217
diff
changeset
|
1509 } |
4325
b96aedfa8cc1
unit tests now running in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
1510 |
b96aedfa8cc1
unit tests now running in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
1511 #endif |