Mercurial > hg > orthanc-stone
annotate OrthancStone/UnitTestsSources/ImageToolboxTests.cpp @ 1951:060d61913e39 deep-learning
deep learning in steps
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 12 Aug 2022 21:49:37 +0200 |
parents | a2955abe4c2e |
children | 07964689cb0b |
rev | line source |
---|---|
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
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 |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
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 |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
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. |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
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/>. |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 **/ |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
23 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
24 #include "../Sources/Toolbox/ImageToolbox.h" |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 // #include <boost/chrono.hpp> |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 // #include <boost/lexical_cast.hpp> |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
28 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
29 #include <Compatibility.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
30 #include <Images/Image.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
31 #include <Images/PixelTraits.h> |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 #include "stdint.h" |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
35 #include <gtest/gtest.h> |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 #include <cmath> |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 TEST(ImageToolbox, SimpleHisto_Grayscale8_BinSize1) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 using OrthancStone::HistogramData; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 using OrthancStone::DumpHistogramResult; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 using OrthancStone::ComputeHistogram; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 const unsigned int W = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 const unsigned int H = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 // 256/17 = 15,... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
50 // 256 % 17 = 1 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 // 0 will be 16 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 // 1 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 // 2 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 // ... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 // 16 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 size_t pixCounter = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
59 std::unique_ptr<Orthanc::Image> image(new Orthanc::Image( |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 Orthanc::PixelFormat_Grayscale8, W, H, false)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
61 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 for (unsigned int y = 0; y < H; ++y) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 uint8_t* buffer = reinterpret_cast<uint8_t*>(image->GetRow(y)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 for (unsigned int x = 0; x < W; ++x, ++buffer, ++pixCounter) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 *buffer = static_cast<uint8_t>(pixCounter % 17); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 HistogramData hd; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 ComputeHistogram(*image, hd, 1); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
73 ASSERT_EQ(-0.5, hd.minValue); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 ASSERT_EQ(17u, hd.bins.size()); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 ASSERT_EQ(16u, hd.bins[0]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 for (size_t i = 1; i < hd.bins.size(); ++i) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 ASSERT_EQ(15u, hd.bins[i]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
78 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
80 TEST(ImageToolbox, SimpleHisto_Grayscale8_BinSize1_FormatString) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 using OrthancStone::HistogramData; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 using OrthancStone::DumpHistogramResult; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 using OrthancStone::ComputeHistogram; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 const unsigned int W = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
87 const unsigned int H = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 // 256/17 = 15,... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 // 256 % 17 = 1 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 // 0 will be 16 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
92 // 1 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 // 2 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
94 // ... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
95 // 16 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
96 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 size_t pixCounter = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
99 std::unique_ptr<Orthanc::Image> image(new Orthanc::Image( |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 Orthanc::PixelFormat_Grayscale8, W, H, false)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 for (unsigned int y = 0; y < H; ++y) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 uint8_t* buffer = reinterpret_cast<uint8_t*>(image->GetRow(y)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 for (unsigned int x = 0; x < W; ++x, ++buffer, ++pixCounter) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
107 *buffer = static_cast<uint8_t>(pixCounter % 17); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
109 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 HistogramData hd; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
112 ComputeHistogram(*image, hd, 1); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
113 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
114 // void DumpHistogramResult(std::string& s, const HistogramData& hd) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
115 std::string s; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
116 DumpHistogramResult(s, hd); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
117 std::cout << s; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
118 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
119 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
120 template<Orthanc::PixelFormat Format> |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
121 void SimpleHisto_T_BinSize1_2() |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
122 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
123 using OrthancStone::HistogramData; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
124 using OrthancStone::DumpHistogramResult; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 using OrthancStone::ComputeHistogram; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
126 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
127 const unsigned int W = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
128 const unsigned int H = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
129 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 // 256/17 = 15,... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 // 256 % 17 = 1 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 // 0 will be 16 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
133 // 1 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 // 2 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 // ... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 // 16 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 size_t pixCounter = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
140 std::unique_ptr<Orthanc::Image> image(new Orthanc::Image( |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 Format, W, H, false)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 |
1296 | 143 typedef typename Orthanc::PixelTraits<Format>::PixelType PixelType; |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 PixelType pixValue = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 for (unsigned int y = 0; y < H; ++y) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 PixelType* buffer = reinterpret_cast<PixelType*>(image->GetRow(y)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 for (unsigned int x = 0; x < W; ++x, ++buffer, ++pixCounter) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 // 0..99 0..99 0..55 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
153 *buffer = pixValue; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 pixValue++; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 if (pixValue >= 100) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 pixValue = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
157 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
158 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
159 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 HistogramData hd; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 ComputeHistogram(*image, hd, 1); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
162 ASSERT_EQ(-0.5, hd.minValue); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
163 ASSERT_EQ(100u, hd.bins.size()); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 for (size_t i = 0; i <= 55; ++i) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 ASSERT_EQ(3u, hd.bins[i]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 for (size_t i = 56; i <= 99; ++i) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
167 ASSERT_EQ(2u, hd.bins[i]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
168 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
169 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
170 TEST(ImageToolbox, SimpleHisto_Grayscale8_BinSize1_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
171 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
172 SimpleHisto_T_BinSize1_2<Orthanc::PixelFormat_Grayscale8>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
173 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
174 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
175 TEST(ImageToolbox, SimpleHisto_Grayscale16_BinSize1_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
176 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
177 SimpleHisto_T_BinSize1_2<Orthanc::PixelFormat_Grayscale16>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
178 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
179 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
180 TEST(ImageToolbox, SimpleHisto_SignedGrayscale16_BinSize1_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
181 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
182 SimpleHisto_T_BinSize1_2<Orthanc::PixelFormat_SignedGrayscale16>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
183 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
184 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
185 TEST(ImageToolbox, SimpleHisto_Grayscale32_BinSize1_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
186 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
187 SimpleHisto_T_BinSize1_2<Orthanc::PixelFormat_Grayscale32>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
188 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
189 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
190 template<Orthanc::PixelFormat Format> |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
191 void SimpleHisto_T_BinSize10_2() |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
192 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
193 using OrthancStone::HistogramData; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
194 using OrthancStone::DumpHistogramResult; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
195 using OrthancStone::ComputeHistogram; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
196 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
197 const unsigned int W = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
198 const unsigned int H = 16; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
199 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
200 // 256/17 = 15,... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
201 // 256 % 17 = 1 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
202 // 0 will be 16 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
203 // 1 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
204 // 2 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
205 // ... |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
206 // 16 will be 15 times |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
207 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
208 size_t pixCounter = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
209 |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
210 std::unique_ptr<Orthanc::Image> image(new Orthanc::Image( |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
211 Format, W, H, false)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
212 |
1296 | 213 typedef typename Orthanc::PixelTraits<Format>::PixelType PixelType; |
1286
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
214 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
215 PixelType pixValue = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
216 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
217 for (unsigned int y = 0; y < H; ++y) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
218 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
219 PixelType* buffer = reinterpret_cast<PixelType*>(image->GetRow(y)); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
220 for (unsigned int x = 0; x < W; ++x, ++buffer, ++pixCounter) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
221 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
222 // 0..99 0..99 0..55 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
223 *buffer = pixValue; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
224 pixValue++; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
225 if (pixValue >= 100) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
226 pixValue = 0; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
227 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
228 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
229 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
230 HistogramData hd; |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
231 ComputeHistogram(*image, hd, 10); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
232 ASSERT_EQ(-0.5, hd.minValue); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
233 ASSERT_EQ(10u, hd.bins.size()); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
234 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
235 for (size_t i = 0; i <= 4; ++i) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
236 ASSERT_EQ(30u, hd.bins[i]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
237 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
238 ASSERT_EQ(26u, hd.bins[5]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
239 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
240 for (size_t i = 6; i <= 9; ++i) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
241 ASSERT_EQ(20u, hd.bins[i]); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
242 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
243 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
244 TEST(ImageToolbox, SimpleHisto_Grayscale8_BinSize10_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
245 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
246 SimpleHisto_T_BinSize10_2<Orthanc::PixelFormat_Grayscale8>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
247 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
248 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
249 TEST(ImageToolbox, SimpleHisto_Grayscale16_BinSize10_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
250 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
251 SimpleHisto_T_BinSize10_2<Orthanc::PixelFormat_Grayscale16>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
252 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
253 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
254 TEST(ImageToolbox, SimpleHisto_SignedGrayscale16_BinSize10_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
255 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
256 SimpleHisto_T_BinSize10_2<Orthanc::PixelFormat_SignedGrayscale16>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
257 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
258 |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
259 TEST(ImageToolbox, SimpleHisto_Grayscale32_BinSize10_2) |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
260 { |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
261 SimpleHisto_T_BinSize10_2<Orthanc::PixelFormat_Grayscale32>(); |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
262 } |
ddb6676bbcbf
Added Histogram functions (new files: ImageToolbox...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
263 |