Mercurial > hg > orthanc-stone
annotate OrthancStone/UnitTestsSources/TestStructureSet.cpp @ 1953:0661115af939 deep-learning
first successful application of deep learning
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Aug 2022 15:05:51 +0200 |
parents | affde38b84de |
children | 07964689cb0b |
rev | line source |
---|---|
1010
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
1 /** |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
2 * Stone of Orthanc |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
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 |
1010
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
7 * |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
1010
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
11 * the License, or (at your option) any later version. |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
12 * |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
16 * Lesser General Public License for more details. |
1010
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
17 * |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
19 * License along with this program. If not, see |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
1010
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
21 **/ |
efe1c44628a1
Fixed mysterious revert of a previous change + converted a .cpp to unix LF
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
22 |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
23 |
1894
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
24 #include "../Sources/Toolbox/DicomStructureSet.h" |
1418
4e7751a4b603
Added a test for loader injection (basic "no regression" test). DISABLED_ because it requires a running Orthanc with a well-defined structure set instance.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
25 |
1880
93c3f9234286
simplifying TestStructureSet.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1877
diff
changeset
|
26 #include <EmbeddedResources.h> |
93c3f9234286
simplifying TestStructureSet.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1877
diff
changeset
|
27 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1454
diff
changeset
|
28 #include <gtest/gtest.h> |
1894
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
29 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
30 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
31 TEST(StructureSet, ReadFromJson) |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
32 { |
1908
affde38b84de
moved tentative bgo reimplementation of rt-struct into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1895
diff
changeset
|
33 OrthancStone::FullOrthancDataset dicom( |
affde38b84de
moved tentative bgo reimplementation of rt-struct into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1895
diff
changeset
|
34 Orthanc::EmbeddedResources::GetFileResourceBuffer(Orthanc::EmbeddedResources::RT_STRUCT_00), |
affde38b84de
moved tentative bgo reimplementation of rt-struct into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1895
diff
changeset
|
35 Orthanc::EmbeddedResources::GetFileResourceSize(Orthanc::EmbeddedResources::RT_STRUCT_00)); |
1894
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
36 |
1908
affde38b84de
moved tentative bgo reimplementation of rt-struct into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1895
diff
changeset
|
37 OrthancStone::DicomStructureSet rtstruct(dicom); |
1894
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
38 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
39 ASSERT_DOUBLE_EQ(0.0, rtstruct.GetEstimatedNormal() [0]); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
40 ASSERT_DOUBLE_EQ(0.0, rtstruct.GetEstimatedNormal() [1]); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
41 ASSERT_DOUBLE_EQ(1.0, rtstruct.GetEstimatedNormal() [2]); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
42 ASSERT_DOUBLE_EQ(3.0, rtstruct.GetEstimatedSliceThickness()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
43 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
44 // (0x3006, 0x0080) seq. size |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
45 ASSERT_EQ(7u, rtstruct.GetStructuresCount()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
46 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
47 // (0x3006, 0x0080)[i]/(0x3006, 0x00a4) |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
48 for (size_t i = 0; i < 5; ++i) |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
49 { |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
50 ASSERT_EQ("ORGAN", rtstruct.GetStructureInterpretation(i)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
51 } |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
52 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
53 ASSERT_EQ("EXTERNAL", rtstruct.GetStructureInterpretation(5)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
54 ASSERT_EQ("PTV", rtstruct.GetStructureInterpretation(6)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
55 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
56 // (0x3006, 0x0020)[i]/(0x3006, 0x0026) |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
57 ASSERT_EQ("LN300", rtstruct.GetStructureName(0)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
58 ASSERT_EQ("Cortical Bone", rtstruct.GetStructureName(1)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
59 ASSERT_EQ("Adipose", rtstruct.GetStructureName(2)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
60 ASSERT_EQ("CB2-50%", rtstruct.GetStructureName(3)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
61 ASSERT_EQ("Water", rtstruct.GetStructureName(4)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
62 ASSERT_EQ("External", rtstruct.GetStructureName(5)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
63 ASSERT_EQ("PTV", rtstruct.GetStructureName(6)); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
64 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
65 // (0x3006, 0x0039)[i]/(0x3006, 0x002a) |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
66 ASSERT_EQ(255, rtstruct.GetStructureColor(0).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
67 ASSERT_EQ(0, rtstruct.GetStructureColor(0).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
68 ASSERT_EQ(0, rtstruct.GetStructureColor(0).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
69 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
70 ASSERT_EQ(0, rtstruct.GetStructureColor(1).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
71 ASSERT_EQ(255, rtstruct.GetStructureColor(1).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
72 ASSERT_EQ(255, rtstruct.GetStructureColor(1).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
73 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
74 ASSERT_EQ(255, rtstruct.GetStructureColor(2).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
75 ASSERT_EQ(0, rtstruct.GetStructureColor(2).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
76 ASSERT_EQ(255, rtstruct.GetStructureColor(2).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
77 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
78 ASSERT_EQ(0, rtstruct.GetStructureColor(3).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
79 ASSERT_EQ(0, rtstruct.GetStructureColor(3).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
80 ASSERT_EQ(255, rtstruct.GetStructureColor(3).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
81 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
82 ASSERT_EQ(0, rtstruct.GetStructureColor(4).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
83 ASSERT_EQ(128, rtstruct.GetStructureColor(4).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
84 ASSERT_EQ(255, rtstruct.GetStructureColor(4).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
85 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
86 ASSERT_EQ(0, rtstruct.GetStructureColor(5).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
87 ASSERT_EQ(128, rtstruct.GetStructureColor(5).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
88 ASSERT_EQ(0, rtstruct.GetStructureColor(5).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
89 |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
90 ASSERT_EQ(255, rtstruct.GetStructureColor(6).GetRed()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
91 ASSERT_EQ(0, rtstruct.GetStructureColor(6).GetGreen()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
92 ASSERT_EQ(255, rtstruct.GetStructureColor(6).GetBlue()); |
438071a29f77
xor polygon filler for holes in rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1893
diff
changeset
|
93 } |