[med-svn] [SCM] mia branch, master, updated. upstream/2.0.8-71-g67bbbd6

Gert Wollny gw.fossdev at gmail.com
Wed Mar 6 12:17:27 UTC 2013


The following commit has been merged in the master branch:
commit fff29df7fa59ab9eb148dbd825b12785f9986d3e
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Fri Mar 1 15:34:13 2013 +0100

    add patch to correct tests that fail on i386 for floating point accuracy problems

diff --git a/debian/patches/05_relax_floating_point_test_comparisons.patch b/debian/patches/05_relax_floating_point_test_comparisons.patch
new file mode 100644
index 0000000..1f462db
--- /dev/null
+++ b/debian/patches/05_relax_floating_point_test_comparisons.patch
@@ -0,0 +1,144 @@
+Description: This patch relaxes floating point comparisons in tests 
+ This patch changes some tests to better compare valus that should be zero.
+ Since floating point operations are normally not completely accurate, 
+ some tests that would otherwise fail on i386 are not passing. 
+ .
+ mia (2.0.8-1~ubuntu1) precise; urgency=low
+ .
+   * backport to Ubuntu precise
+Author: Gert Wollny <gw.fossdev at gmail.com>
+
+Origin: upstream
+Forwarded: not-needed
+Last-Update: 2013-03-01
+
+--- mia-2.0.8.orig/mia/2d/test_segframe.cc
++++ mia-2.0.8/mia/2d/test_segframe.cc
+@@ -258,9 +258,9 @@ BOOST_FIXTURE_TEST_CASE(test_frame_get_m
+ BOOST_FIXTURE_TEST_CASE(test_frame_get_mask_different, FrameTestRead)
+ {
+ 
+-	CSegPoint2D center(7.5,7.5); 
++	CSegPoint2D center(7.6,7.59); 
+ 	float r = 4; 
+-	CSegPoint2D d1(1.0,0); 
++	CSegPoint2D d1(1.0, 0.0); 
+ 	CSegPoint2D d2(0.0,-1.0); 
+ 	CSegPoint2D d3(-1.0,0.0); 
+ 	CSegStar star(center, r, d1, d2, d3); 
+@@ -310,15 +310,15 @@ BOOST_FIXTURE_TEST_CASE(test_frame_get_m
+                 /*                            x                      */   
+ 		/*8*/   0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 		
+-		/*9*/   0, 4, 4, 4, 4, 4, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0,
++		/*9*/   0, 4, 4, 4, 4, 4, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0,
+ 		
+-		/*10*/  0, 0, 4, 4, 4, 4, 3, 3, 2, 2, 2, 1, 0, 0, 0, 0,
++		/*10*/  0, 0, 4, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 0, 0, 0,
+ 		
+ 		/*11*/  0, 0, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 0, 0, 0, 0,
+ 		
+ 		/*12*/  0, 0, 0, 4, 3, 3, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0,
+ 		
+-		/*13*/  0, 0, 0, 0, 0, 3, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0,
++		/*13*/  0, 0, 0, 0, 0, 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0,
+ 		
+ 		/*14*/  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 		
+--- mia-2.0.8.orig/mia/2d/test_rigidregister.cc
++++ mia-2.0.8/mia/2d/test_rigidregister.cc
+@@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE( test_rigidreg_affi
+ 
+ BOOST_FIXTURE_TEST_CASE( test_rigidreg_rigid_gd, RigidRegisterFixture )
+ {
+-	auto tr_creator = C2DTransformCreatorHandler::instance().produce("rigid:imgboundary=repeat");
++	auto tr_creator = C2DTransformCreatorHandler::instance().produce("rigid:imgboundary=zero");
+ 	auto transformation = tr_creator->create(size); 
+ 	auto params = transformation->get_parameters(); 
+ 	params[0] = 1.0;
+--- mia-2.0.8.orig/mia/2d/SegFrame.cc
++++ mia-2.0.8/mia/2d/SegFrame.cc
+@@ -267,7 +267,8 @@ C2DUBImage CSegFrame::get_section_masks(
+ 		for (size_t y = 0; y < result.get_size().y; ++y)  {
+ 			for (size_t x = 0; x < result.get_size().x; ++x, ++i)  {
+ 				if (*i) {
+-					const C2DFVector ray_b(x - m_star.m_center.x, y - m_star.m_center.y); 
++					const C2DFVector ray_b(static_cast<float>(x) - m_star.m_center.x, 
++							       static_cast<float>(y) - m_star.m_center.y); 
+ 					double a = scale * angle(ray_a, ray_b);
+ 					if (a >= n_sections) 
+ 						a -= n_sections; 
+--- mia-2.0.8.orig/mia/2d/transform/test_vectorfield.cc
++++ mia-2.0.8/mia/2d/transform/test_vectorfield.cc
+@@ -94,17 +94,25 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransfo
+ 			C2DFMatrix dv =  field.derivative_at(x, y);
+ 			if ( x > 0 && x < size.x- 1) {
+ 				BOOST_CHECK_CLOSE(dv.x.x, 1.0f - dfx_x(x, y), 1);
+-				BOOST_CHECK_CLOSE(dv.x.y, -dfy_x(x, y), 1);
++				float test_value = -dfy_x(x, y); 
++				if (fabs(test_value) < 1e-10) 
++					BOOST_CHECK_SMALL(dv.x.y,1e-10f);
++				else 
++					BOOST_CHECK_CLOSE(dv.x.y, test_value, 0.1);
+ 			}else {
+-				BOOST_CHECK_EQUAL(dv.x.x, 1.0f);
+-				BOOST_CHECK_EQUAL(dv.x.y, 0);
++				BOOST_CHECK_CLOSE(dv.x.x, 1.0f, 0.1);
++				BOOST_CHECK_SMALL(dv.x.y, 1e-10f);
+ 			}
+ 			if ( y > 0 && y < size.y - 1) {
+-				BOOST_CHECK_CLOSE(dv.y.x, -dfx_y(x, y), 1);
++				float test_value = -dfx_y(x, y); 
++				if (fabs(test_value) < 1e-10) 
++					BOOST_CHECK_SMALL(dv.y.x, 1e-10f);
++				else 
++					BOOST_CHECK_CLOSE(dv.y.x, test_value , 1);
+ 				BOOST_CHECK_CLOSE(dv.y.y, 1.0f - dfy_y(x, y), 1);
+ 			}else {
+-				BOOST_CHECK_EQUAL(dv.y.x, 0);
+-				BOOST_CHECK_EQUAL(dv.y.y, 1.0f);
++				BOOST_CHECK_SMALL(dv.y.x, 1e-10f);
++				BOOST_CHECK_CLOSE(dv.y.y, 1.0f, 0.1);
+ 			}
+ 		}
+ 
+--- mia-2.0.8.orig/mia/2d/cost/test_lsd.cc
++++ mia-2.0.8/mia/2d/cost/test_lsd.cc
+@@ -46,14 +46,14 @@ BOOST_FIXTURE_TEST_CASE( test_LSD_2D_sel
+ 	cost.set_reference(*src);
+ 	
+ 	double cost_value = cost.value(*src);
+-	BOOST_CHECK_CLOSE(cost_value, 0.0, 0.1);
++	BOOST_CHECK_SMALL(cost_value, 1e-10);
+ 
+ 	C2DFVectorfield force(C2DBounds(8,8));
+ 
+ 	BOOST_CHECK_CLOSE(cost.evaluate_force(*src, force), 0.0, 0.1);
+ 
+-	BOOST_CHECK_EQUAL(force(1,1).x, 0.0f);
+-	BOOST_CHECK_EQUAL(force(1,1).y, 0.0f);
++	BOOST_CHECK_SMALL(force(1,1).x, 1e-10f);
++	BOOST_CHECK_SMALL(force(1,1).y, 1e-10f);
+ 	
+ }
+ 
+@@ -71,8 +71,17 @@ BOOST_FIXTURE_TEST_CASE( test_LSD_2D, LS
+ 
+ 
+ 	for (auto iforce = force.begin(), ig = grad.begin(); ig != grad.end(); ++ig, ++iforce) {
+-		BOOST_CHECK_CLOSE(iforce->x, ig->x, 0.1f);
+-		BOOST_CHECK_CLOSE(iforce->y, ig->y, 0.1f);
++		if (ig->x == 0.0) 
++			BOOST_CHECK_SMALL(iforce->x, 1e-10f); 
++		else 
++			BOOST_CHECK_CLOSE(iforce->x, ig->x, 0.1f);
++
++		if (ig->y == 0.0) 
++			BOOST_CHECK_SMALL(iforce->y, 1e-10f); 
++		else 
++			BOOST_CHECK_CLOSE(iforce->y, ig->y, 0.1f);
++		
++
+ 	}; 
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 4427780..cef166b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 02_2dmyoset-manpage-lintian-fix.patch
 03_fix_test_close_to_zero.patch
 04_silence_ambiguous_function_warning.patch
+05_relax_floating_point_test_comparisons.patch

-- 
Packaging of mia in Debian



More information about the debian-med-commit mailing list