comparison UnitTestsSources/UnitTestsMain.cpp @ 144:9b83f30fc1c0 wasm

bilinear and trilinear interpolation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jan 2018 15:55:03 +0100
parents e2fe9352f240
children 197a5ddaf68c
comparison
equal deleted inserted replaced
143:58c545177c1c 144:9b83f30fc1c0
40 #include <boost/date_time/posix_time/posix_time.hpp> 40 #include <boost/date_time/posix_time/posix_time.hpp>
41 #include <boost/thread/thread.hpp> 41 #include <boost/thread/thread.hpp>
42 #include <boost/math/special_functions/round.hpp> 42 #include <boost/math/special_functions/round.hpp>
43 43
44 44
45 #if 0
45 namespace OrthancStone 46 namespace OrthancStone
46 { 47 {
47 class Tata : public OrthancSlicesLoader::ICallback 48 class Tata : public OrthancSlicesLoader::ICallback
48 { 49 {
49 public: 50 public:
127 128
128 boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); 129 boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
129 130
130 oracle.Stop(); 131 oracle.Stop();
131 } 132 }
133 #endif
134
135
136 TEST(GeometryToolbox, Interpolation)
137 {
138 // https://en.wikipedia.org/wiki/Bilinear_interpolation#Application_in_image_processing
139 ASSERT_FLOAT_EQ(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation(20.5f, 14.2f, 91, 210, 162, 95));
140
141 ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation(20.5f, 15.2f, 5.7f,
142 91, 210, 162, 95,
143 51, 190, 80, 92));
144 }
132 145
133 146
134 int main(int argc, char **argv) 147 int main(int argc, char **argv)
135 { 148 {
136 Orthanc::Logging::Initialize(); 149 Orthanc::Logging::Initialize();