The following commit has been merged in the master branch:
commit d205281607d612fb54508e680ffb27c273be7044
Author: Gert Wollny <[email protected]>
Date:   Fri Mar 1 15:35:16 2013 +0100

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

diff --git a/mia/2d/SegFrame.cc b/mia/2d/SegFrame.cc
index e1ed3e2..c5899b7 100644
--- a/mia/2d/SegFrame.cc
+++ b/mia/2d/SegFrame.cc
@@ -267,7 +267,8 @@ C2DUBImage CSegFrame::get_section_masks(size_t n_sections) 
const
                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; 
diff --git a/mia/2d/cost/test_lsd.cc b/mia/2d/cost/test_lsd.cc
index 56e04cf..b490f5c 100644
--- a/mia/2d/cost/test_lsd.cc
+++ b/mia/2d/cost/test_lsd.cc
@@ -46,14 +46,14 @@ BOOST_FIXTURE_TEST_CASE( test_LSD_2D_self, LSDFixture )
        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, LSDFixture )
 
 
        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/mia/2d/test_rigidregister.cc b/mia/2d/test_rigidregister.cc
index 3ab527d..509e50d 100644
--- a/mia/2d/test_rigidregister.cc
+++ b/mia/2d/test_rigidregister.cc
@@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE( test_rigidreg_affine_cost_gradient ) 
//, RigidRegisterFixt
 
 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;
diff --git a/mia/2d/test_segframe.cc b/mia/2d/test_segframe.cc
index d3f9c3a..8dbb538 100644
--- a/mia/2d/test_segframe.cc
+++ b/mia/2d/test_segframe.cc
@@ -258,9 +258,9 @@ BOOST_FIXTURE_TEST_CASE(test_frame_get_mask, FrameTestRead)
 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_mask_different, 
FrameTestRead)
                 /*                            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,
                
diff --git a/mia/2d/transform/test_vectorfield.cc 
b/mia/2d/transform/test_vectorfield.cc
index 1c04202..baa7b6f 100644
--- a/mia/2d/transform/test_vectorfield.cc
+++ b/mia/2d/transform/test_vectorfield.cc
@@ -94,17 +94,25 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransform_derivative, 
GridTransformFixture)
                        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);
                        }
                }
 

-- 
Packaging of mia in Debian

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to