Mercurial > hg > orthanc-stone
annotate UnitTestsSources/Graveyard/TestStructureSet_BGO.cpp @ 1874:08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jan 2022 18:58:37 +0100 |
parents | 7053b8a0aaec |
children |
rev | line source |
---|---|
1589
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
1 /** |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
2 * Stone of Orthanc |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1589
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
7 * |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
9 * modify it under the terms of the GNU Affero General Public License |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
11 * the License, or (at your option) any later version. |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
12 * |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
16 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
17 * |
1589
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
18 * You should have received a copy of the GNU Affero General Public License |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
20 **/ |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
21 |
8c5f9864545f
adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1587
diff
changeset
|
22 |
1541
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 /* |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 these tests are single-threaded... no worries for old buggy compilers |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 (I'm talking to YOU, cl.exe v100! And to your ancestors!) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 */ |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 static std::string& GetTestJson() |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 static const char* resultRaw = NULL; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 static std::string result; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 if (resultRaw == NULL) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 std::stringstream sst; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 sst << k_rtStruct_json00 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 << k_rtStruct_json01 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 << k_rtStruct_json02 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 << k_rtStruct_json03 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 << k_rtStruct_json04 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 << k_rtStruct_json05 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 << k_rtStruct_json06 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 << k_rtStruct_json07 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 << k_rtStruct_json08; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 std::string wholeBody = sst.str(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 result.swap(wholeBody); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 resultRaw = result.c_str(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 return result; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 namespace |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 void Initialize(const char* orthancApiUrl, OrthancStone::ILoadersContext& loadersContext) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 Orthanc::WebServiceParameters p; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 OrthancStone::GenericLoadersContext& typedLoadersContext = |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 dynamic_cast<OrthancStone::GenericLoadersContext&>(loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 // Default is http://localhost:8042 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 // Here's how you may change it |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 p.SetUrl(orthancApiUrl); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 p.SetCredentials("orthanc", "orthanc"); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 typedLoadersContext.SetOrthancParameters(p); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 typedLoadersContext.StartOracle(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 void Exitialize(OrthancStone::ILoadersContext& loadersContext) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 OrthancStone::GenericLoadersContext& typedLoadersContext = |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 dynamic_cast<OrthancStone::GenericLoadersContext&>(loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 typedLoadersContext.StopOracle(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 #if 0 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 class TestObserver : public ObserverBase<TestObserver> |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 public: |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 TestObserver() {}; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 virtual void Handle |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 }; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 #endif |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 TEST(StructureSet, DISABLED_StructureSetLoader_injection_feature_2020_05_10) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 namespace pt = boost::posix_time; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 std::unique_ptr<OrthancStone::ILoadersContext> loadersContext(new OrthancStone::GenericLoadersContext(1,4,1)); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 Initialize("http://localhost:8042/", *loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 boost::shared_ptr<DicomStructureSetLoader> loader = DicomStructureSetLoader::Create(*loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 // replace with Orthanc ID of an uploaded RTSTRUCT instance! |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 loader->LoadInstanceFullVisibility("72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661"); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 bool bContinue(true); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 pt::ptime initialTime = pt::second_clock::local_time(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 while (bContinue) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 bContinue = !loader->AreStructuresReady(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 boost::this_thread::sleep_for(boost::chrono::milliseconds(1000)); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 pt::ptime nowTime = pt::second_clock::local_time(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 pt::time_duration diff = nowTime - initialTime; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 double seconds = static_cast<double>(diff.total_milliseconds()) * 0.001; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 std::cout << seconds << " seconds elapsed...\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 if (seconds > 30) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 std::cout << "More than 30 seconds elapsed... Aborting test :(\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 //GTEST_FATAL_FAILURE_("More than 30 seconds elapsed... Aborting test :("); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 //bContinue = false; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 class SliceProcessor : |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 public OrthancStone::OrthancSeriesVolumeProgressiveLoader::ISlicePostProcessor, |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 public OrthancStone::DicomStructureSetLoader::IInstanceLookupHandler |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 public: |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 SliceProcessor(OrthancStone::DicomStructureSetLoader& structLoader) : structLoader_(structLoader) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 virtual void ProcessCTDicomSlice(const Orthanc::DicomMap& instance) ORTHANC_OVERRIDE |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 std::string sopInstanceUid; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 if (!instance.LookupStringValue(sopInstanceUid, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false)) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "Missing SOPInstanceUID in a DICOM instance"); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 slicesDicom_[sopInstanceUid] = boost::shared_ptr<DicomMap>(instance.Clone()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 virtual void RetrieveReferencedSlices(const std::set<std::string>& nonEmptyInstances) ORTHANC_OVERRIDE |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 for (std::set<std::string>::const_iterator it = nonEmptyInstances.begin(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 it != nonEmptyInstances.end(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 ++it) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 const std::string nonEmptyInstance = *it; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 if (slicesDicom_.find(nonEmptyInstance) == slicesDicom_.end()) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "Referenced SOPInstanceUID not found in CT"); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 boost::shared_ptr<Orthanc::DicomMap> instance = slicesDicom_[nonEmptyInstance]; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 structLoader_.AddReferencedSlice(*instance); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 OrthancStone::DicomStructureSetLoader& structLoader_; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 std::map<std::string, boost::shared_ptr<Orthanc::DicomMap> > slicesDicom_; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 }; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 void LoadCtSeriesBlocking(boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> ctLoader, std::string seriesId) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 namespace pt = boost::posix_time; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 // Load the CT |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 ctLoader->LoadSeries(seriesId); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 // Wait for CT to be loaded |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 pt::ptime initialTime = pt::second_clock::local_time(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 bool bContinue(true); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 while (bContinue) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 bContinue = !ctLoader->IsVolumeImageReadyInHighQuality(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 boost::this_thread::sleep_for(boost::chrono::milliseconds(1000)); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 pt::ptime nowTime = pt::second_clock::local_time(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 pt::time_duration diff = nowTime - initialTime; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 double seconds = static_cast<double>(diff.total_milliseconds()) * 0.001; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 std::cout << seconds << " seconds elapsed...\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 if (seconds > 30) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 const char* msg = "More than 30 seconds elapsed when waiting for CT... Aborting test :(\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 GTEST_FATAL_FAILURE_(msg); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 bContinue = false; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 /** |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 Will fill planes |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 */ |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 void GetCTPlanes(std::vector<OrthancStone::CoordinateSystem3D>& planes, |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 OrthancStone::VolumeProjection projection, |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> ctLoader) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 planes.clear(); // inefficient : we don't care |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 const VolumeImageGeometry& geometry = ctLoader->GetImageGeometry(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 const unsigned int depth = geometry.GetProjectionDepth(projection); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 planes.resize(depth); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 for (unsigned int z = 0; z < depth; z++) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 planes[z] = geometry.GetProjectionSlice(projection, z); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 void LoadRtStructBlocking(boost::shared_ptr<OrthancStone::DicomStructureSetLoader> structLoader, std::string instanceId) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 namespace pt = boost::posix_time; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 // Load RTSTRUCT |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 structLoader->LoadInstanceFullVisibility(instanceId); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 pt::ptime initialTime = pt::second_clock::local_time(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 // Wait for the loading process to complete |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 bool bContinue(true); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 while (bContinue) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 bContinue = !structLoader->AreStructuresReady(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 boost::this_thread::sleep_for(boost::chrono::milliseconds(1000)); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 pt::ptime nowTime = pt::second_clock::local_time(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 pt::time_duration diff = nowTime - initialTime; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 double seconds = static_cast<double>(diff.total_milliseconds()) * 0.001; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 std::cout << seconds << " seconds elapsed...\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 if (seconds > 30) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 const char* msg = "More than 30 seconds elapsed when waiting for RTSTRUCT... Aborting test :(\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 GTEST_FATAL_FAILURE_(msg); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 bContinue = false; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 TEST(StructureSet, DISABLED_Integration_Compound_CT_Struct_Loading) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 const double TOLERANCE = 0.0000001; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 // create loaders context |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 std::unique_ptr<OrthancStone::ILoadersContext> loadersContext(new OrthancStone::GenericLoadersContext(1,4,1)); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 Initialize("http://localhost:8042/", *loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 const char* ctSeriesId = "a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 const char* rtStructInstanceId = "54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 // we'll compare normal loading and optimized loading with SliceProcessor to store the dicom |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 boost::shared_ptr<OrthancStone::DicomStructureSetLoader> normalStructLoader; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 boost::shared_ptr<OrthancStone::DicomStructureSetLoader> optimizedStructLoader; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 // Create the CT volume |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume = boost::make_shared<OrthancStone::DicomVolumeImage>(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 // Create CT loader |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> ctLoader = |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 OrthancStone::OrthancSeriesVolumeProgressiveLoader::Create(*loadersContext, volume); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 // Create struct loader |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 normalStructLoader = OrthancStone::DicomStructureSetLoader::Create(*loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 // Load the CT |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 LoadCtSeriesBlocking(ctLoader, ctSeriesId); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 const OrthancStone::VolumeImageGeometry& imageGeometry = ctLoader->GetImageGeometry(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 unsigned int width = imageGeometry.GetWidth(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 EXPECT_EQ(512u, width); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 unsigned int height = imageGeometry.GetHeight(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 EXPECT_EQ(512u, height); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 unsigned int depth = imageGeometry.GetDepth(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 EXPECT_EQ(109u, depth); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 // Load the RTStruct |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 LoadRtStructBlocking(normalStructLoader, rtStructInstanceId); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 std::vector<OrthancStone::CoordinateSystem3D> axialPlanes; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 std::vector<OrthancStone::CoordinateSystem3D> coronalPlanes; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 std::vector<OrthancStone::CoordinateSystem3D> sagittalPlanes; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 // Create the CT volume |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume = boost::make_shared<OrthancStone::DicomVolumeImage>(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 // Create CT loader |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> ctLoader = |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 OrthancStone::OrthancSeriesVolumeProgressiveLoader::Create(*loadersContext, volume); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 // Create struct loader |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 optimizedStructLoader = OrthancStone::DicomStructureSetLoader::Create(*loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 // create the slice processor / instance lookup |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 boost::shared_ptr<SliceProcessor> sliceProcessor(new SliceProcessor(*optimizedStructLoader)); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 // Inject it into CT loader |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 ctLoader->SetDicomSlicePostProcessor(sliceProcessor); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 // Inject it into RTSTRUCT loader |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 optimizedStructLoader->SetInstanceLookupHandler(sliceProcessor); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 // Load the CT |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 LoadCtSeriesBlocking(ctLoader, ctSeriesId); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 // now, the slices are collected. let's do some checks |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 EXPECT_EQ(109u, sliceProcessor->slicesDicom_.size()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 // Load the RTStruct |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 LoadRtStructBlocking(optimizedStructLoader, rtStructInstanceId); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 GetCTPlanes(axialPlanes, VolumeProjection_Axial, ctLoader); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 GetCTPlanes(coronalPlanes, VolumeProjection_Coronal, ctLoader); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 GetCTPlanes(sagittalPlanes, VolumeProjection_Sagittal, ctLoader); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 // DO NOT DELETE THOSE! |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 OrthancStone::DicomStructureSet* normalContent = normalStructLoader->GetContent(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 OrthancStone::DicomStructureSet* optimizedContent = optimizedStructLoader->GetContent(); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 EXPECT_EQ(normalContent->GetStructuresCount(), optimizedContent->GetStructuresCount()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 /*void GetCTPlanes(std::vector<OrthancStone::CoordinateSystem3D>& planes, |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 OrthancStone::VolumeProjection projection, |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> ctLoader)*/ |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 std::vector<OrthancStone::CoordinateSystem3D> allPlanes; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 // let's gather all the possible cutting planes in a single struct |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 for (size_t i = 0; i < axialPlanes.size(); ++i) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 allPlanes.push_back(axialPlanes[i]); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 for (size_t i = 0; i < coronalPlanes.size(); ++i) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 allPlanes.push_back(coronalPlanes[i]); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 for (size_t i = 0; i < sagittalPlanes.size(); ++i) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 allPlanes.push_back(sagittalPlanes[i]); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 for (size_t i = 0; i < normalContent->GetStructuresCount(); ++i) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 std::cout << "Testing structure (" << i << "/" << normalContent->GetStructuresCount() << ")\n"; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 Vector structureCenter1 = normalContent->GetStructureCenter(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 const std::string& structureName1 = normalContent->GetStructureName(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 const std::string& structureInterpretation1 = normalContent->GetStructureInterpretation(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 Color structureColor1 = normalContent->GetStructureColor(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 Vector structureCenter2 = optimizedContent->GetStructureCenter(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 const std::string& structureName2 = optimizedContent->GetStructureName(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 const std::string& structureInterpretation2 = optimizedContent->GetStructureInterpretation(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 Color structureColor2 = optimizedContent->GetStructureColor(i); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 EXPECT_NEAR(structureCenter1[0], structureCenter2[0], TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 EXPECT_NEAR(structureCenter1[1], structureCenter2[1], TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 EXPECT_NEAR(structureCenter1[2], structureCenter2[2], TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 EXPECT_EQ(structureName1, structureName2); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 EXPECT_EQ(structureInterpretation1, structureInterpretation2); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 EXPECT_EQ(structureColor1.GetRed(), structureColor2.GetRed()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 EXPECT_EQ(structureColor1.GetGreen(), structureColor2.GetGreen()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 EXPECT_EQ(structureColor1.GetBlue(), structureColor2.GetBlue()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 // "random" walk through the planes. Processing them all takes too long (~ 1 min) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 for (size_t j = 0; j < allPlanes.size(); j += 37) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 const OrthancStone::CoordinateSystem3D& plane = allPlanes[j]; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 std::vector< std::pair<Point2D, Point2D> > segments1; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 std::vector< std::pair<Point2D, Point2D> > segments2; |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 bool ok1 = normalContent->ProjectStructure(segments1, i, plane); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 bool ok2 = optimizedContent->ProjectStructure(segments2, i, plane); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 // checks here |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 EXPECT_EQ(ok1, ok2); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 EXPECT_EQ(segments1.size(), segments2.size()); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 for (size_t k = 0; k < segments1.size(); ++k) |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 { |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 EXPECT_NEAR(segments1[k].first.x, segments2[k].first.x, TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 EXPECT_NEAR(segments1[k].first.y, segments2[k].first.y, TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 EXPECT_NEAR(segments1[k].second.x, segments2[k].second.x, TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 EXPECT_NEAR(segments1[k].second.y, segments2[k].second.y, TOLERANCE); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 } |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 Exitialize(*loadersContext); |
ae17c8c8838f
standalone compilation of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 } |