[med-svn] [mia] 02/04: Imported Upstream version 2.2.7

Gert Wollny gert-guest at moszumanska.debian.org
Thu Oct 29 13:54:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

gert-guest pushed a commit to branch master
in repository mia.

commit 653402beef435d8bd676d8283e8243d5e74f27ab
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Thu Oct 29 14:08:14 2015 +0100

    Imported Upstream version 2.2.7
---
 CMakeLists.txt            |  6 ++--
 ChangeLog                 |  5 +++
 mia/2d/filter/test_mlv.cc |  3 +-
 mia/3d/datafield.cc       |  4 ---
 mia/3d/imagedraw.cc       |  8 ++---
 mia/3d/test_imagedraw.cc  | 86 +++++++++++++++++++++++++----------------------
 mia/3d/vectorfield.cc     |  5 +--
 7 files changed, 63 insertions(+), 54 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdd42ff..35ac512 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,9 +52,9 @@ SET(VENDOR "Gert Wollny")
 SET(PACKAGE_NAME "mia")
 SET(MAJOR_VERSION 2)
 SET(MINOR_VERSION 2)
-SET(MICRO_VERSION 6)
-SET(INTERFACE_AGE 2)
-SET(BINARY_AGE    2)
+SET(MICRO_VERSION 7)
+SET(INTERFACE_AGE 3)
+SET(BINARY_AGE    3)
 
 #
 #SET(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
diff --git a/ChangeLog b/ChangeLog
index 30b33a4..3c08f54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2.2.7
+
+    * Correct tests that fail on arm64, armhf and ppc64el
+    * Make the m/2d/mlv use always the same random seed
+
 2.2.6
 
     * Correct pkg-config dependencies
diff --git a/mia/2d/filter/test_mlv.cc b/mia/2d/filter/test_mlv.cc
index cbee934..84d126b 100644
--- a/mia/2d/filter/test_mlv.cc
+++ b/mia/2d/filter/test_mlv.cc
@@ -30,7 +30,8 @@ using namespace mlv_2dimage_filter;
 BOOST_AUTO_TEST_CASE( test_mlv )
 {
 #ifndef WIN32
-	srand48(time(NULL));
+	// deterministic test, aleays use the same seed 
+	srand48(0);
 #endif
 
 	for (int width = 2; width < 12; ++width) {
diff --git a/mia/3d/datafield.cc b/mia/3d/datafield.cc
index e92d95d..beef397 100644
--- a/mia/3d/datafield.cc
+++ b/mia/3d/datafield.cc
@@ -97,10 +97,6 @@ INSTANCIATE(unsigned char );
 INSTANCIATE(signed char);
 INSTANCIATE(bool);
 
-INSTANCIATE(C3DFVector)
-INSTANCIATE(C3DDVector)
-
-
 DEFINE_TYPE_DESCR2(C3DBounds, "3dbounds"); 
 DEFINE_TYPE_DESCR2(C3DFVector, "3dfvector"); 
 
diff --git a/mia/3d/imagedraw.cc b/mia/3d/imagedraw.cc
index de1e578..7a921f4 100644
--- a/mia/3d/imagedraw.cc
+++ b/mia/3d/imagedraw.cc
@@ -29,7 +29,7 @@ NS_MIA_BEGIN
 using std::max; 
 using std::min; 
 using std::swap; 
-using std::fabs; 
+using std::fabs;
 
 C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing):
         m_size(size), 
@@ -43,9 +43,9 @@ C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3
 void C3DDrawBox::draw_point(const C3DFVector& p)
 {
        
-        C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-                     static_cast<unsigned>(floor(p.y + 0.5)), 
-                     static_cast<unsigned>(floor(p.z + 0.5)));
+        C3DBounds ip(static_cast<short>(roundf(p.x)), 
+                     static_cast<short>(roundf(p.y)), 
+                     static_cast<short>(roundf(p.z)));
        
 	cvdebug() << "about to draw " << ip << " from " << p << "\n"; 
         if (ip < m_size) 
diff --git a/mia/3d/test_imagedraw.cc b/mia/3d/test_imagedraw.cc
index e5d963a..a5e695a 100644
--- a/mia/3d/test_imagedraw.cc
+++ b/mia/3d/test_imagedraw.cc
@@ -59,14 +59,18 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_point_outside, SimpleBitImageDrawFixtu
         output.draw_point(C3DFVector(1,11,6)); 
         output.draw_point(C3DFVector(1,5,12)); 
 
-
-
         auto& img = output.get_image(); 
         
-        
-        for(auto i : img) {
-                BOOST_CHECK(!i);
-        }
+        auto i = img.begin_range(C3DBounds::_0, img.get_size());
+	auto e = img.end_range(C3DBounds::_0, img.get_size());
+			      
+	while (i != e) {
+		if (*i) {
+			cvdebug() << "Unexpected pixel at " << i.pos() << "\n"; 
+		}
+		BOOST_CHECK(!*i);
+		++i; 
+	}
 }
 
 BOOST_FIXTURE_TEST_CASE( test_simple_draw_point_corners, SimpleBitImageDrawFixture ) 
@@ -128,9 +132,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_z_pivot, SimpleBitImageDrawFixtur
 	
 	C3DFVector p(0,0,0);
 	for (int k = 0; k < 24; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		pixels.insert(ip); 
 	}
@@ -161,9 +165,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_x, SimpleBitImageDrawFixtur
 	
 	C3DFVector p(0.1,4.2,5.3);
 	for (int k = 0; k < 22; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		pixels.insert(ip); 
 	}
@@ -194,9 +198,9 @@ BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_y, SimpleBitImageDrawFixtur
 	
 	C3DFVector p(4,0.1,5.2);
 	for (int k = 0; k < 22; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		pixels.insert(ip); 
 	}
@@ -226,13 +230,15 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends, SimpleBitImageDraw
 	C3DFVector dir(0.5, 0.3, 0.1f);
 	
 	C3DFVector p(-4,2,5);
-	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
-		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
-		if (ip.x < img.get_size().x) 
-			pixels.insert(ip); 
+	for (int k = 0; k < 40; ++k, p += dir) {
+		if (p.x >= 0 || p.x < img.get_size().x) {
+			C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+				     static_cast<signed>(roundf(p.y)), 
+				     static_cast<signed>(roundf(p.z))); 
+			cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+			if (ip.x < img.get_size().x) 
+				pixels.insert(ip); 
+		}
 	}
         
 	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
@@ -263,9 +269,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends, SimpleBitImageDraw
 	
 	C3DFVector p(4,-6,5);
 	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.y < img.get_size().y) 
 			pixels.insert(ip); 
@@ -298,9 +304,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleB
 	
 	C3DFVector p(4,-6,5);
 	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.y < img.get_size().y) 
 			pixels.insert(ip); 
@@ -317,18 +323,18 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleB
 }
 
 
-BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
+BOOST_FIXTURE_TEST_CASE( test_draw_line_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
 {
 	// x outside and parallel 
         output.draw_line(C3DFVector(-1,-6, 5), C3DFVector(-1,14,9)); 
-        output.draw_line(C3DFVector(30,6, 5), C3DFVector(30,6,5)); 
+        output.draw_line(C3DFVector(30,-3, 2), C3DFVector(30,6,5)); 
 
 	// y outside and parallel 
         output.draw_line(C3DFVector(1,-6, 5), C3DFVector(1,-6,9)); 
         output.draw_line(C3DFVector(1, 40, 5), C3DFVector(1,40,9)); 
 
 	// z outside and parallel 
-        output.draw_line(C3DFVector(1,6, -5), C3DFVector(1,6,-5)); 
+        output.draw_line(C3DFVector(1,6, -5), C3DFVector(8,7,-5)); 
         output.draw_line(C3DFVector(1,6, 22), C3DFVector(1,14,22)); 
 
         auto& img = output.get_image(); 
@@ -360,9 +366,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends, SimpleBitImageDraw
 	
 	C3DFVector p(5.5, 6.5, 0);
 	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.z < img.get_size().z) 
 			pixels.insert(ip); 
@@ -395,9 +401,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends_dz_is_zero, SimpleB
 	
 	C3DFVector p(-4,2,5);
 	for (int k = 0; k < 42; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.x < img.get_size().x) 
 			pixels.insert(ip); 
@@ -430,9 +436,9 @@ BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends_dy_is_zero, SimpleB
 	
 	C3DFVector p(5.5, 4, 0);
 	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
-		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
-			     static_cast<unsigned>(floor(p.y + 0.5)), 
-			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		C3DBounds ip(static_cast<signed>(roundf(p.x)), 
+			     static_cast<signed>(roundf(p.y)), 
+			     static_cast<signed>(roundf(p.z))); 
 		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
 		if (ip.z < img.get_size().z) 
 			pixels.insert(ip); 
diff --git a/mia/3d/vectorfield.cc b/mia/3d/vectorfield.cc
index f082531..269d3e0 100644
--- a/mia/3d/vectorfield.cc
+++ b/mia/3d/vectorfield.cc
@@ -56,13 +56,14 @@ EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfiel
 	return a;
 }
 
-#define INSTANCIATE(TYPE) \
-	template class  T3DDatafield<TYPE>;			\
+#define INSTANCIATE(TYPE)						\
+	template class  T3DDatafield<TYPE>;				\
 	template class  range3d_iterator<T3DDatafield<TYPE>::iterator>; \
 	template class  range3d_iterator<T3DDatafield<TYPE>::const_iterator>; \
 	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::iterator>; \
 	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::const_iterator>; 
 
+
 #define INSTANCIATE2D(TYPE)						\
 	template class  EXPORT_3D T2DDatafield<TYPE>;			\
 	template class  range2d_iterator<T2DDatafield<TYPE>::iterator>; \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mia.git



More information about the debian-med-commit mailing list