diff 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
line wrap: on
line diff
--- a/UnitTestsSources/UnitTestsMain.cpp	Mon Jan 22 15:16:19 2018 +0100
+++ b/UnitTestsSources/UnitTestsMain.cpp	Mon Jan 22 15:55:03 2018 +0100
@@ -42,6 +42,7 @@
 #include <boost/math/special_functions/round.hpp>
 
 
+#if 0
 namespace OrthancStone
 {
   class Tata : public OrthancSlicesLoader::ICallback
@@ -129,6 +130,18 @@
 
   oracle.Stop();
 }
+#endif
+
+
+TEST(GeometryToolbox, Interpolation)
+{
+  // https://en.wikipedia.org/wiki/Bilinear_interpolation#Application_in_image_processing
+  ASSERT_FLOAT_EQ(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation(20.5f, 14.2f, 91, 210, 162, 95));
+
+  ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation(20.5f, 15.2f, 5.7f,
+                                                                                        91, 210, 162, 95,
+                                                                                        51, 190, 80, 92));
+}
 
 
 int main(int argc, char **argv)