Parcourir la source

Merge branch 'cmakelist' of dbv.inf-cv.uni-jena.de:/home/ruehle/gitrepos/nice.cmake into cmakelist

unknown il y a 12 ans
Parent
commit
7ee71f6e0c

+ 11 - 8
CMakeLists.txt

@@ -30,18 +30,15 @@ IF (Boost_FOUND)
     ADD_DEFINITIONS( "-DNICE_BOOST_FOUND" )
 ENDIF()
 
-if(WIN32)
-  set(CPPUNIT_INCLUDE_DIR "C:/Libraries/cppunit-1.12.1.VS2010/cppunit-1.12.1/include/")
-endif()
 FIND_PACKAGE(CppUnit)
 IF (CPPUNIT_FOUND)
 	message(STATUS "CppUnit-dir: ${CPPUNIT_INCLUDE_DIR}")
     INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR})
     ADD_DEFINITIONS( "-DNICE_USELIB_CPPUNIT" )
 else()
-  set(CPPUNIT_INCLUDE_DIR "/usr/include/") #can be found in  /usr/include/cppunit
-  ADD_DEFINITIONS( "-DNICE_USELIB_CPPUNIT" )
-  message(STATUS "CppUnit not found, but : ${CPPUNIT_INCLUDE_DIR}")
+  #set(CPPUNIT_INCLUDE_DIR "/usr/include/") #can be found in  /usr/include/cppunit
+ # ADD_DEFINITIONS( "-DNICE_USELIB_CPPUNIT" )
+  message(STATUS "CppUnit not found")
 ENDIF()
 
 find_package(OpenMP)
@@ -67,6 +64,7 @@ endif()
 
 FIND_PACKAGE(Qt4)# COMPONENTS Qt3Support QtOpenGl)
 SET(QT_USE_QTOPENGL TRUE)
+SET(QT_USE_QTXML TRUE)
 SET(QT_USE_QT3SUPPORT TRUE)
 if(QT_FOUND)
 #  ADD_DEFINITIONS("-DQT3_SUPPORT")
@@ -128,8 +126,12 @@ set(BUILD_CORE_BASICS ON)
 #set(BUILD_CORE_OPTIMIZATION ON)
 #set(BUILD_CORE_IMAGE ON)
 #set(BUILD_CORE_MATLABACCESS ON)
-set(BUILD_CORE_TESTS ON)
-set(BUILD_CORE_TESTS_PERFORM_AS_POSTBUILD_STEP OFF)
+if(CPPUNIT_FOUND)
+	set(BUILD_CORE_TESTS OFF)
+else()
+	set(BUILD_CORE_TESTS OFF)
+endif()
+	
 set(BUILD_CORE_PROGS OFF)
 
 if( BUILD_CORE_TESTS)
@@ -158,6 +160,7 @@ set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 	# endif()
 # endforeach()
 ADD_SUBDIRECTORY(core)
+ADD_SUBDIRECTORY(vislearning)
   
 
 # doxygen support

+ 2 - 0
cmake/FindCppUnit.cmake

@@ -28,11 +28,13 @@ IF(WIN32)
 ELSE(WIN32)
   # On unix system, debug and release have the same name
   FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
+               ${CPPUNIT_INCLUDE_DIR}/../lib64
                ${CPPUNIT_INCLUDE_DIR}/../lib
                /usr/local/lib
                /usr/lib)
   FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit
                ${CPPUNIT_INCLUDE_DIR}/../lib
+               ${CPPUNIT_INCLUDE_DIR}/../lib64
                /usr/local/lib
                /usr/lib)
 ENDIF(WIN32)

+ 27 - 44
core/CMakeLists.txt

@@ -1,22 +1,37 @@
+####################################################
+## library individual settings
+
+#library name (name is appended to "nice_" to form the target library name)
+set(the_library "core")
+
+#define variable nice_<libname>_HDR and nice_<libname>_SRC for library header and source files (don't include progs and test source files here)
 include( corefiles.cmake)
+
+#define variable nice_<libname>_PROGFILES_HDR and nice_<libname>_PROGFILES_SRC for program header and source files (don't include library and test source files here)
 include( progfiles.cmake)
-include( testfiles.cmake)
 
-#message(STATUS "nice_core_hdr:${NICE_CORE_HDR}")
+#define variable nice_<libname>_TESTFILES_HDR and nice_<libname>_TESTFILES_SRC for unit test header and source files (don't include library and progs source files here)
+include( testfiles.cmake)	
+
+#add linkage dependencies to other libraries here
+set("nice_${the_library}_LINKING_DEPENDENCIES" "")
 
-ADD_LIBRARY(nice_core ${NICE_BUILD_LIBS_STATIC_SHARED} ${NICE_CORE_HDR} ${NICE_CORE_SRC})
-TARGET_LINK_LIBRARIES(nice_core ${Boost_LIBRARIES} ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${QT_LIBRARIES})
-SET_PROPERTY(TARGET nice_core PROPERTY FOLDER "library")
-INSTALL(TARGETS nice_core DESTINATION lib)
+#####################################################
+message(STATUS "adding library ${the_library}")
+
+ADD_LIBRARY("nice_${the_library}" ${NICE_BUILD_LIBS_STATIC_SHARED} ${nice_${the_library}_HDR} ${nice_${the_library}_SRC})
+TARGET_LINK_LIBRARIES("nice_${the_library}" "${nice_${the_library}_LINKING_DEPENDENCIES}" ${Boost_LIBRARIES} ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${QT_LIBRARIES})
+SET_PROPERTY(TARGET "nice_${the_library}" PROPERTY FOLDER "library")
+INSTALL(TARGETS "nice_${the_library}" DESTINATION lib)
 
 
 if(BUILD_CORE_PROGS)
   message(STATUS "building progs:")
-  foreach(__progcpp ${NICE_PROGFILES_SRC})
+  foreach(__progcpp ${nice_${the_library}_PROGFILES_SRC})
     get_filename_component(__progname ${__progcpp} NAME_WE )
     message(STATUS "progname: ${__progname} ${__progcpp}")
     ADD_EXECUTABLE( ${__progname} ${__progcpp})
-    TARGET_LINK_LIBRARIES(${__progname} nice_core)
+    TARGET_LINK_LIBRARIES(${__progname} "nice_${the_library}")
     INSTALL(TARGETS ${__progname} DESTINATION bin)
 	SET_PROPERTY(TARGET ${__progname} PROPERTY FOLDER "programs")
   endforeach()
@@ -25,12 +40,12 @@ endif()
 if(BUILD_CORE_TESTS)
   INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR})
   message(STATUS "building tests:")
-  foreach(__testcpp ${NICE_TESTFILES_SRC})
+  foreach(__testcpp ${nice_${the_library}_TESTFILES_SRC})
     get_filename_component(__testname ${__testcpp} NAME_WE )
     message(STATUS "unittest: ${__testname} ${__testcpp}")
     
     ADD_EXECUTABLE( ${__testname} ../templates/cppUnitTestRunner.cpp ${__testcpp})
-    TARGET_LINK_LIBRARIES(${__testname} nice_core ${CPPUNIT_LIBRARIES} )
+    TARGET_LINK_LIBRARIES(${__testname} "nice_${the_library}" ${CPPUNIT_LIBRARIES} )
 
     INSTALL(TARGETS ${__testname} DESTINATION tests)
 	SET_PROPERTY(TARGET ${__testname} PROPERTY FOLDER "unittests")
@@ -39,7 +54,7 @@ if(BUILD_CORE_TESTS)
 endif()
 
 #####
- set(the_module "nice_core")
+ set(the_module "nice_${the_library}")
  if(ENABLE_SOLUTION_FOLDERS)
     set_target_properties(${the_module} PROPERTIES FOLDER "modules")
   endif()
@@ -81,36 +96,4 @@ endif()
 #         install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main)
 #       endif()
 #     endforeach()
-#   endif()
-
-
-#############################################################
-# set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-# ocv_glob_modules(${NICE_CURR_DIR})
-#ocv_add_module(core)
-
-#ocv_module_include_directories()
-#ocv_glob_module_sources()
-#ocv_create_module()
-
-
-# set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-# ocv_glob_modules(${NICE_CURR_DIR})
-
-# ADD_EXECUTABLE(testConfig ./basics/progs/testConfig.cpp)
-# ADD_EXECUTABLE(testMemoryUsage ./basics/progs/testMemoryUsage.cpp)
-
-# TARGET_LINK_LIBRARIES(testConfig libnice_core_basics libnice_core_vector)
-# TARGET_LINK_LIBRARIES(testMemoryUsage libnice_core_basics)
-
-# INSTALL(TARGETS testConfig DESTINATION bin)
-# INSTALL(TARGETS testMemoryUsage DESTINATION bin)
-
-
-###
-
-#CONFIGURE_FILE(
-#  "CMakeDefinesConfig.h.in"
-#  "${PROJECT_BINARY_DIR}/CMakeDefinesConfig.h"
-#)
-#include_directories("${PROJECT_BINARY_DIR}")
+#   endif()

+ 12 - 0
core/algebra/tests/TestDiagApprox.cpp

@@ -37,7 +37,11 @@ void TestDiagApprox::TestDiagApproxComputation()
     uint maxiterations =  20;
    
    // use a fixed seed, its a test case
+#ifdef WIN32
+	srand(0);
+#else
     srand48(0);
+#endif
  
     DiagonalMatrixApprox diagApprox ( true /*verbose*/ );
     
@@ -47,7 +51,11 @@ void TestDiagApprox::TestDiagApproxComputation()
    
     for (uint j = 0 ; j < rows ; j++)
     {
+#ifdef WIN32
+		 Tdiag(j, j) = double( rand() ) / RAND_MAX;
+#else
       Tdiag(j, j) = drand48();
+#endif
     }
  
     diagApprox.approx ( Tdiag, D );
@@ -70,7 +78,11 @@ void TestDiagApprox::TestDiagApproxComputation()
     for (uint i = 0 ; i < rows ; i++)
         for (uint j = i ; j < cols ; j++)
         {
+#ifdef WIN32
+		 T(i, j) = double( rand() ) / RAND_MAX;
+#else
             T(i, j) = drand48();
+#endif
             T(j, i) = T(i, j);
         }
 

+ 11 - 0
core/algebra/tests/TestEigenValue.cpp

@@ -48,16 +48,27 @@ void TestEigenValue::TestEigenValueComputation()
     NICE::Matrix T(rows, cols, 0.0);
 
     // use a fixed seed, its a test case
+#ifdef WIN32
+	srand(0);
+#else
     srand48(0);
+#endif
 
     // generate random symmetric matrix
     for (uint i = 0 ; i < rows ; i++)
         for (uint j = i ; j < cols ; j++)
         {
+#ifdef WIN32
+            if (sparse_prob != 0.0)
+                if ( double( rand() ) / RAND_MAX < sparse_prob)
+                    continue;
+            T(i, j) = double( rand() ) / RAND_MAX;
+#else
             if (sparse_prob != 0.0)
                 if (drand48() < sparse_prob)
                     continue;
             T(i, j) = drand48();
+#endif
             T(j, i) = T(i, j);
         }
 

+ 16 - 0
core/algebra/tests/TestLinearSolve.cpp

@@ -51,16 +51,28 @@ void TestLinearSolve::TestLinearSolveComputation()
     NICE::Matrix T(rows, cols, 0.0);
 
     // use a fixed seed, its a test case
+#ifdef WIN32
+	srand(0);
+#else
     srand48(0);
+#endif
 
     // generate random symmetric matrix
     for (uint i = 0 ; i < rows ; i++)
         for (uint j = i ; j < cols ; j++)
         {
             if (sparse_prob != 0.0)
+#ifdef WIN32
+            if (sparse_prob != 0.0)
+                if ( double( rand() ) / RAND_MAX < sparse_prob)
+                    continue;
+            T(i, j) = double( rand() ) / RAND_MAX;
+#else
+            if (sparse_prob != 0.0)
                 if (drand48() < sparse_prob)
                     continue;
             T(i, j) = drand48();
+#endif
             T(j, i) = T(i, j);
         }
     // use positive definite matrices
@@ -80,7 +92,11 @@ void TestLinearSolve::TestLinearSolveComputation()
     {
       NICE::Vector x ( rows );
       for ( uint j = 0 ; j < x.size(); j++ )
+#ifdef WIN32
+		x[j] = double( rand() ) / RAND_MAX;
+#else
         x[j] = drand48();
+#endif
       Vector yg;
       Vector ys;
       Tg.multiply ( yg, x );

+ 6 - 6
core/basics/CrossplatformDefines.h

@@ -9,14 +9,14 @@
 #define STRINGISE_IMPL(x) #x
 #define STRINGISE(x) STRINGISE_IMPL(x)
 
-// Use: #pragma message WARNING("My message")
+// Use: #pragma message NICE_WARNING("My message")
 #if _MSC_VER
 #   define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : "
-#   define WARNING(exp) (FILE_LINE_LINK "WARNING: " exp)
+#   define NICE_WARNING(exp) (FILE_LINE_LINK "WARNING: " exp)
 
 #   define __MESSAGE(text) __pragma( message(__FILE__ "(" STRINGISE(__LINE__) ")" text) ) 
-#   define ERROR(text) __MESSAGE( " : Error: " #text )
-#   define MESSAGE(text) __MESSAGE( ": " #text )
+#   define NICE_ERROR(text) __MESSAGE( " : Error: " #text )
+#   define NICE_MESSAGE(text) __MESSAGE( ": " #text )
 //#   define TODO(text) WARNING( TODO: text )
 //use as:
 //ERROR( This will be a compiler error );
@@ -24,7 +24,7 @@
 //TODO( Still have to fix 3D rendering );
 
 #else//__GNUC__ - may need other defines for different compilers
-#   define WARNING(exp) ("WARNING: " exp)
+#   define NICE_WARNING(exp) ("WARNING: " exp)
 #endif
 
 //
@@ -48,4 +48,4 @@ inline float roundf(float r)
 #endif
 
 
-#endif //CROSSPLATFORMDEFINES_H
+#endif //CROSSPLATFORMDEFINES_H

+ 2 - 2
core/basics/FileMgt.cpp

@@ -66,7 +66,7 @@ void FileMgt::DirectoryRecursive ( std::vector<string> & files, const std::strin
 
 	std::sort ( files.begin(), files.end() );
 #else
-	#pragma message WARNING("FileMgt::DirectoryRecursive() : Function not yet ported for platform WIN")
+	#pragma message NICE_WARNING("FileMgt::DirectoryRecursive() : Function not yet ported for platform WIN")
 	fthrow ( Exception, "FileMgt::DirectoryRecursive() : Function not yet ported for platform WIN");
 #endif
 }
@@ -109,7 +109,7 @@ std::string FileMgt::createTempFile ( const std::string & templatefn )
 
     return string(fn);
 #else
-	#pragma message WARNING("FileMgt::createTempFile() : Function not yet ported for platform WIN")
+	#pragma message NICE_WARNING("FileMgt::createTempFile() : Function not yet ported for platform WIN")
 	fthrow ( Exception, "FileMgt::createTempFile() : Function not yet ported for platform WIN");
 #endif
 }

+ 1 - 1
core/basics/ResourceStatistics.cpp

@@ -139,7 +139,7 @@ void ResourceStatistics::getStatistics(long & memory, double & userCpuTime, doub
 /// WIN32 PORT following here
 #include "CrossplatformDefines.h"
 
-#pragma message WARNING("ResourceStatistics class : not yet ported to WIN32 plattform")
+#pragma message NICE_WARNING("ResourceStatistics class : not yet ported to WIN32 plattform")
 
 ResourceStatistics::ResourceStatistics(int _mode)
 {

+ 4 - 4
core/basics/Timer.cpp

@@ -41,7 +41,7 @@ double Timer::getCurrentAbsoluteTime() const {
 	return getNow();
  #else
 	return -1.0;
-	#pragma message WARNING("Timer::getCurrentAbsoluteTime() : not yet ported to WIN32 plattform, returning -1")
+	#pragma message NICE_WARNING("Timer::getCurrentAbsoluteTime() : not yet ported to WIN32 plattform, returning -1")
  #endif
 #else
 #ifdef LIMUN_AIBO_MODE
@@ -93,7 +93,7 @@ double Timer::getNow()
 	return  diff.total_seconds();
  #else
 	return -1.0;
-	#pragma message WARNING("Timer::getNow() : not yet ported to WIN32 plattform, returning -1")
+	#pragma message NICE_WARNING("Timer::getNow() : not yet ported to WIN32 plattform, returning -1")
  #endif
 #else
 #ifdef LIMUN_AIBO_MODE
@@ -125,7 +125,7 @@ long int Timer::getMicroseconds() {
 	return getNow();
  #else
 	return -1.0;
-	#pragma message WARNING("Timer::getMicroseconds() : not yet ported to WIN32 plattform, returning -1")
+	#pragma message NICE_WARNING("Timer::getMicroseconds() : not yet ported to WIN32 plattform, returning -1")
  #endif
 #else
 
@@ -174,7 +174,7 @@ void Timer::reset() {
       return double ( time.tv_sec ) + double ( time.tv_usec ) * 1e-6;
 #else
 		return -1.0;
-		#pragma message WARNING("Timer::convertTime() : not yet ported to WIN32 plattform, returning -1")
+		#pragma message NICE_WARNING("Timer::convertTime() : not yet ported to WIN32 plattform, returning -1")
 #endif
     }
 

+ 1 - 1
core/basics/binstream.h

@@ -327,7 +327,7 @@ inline obinstream& operator<<(obinstream &s, const LinAl::MatrixC<Tp> &A) {
 
 #else
 #ifndef LINAL_WARNING
-#pragma message WARNING("LinAl addons will not be compiled.")
+#pragma message NICE_WARNING("LinAl addons will not be compiled.")
 #define LINAL_WARNING
 #endif
 #endif

+ 1 - 1
core/basics/bzstream.cpp

@@ -163,7 +163,7 @@ void bzstreambase::close() {
 } // namespace
 
 #else
-#pragma message WARNING("bzstream will not be compiled.")
+#pragma message NICE_WARNING("bzstream will not be compiled.")
 #endif
 
 // ============================================================================

+ 1 - 1
core/basics/gzstream.cpp

@@ -162,7 +162,7 @@ void gzstreambase::close() {
 
 #else
 #include "CrossplatformDefines.h"
-#pragma message WARNING("gzstream will not be compiled.")
+#pragma message NICE_WARNING("gzstream will not be compiled.")
 #endif
 
 // ============================================================================

+ 1 - 1
core/basics/numerictools.h

@@ -246,7 +246,7 @@ inline bool isFinite(double x)
 	#ifdef NICE_BOOST_FOUND
 	    return boost::math::isfinite(x);
 	#else
-		ERROR("isFinite() not defined (and neither is boost found for compensation...)")
+		NICE_ERROR("isFinite() not defined (and neither is boost found for compensation...)")
 	#endif
 #else
 	return finite(x);

+ 2 - 2
core/corefiles.cmake

@@ -1,5 +1,5 @@
 # find . -name "*.cpp" -not -ipath "*tests*" -not -ipath "*progs*" > corefiles.cmake.t
-SET(NICE_CORE_SRC
+SET(nice_core_SRC
 ./image/DeprecatedConverter.cpp
 ./image/Histogram.cpp
 ./image/Fourier.cpp
@@ -93,7 +93,7 @@ SET(NICE_CORE_SRC
 ./vector/ippwrapper.cpp
 )
 
-set(NICE_CORE_HDR
+set(nice_core_HDR
 ./image/ColorImageT.h
 ./image/ImageT.h
 ./image/Region.h

+ 6 - 3
core/image/ColorImageT.tcc

@@ -22,8 +22,9 @@ ColorImageT<P>& ColorImageT<P>::operator=(const ColorT<P> &color)
   ippiSet_C3R(color.color(), this->getPixelPointer(), this->getStepsize(),
                 ippiSize);
 #else
-  Ipp8u* pos=reinterpret_cast<Ipp8u*>(this->getPixelPointer());
-  P *row[this->height()];
+  //Ipp8u* pos=reinterpret_cast<Ipp8u*>(this->getPixelPointer());
+  P* pos=reinterpret_cast<P*>(this->getPixelPointer());
+  P **row = new P*[this->height()];
     for(int y=0;y<this->height(); ++y) {
     row[y]=reinterpret_cast<P*>(pos);
     pos+=this->getStepsize();
@@ -37,6 +38,7 @@ ColorImageT<P>& ColorImageT<P>::operator=(const ColorT<P> &color)
         }
         }
   }
+	delete [] p;
 #endif
     return *this;
 }
@@ -50,7 +52,7 @@ ColorImageT<P>& ColorImageT<P>::operator=(const P c[3])
               ippiSize);
 #else
   Ipp8u* pos=reinterpret_cast<Ipp8u*>(this->getPixelPointer());
-  P *row[this->height()];
+  P *row = new P[this->height()];
   for(int y=0;y<this->height(); ++y) {
     row[y]=reinterpret_cast<P*>(pos);
     pos+=this->getStepsize();
@@ -64,6 +66,7 @@ ColorImageT<P>& ColorImageT<P>::operator=(const P c[3])
       }
     }
   }
+  delete [] p;
 #endif
   return *this;
 }

+ 2 - 2
core/image/ColorT.tcc

@@ -91,7 +91,7 @@ T ColorT<T>::gray() const
     #ifdef NICE_USELIB_FBASICS
       fthrow(Exception,"invalid channel number");
     #else
-      std::__throw_range_error("invalid channel number");
+      throw std::range_error("invalid channel number");
     #endif
   }
     // convert rgb to gray
@@ -102,7 +102,7 @@ T ColorT<T>::gray() const
     #ifdef NICE_USELIB_FBASICS
       fthrow(Exception,"invalid channel number");
     #else
-      std::__throw_range_error("invalid channel number");
+      throw std::range_error("invalid channel number");
     #endif
   }
 }

+ 2 - 2
core/image/DeprecatedConverter.cpp

@@ -844,7 +844,7 @@ Image* DeprecatedConverter::filterY(const Image& src, const VectorT<int> &kernel
     return result;
   #else // NICE_USELIB_IPP
   /*
-#warning untested
+#pragma message NICE_WARNING("untested")
     int yend=src.height()-anchor;
     int xend=src.width();
     Image &d=*result;
@@ -903,7 +903,7 @@ Image* DeprecatedConverter::filter(const Image& src, const ImageT<int> &kernel,
     }
   #else // NICE_USELIB_IPP
   /*
-#warning untested
+#pragma message NICE_WARNING("untested")
     int yend=src.height()-anchory;
     int xend=src.width()-anchorx;
     Image &d=*result;

+ 3 - 2
core/image/DeprecatedConverter.tcc

@@ -418,7 +418,7 @@ ImageT<P>* DeprecatedConverter::filterX(const ImageT<P>& src, const VectorT<floa
     return result;
   #else // NICE_USELIB_IPP
 	/*
-#warning untested
+#pragma message NICE_WARNING("untested")
     int yend=src.height();
     int xend=src.width()-kernel.size()+anchor;
     ImageT<P> &d=*result;
@@ -723,6 +723,7 @@ VectorT<int>* DeprecatedConverter::histogram(const ColorImageT<P>& src, int min,
 template <class P>
 VectorT<int>* DeprecatedConverter::histogram(const ColorImageT<P>& src, VectorT<int> *histo, int  min, int max)
 {
+#ifdef NICE_USELIB_IPP
 	int	nolevels=histo->size()/3;
 	int levels[(nolevels+1)*3];
 	int pnolevels[3];
@@ -735,7 +736,7 @@ VectorT<int>* DeprecatedConverter::histogram(const ColorImageT<P>& src, VectorT<
 		pmax[i]=max;
 		pnolevels[i]=nolevels+1;
 	}
-  #ifdef NICE_USELIB_IPP
+ 
 	ippiHistogramEven_C3R(src.getPixelPointer(), src.getStepsize(), makeROIFullImage(src), phisto, plevels, pnolevels, pmin, pmax);
   #else // NICE_USELIB_IPP
     fthrow(ImageException,"Not yet supported without IPP.");

+ 1 - 1
core/image/Drawable.h

@@ -65,7 +65,7 @@ public:
       #ifdef NICE_USELIB_FBASICS
         fthrow(Exception,"color has to few channels");
       #else
-        std::__throw_range_error("color has to few channels"); 
+        throw std::range_error("color has to few channels"); 
       #endif
     else
         doDraw(image, color);

+ 1 - 1
core/image/Filter.h

@@ -19,7 +19,7 @@
 #include <core/image/ColorImageT.h>
 #include <core/image/Buffer.h>
 
-#pragma message WARNING("Filter.h is obsolete. Please use FilterT.h instead and adapt your calls and implement the filter if necessary :)")
+#pragma message NICE_WARNING("Filter.h is obsolete. Please use FilterT.h instead and adapt your calls and implement the filter if necessary :)")
 
 namespace NICE {
 /**

+ 3 - 3
core/image/Pixel.tcc

@@ -52,11 +52,11 @@ T Pixel<T>::gray() const
     if(this->size()==1) {
       return  this->constData[0]; 
     } else if(this->size()==0) {
-      this->__throw_range_error("invalid channel number"); 
+      throw std::range_error("invalid channel number"); 
     } else if(this->size()==3) {
-      this->__throw_range_error("not implemented yet"); 
+      throw std::range_error("not implemented yet"); 
     } else {
-      this->__throw_range_error("invalid channel number"); 
+      throw std::range_error("invalid channel number"); 
     }
 }
 

+ 20 - 20
core/image/tests/TestMorph.cpp

@@ -28,7 +28,7 @@ void TestMorph::testRanking()
         for(int i=1; i<=3; ++i)
             srcall.setPixelQuick(i,j, i+3*(j-1) );
     for(int i=1; i<=9; ++i) {
-        result = rank(srcall, 1,i);
+        result = NICE::rank(srcall, 1,i);
         CPPUNIT_ASSERT_EQUAL(i, static_cast<int>(result->getPixel(2,2)));
     }
 
@@ -40,32 +40,32 @@ void TestMorph::testRanking()
             src(x,y) = x+y;
 
     // test exceptions
-    CPPUNIT_ASSERT_THROW(rank(src,1,0), ImageException);
-    CPPUNIT_ASSERT_THROW(rank(src,1,10), ImageException);
+    CPPUNIT_ASSERT_THROW(NICE::rank(src,1,0), ImageException);
+    CPPUNIT_ASSERT_THROW(NICE::rank(src,1,10), ImageException);
 
     // test ranking operation
         // rank = min
-        result = rank(src, 1,1);
+        result = NICE::rank(src, 1,1);
         for(int j=1; j<height-1; ++j)
             for(int i=1; i<width-1; ++i)
                 CPPUNIT_ASSERT_EQUAL((i-1)+(j-1), static_cast<int>(result->getPixel(i,j)));
         // rank = 2
-        result = rank(src, 1,2,result);
+        result = NICE::rank(src, 1,2,result);
         for(int j=1; j<height-1; ++j)
             for(int i=1; i<width-1; ++i)
                 CPPUNIT_ASSERT_EQUAL(i+j-1      , static_cast<int>(result->getPixel(i,j)));
         // rank = median
-        result = rank(src, 1,5,result);
+        result = NICE::rank(src, 1,5,result);
         for(int j=1; j<height-1; ++j)
             for(int i=1; i<width-1; ++i)
                 CPPUNIT_ASSERT_EQUAL(i+j        , static_cast<int>(result->getPixel(i,j)));
         // rank = 7
-        result = rank(src, 1,7,result);
+        result = NICE::rank(src, 1,7,result);
         for(int j=1; j<height-1; ++j)
             for(int i=1; i<width-1; ++i)
                 CPPUNIT_ASSERT_EQUAL(i+j+1      , static_cast<int>(result->getPixel(i,j)));
         // rank = max
-        result = rank(src, 1,9,result);
+        result = NICE::rank(src, 1,9,result);
         for(int j=1; j<height-1; ++j)
             for(int i=1; i<width-1; ++i)
                 CPPUNIT_ASSERT_EQUAL((i+1)+(j+1), static_cast<int>(result->getPixel(i,j)));
@@ -73,7 +73,7 @@ void TestMorph::testRanking()
     // test IP ranking operation with the help of the testet ranking operation
 
         // rank = min
-        result = rank(src, 1,1);
+        result = NICE::rank(src, 1,1);
         temp   = new Image(src);
         rankingIP(*temp, 1);
 
@@ -81,7 +81,7 @@ void TestMorph::testRanking()
             for(int x=1; x<width-1; ++x)
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*result)(x,y)), static_cast<int>((*temp)(x,y)) );
         // rank = 2
-        result = rank(src, 1,2,result);
+        result = NICE::rank(src, 1,2,result);
         temp   = new Image(src);
         rankingIP(*temp, 2);
         for(int y=1; y<height-1; ++y)
@@ -89,7 +89,7 @@ void TestMorph::testRanking()
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*result)(x,y)), static_cast<int>((*temp)(x,y)) );
 
         // rank = median
-        result = rank(src, 1,5,result);
+        result = NICE::rank(src, 1,5,result);
         temp   = new Image(src);
         rankingIP(*temp, 5);
         for(int y=1; y<height-1; ++y)
@@ -97,7 +97,7 @@ void TestMorph::testRanking()
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*result)(x,y)), static_cast<int>((*temp)(x,y)) );
 
         // rank = 7
-        result = rank(src, 1,7,result);
+        result = NICE::rank(src, 1,7,result);
         temp   = new Image(src);
         rankingIP(*temp, 7);
         for(int y=1; y<height-1; ++y)
@@ -105,7 +105,7 @@ void TestMorph::testRanking()
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*result)(x,y)), static_cast<int>((*temp)(x,y)) );
 
         // rank = max
-        result = rank(src, 1,9,result);
+        result = NICE::rank(src, 1,9,result);
         temp   = new Image(src);
         rankingIP(*temp, 9);
         for(int y=1; y<height-1; ++y)
@@ -404,35 +404,35 @@ void TestMorph::testRankingWithStructure()
 
         // rank = 1
         rresult   = erode(src);
-        result    = rank(src, structure, 1);
+        result    = NICE::rank(src, structure, 1);
         for(int y=1; y<src.height()-1; ++y)
             for(int x=1; x<src.width()-1; ++x)
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*rresult)(x,y)), static_cast<int>((*result)(x,y)) );
 
         // rank = 2
-        rresult   = rank(src, 1, 2, rresult);
-        result    = rank(src, structure, 2, result);
+        rresult   = NICE::rank(src, 1, 2, rresult);
+        result    = NICE::rank(src, structure, 2, result);
         for(int y=1; y<src.height()-1; ++y)
             for(int x=1; x<src.width()-1; ++x)
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*rresult)(x,y)), static_cast<int>((*result)(x,y)) );
 
         // rank = median
         rresult   = median(src, rresult);
-        result    = rank(src, structure, 5, result);
+        result    = NICE::rank(src, structure, 5, result);
         for(int y=1; y<src.height()-1; ++y)
             for(int x=1; x<src.width()-1; ++x)
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*rresult)(x,y)), static_cast<int>((*result)(x,y)) );
 
         // rank = 7
-        rresult   = rank(src, 1, 7, rresult);
-        result    = rank(src, structure, 7, result);
+        rresult   = NICE::rank(src, 1, 7, rresult);
+        result    = NICE::rank(src, structure, 7, result);
         for(int y=1; y<src.height()-1; ++y)
             for(int x=1; x<src.width()-1; ++x)
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*rresult)(x,y)), static_cast<int>((*result)(x,y)) );
 
         // rank = 9
         rresult   = dilate(src, rresult);
-        result    = rank(src, structure, 9, result);
+        result    = NICE::rank(src, structure, 9, result);
         for(int y=1; y<src.height()-1; ++y)
             for(int x=1; x<src.width()-1; ++x)
                 CPPUNIT_ASSERT_EQUAL( static_cast<int>((*rresult)(x,y)), static_cast<int>((*result)(x,y)) );

+ 1 - 1
core/matlabAccess/MatFileIO.h

@@ -20,7 +20,7 @@
 
 #ifndef NICE_USELIB_MATIO
 
-#pragma message WARNING("We need the MATIO Library for accessing MATLAB structures. Otherwise this is not compiling.")
+#pragma message NICE_WARNING("We need the MATIO Library for accessing MATLAB structures. Otherwise this is not compiling.")
 
 #else //#ifdef NICE_USELIB_MATIO
 

+ 2 - 2
core/progfiles.cmake

@@ -1,5 +1,5 @@
 # find . -name "*.cpp" -ipath "*progs*" > progfiles.cmake.t
-set(NICE_PROGFILES_SRC 
+set(nice_core_PROGFILES_SRC 
 ./image/progs/compareImages.cpp
 ./image/progs/convertImageNice.cpp
 ./image/progs/testApproxGaussFilter.cpp
@@ -18,5 +18,5 @@ set(NICE_PROGFILES_SRC
 ./vector/progs/testCholeskySpeed.cpp
 )
 
-set(NICE_PROGFILES_HDR
+set(nice_core_PROGFILES_HDR
 )

+ 2 - 2
core/testfiles.cmake

@@ -1,5 +1,5 @@
 #generated by find . -name "*.cpp" -ipath "*tests*" > testfiles.cmake.t 
-SET(NICE_TESTFILES_SRC 
+SET(nice_core_TESTFILES_SRC 
 ./image/tests/ImageTest.cpp
 ./image/tests/TestImageFile.cpp
 ./image/tests/TestRect.cpp
@@ -39,7 +39,7 @@ SET(NICE_TESTFILES_SRC
 ./vector/tests/TestEMatrix.cpp
 )
 
-SET(NICE_TESTFILES_HDR
+SET(nice_core_TESTFILES_HDR
 ./image/tests/TestRect.h
 ./image/tests/ImageTest.h
 ./image/tests/TestMorph.h

+ 3 - 3
core/vector/Algorithms.cpp

@@ -61,7 +61,7 @@ void choleskyDecompLargeScale ( const Matrix & A, Matrix & G, bool resetUpperTri
 				G(i,j) = 0;
 #else
   #ifndef CHOLESKYLINAL_WARNING
-	#pragma message WARNING("LinAl is not installed: choleskyDecompLargeScale will not be optimized.")
+	#pragma message NICE_WARNING("LinAl is not installed: choleskyDecompLargeScale will not be optimized.")
   #define CHOLESKYLINAL_WARNING
   #endif
 	choleskyDecomp ( A, G, resetUpperTriangle );
@@ -102,7 +102,7 @@ void choleskySolveMatrixLargeScale ( const Matrix & G, Matrix & B )
 		B.getDataPointer(), &ldb, &info );
 #else
   #ifndef CHOLESKYLINAL_WARNING
-	#warning "LinAl is not installed: choleskyInvertLargeScale will not be optimized."
+	#pragma message NICE_WARNING("LinAl is not installed: choleskyInvertLargeScale will not be optimized.")
   #define CHOLESKYLINAL_WARNING
   #endif
 	choleskyInvert ( G, B );
@@ -209,7 +209,7 @@ void choleskySolveLargeScale ( const Matrix & G, const Vector & b, Vector & x )
 
 #else
   #ifndef CHOLESKYLINAL_WARNING
-	#warning "LinAl is not installed: choleskyInvertLargeScale will not be optimized."
+	#pragma message NICE_WARNING("LinAl is not installed: choleskyInvertLargeScale will not be optimized.")
   #define CHOLESKYLINAL_WARNING
   #endif
 	choleskySolve ( G, b, x );

+ 1 - 1
core/vector/CheckedMatrixT.h

@@ -89,7 +89,7 @@ public:
   operator()(const ptrdiff_t i, const ptrdiff_t j) {
     if (i < 0 || static_cast<unsigned int>(i) >= this->rows()
         || j < 0 || static_cast<unsigned int>(j) >= this->cols()) {
-        std::out_of_range("MatrixT () access out of range"); 
+        throw std::out_of_range("MatrixT () access out of range"); 
     }
     return MatrixT<ElementType>::operator()(i, j);
   }

+ 1 - 1
core/vector/CheckedRowMatrixT.h

@@ -70,7 +70,7 @@ public:
   operator()(const ptrdiff_t i, const ptrdiff_t j) {
     if (i < 0 || static_cast<unsigned int>(i) >= this->rows()
         || j < 0 || static_cast<unsigned int>(j) >= this->cols()) {
-        std::out_of_range("RowMatrixT () access out of range"); 
+        throw std::out_of_range("RowMatrixT () access out of range"); 
     }
     return RowMatrixT<ElementType>::operator()(i, j);
   }

+ 1 - 1
core/vector/CheckedVectorT.h

@@ -61,7 +61,7 @@ public:
   inline typename VectorT<ElementType>::reference
   operator[](const ptrdiff_t i) {
     if (i < 0 || static_cast<unsigned int>(i) >= this->size()) {
-		std::out_of_range("VectorT () access out of range"); 
+		throw std::out_of_range("VectorT () access out of range"); 
     }
     return this->data[i];
   }

+ 1 - 1
core/vector/Distance.tcc

@@ -45,7 +45,7 @@ T EuclidianDistance<T>::doCalculate(const VectorT<T>& v1, const VectorT<T>& v2)
 
 //     #endif // NICE_USELIB_IPP
 
-    return T(std::sqrt(dist));
+    return T(std::sqrt( (double) dist)); //double cast neccessary, otherwise the template cast is disambigous
 }
 
 

+ 2 - 2
core/vector/Eigen.h

@@ -87,8 +87,8 @@ VectorT<T> *Arnoldi_MGS(const MatrixT<T> &A, size_t nr, VectorT<T> *v=NULL)
 
 }
 
-#ifdef __GNUC__
+//#ifdef __GNUC__
   #include <core/vector/Eigen.tcc>
-#endif
+//#endif
 
 #endif // EIGEN_H

+ 4 - 3
core/vector/Eigen.tcc

@@ -30,7 +30,7 @@ VectorT<T> maxEigenVector(const MatrixT<T>& a) {
 }
 
 template<class T>
-VectorT<T> *eigenvalues(const MatrixT<T> &A, VectorT<T> *evals=NULL)
+VectorT<T> *eigenvalues(const MatrixT<T> &A, VectorT<T> *evals)
 {
     size_t vsize=A.cols();
     if(A.rows()!=vsize)
@@ -61,17 +61,18 @@ void eigenvectorvalues(const MatrixT<T> &A, MatrixT<T> &evecs,  VectorT<T> &eval
         evecs.resize(vsize,vsize);
     if(evals.size()!=vsize)
         evals.resize(vsize);
-    T buffer[vsize*vsize];
+    T *buffer = new T[vsize*vsize];
     size_t tsize=sizeof(T);
     IppStatus ret = ippmEigenValuesVectorsSym_m(A.getDataPointer(), vsize*tsize, tsize, buffer,
                                                 evecs.getDataPointer(), vsize*tsize, tsize, evals.getDataPointer(), vsize);
     evecs.transposeInplace();
+	delete [] buffer;
 	if(ret!=ippStsNoErr)
 	   _THROW_EVector(ippGetStatusString(ret));
 }
 
 template<class T>
-VectorT<T> *eigenvalues(const RowMatrixT<T> &A, VectorT<T> *evals=NULL)
+VectorT<T> *eigenvalues(const RowMatrixT<T> &A, VectorT<T> *evals)
 {
     size_t vsize=A.cols();
     if(A.rows()!=vsize)

+ 1 - 1
core/vector/SVD.h

@@ -119,7 +119,7 @@ inline void enforceRankDefect(MatrixT<T>& m, const uint defect) {
 
 #else // no LinAl
 #ifndef SVDLINAL_WARNING
-#pragma message WARNING("SVD requires LinAl.")
+#pragma message NICE_WARNING("SVD requires LinAl.")
 #define SVDLINAL_WARNING
 #endif
 #endif

+ 1 - 1
core/vector/SparseVector.h

@@ -1,2 +1,2 @@
 #include "core/vector/SparseVectorT.h"
-#warning "SparseVector.h is obsolete. Please use SparseVectorT.h instead"
+#pragma message NICE_WARNING("SparseVector.h is obsolete. Please use SparseVectorT.h instead")

+ 2 - 2
core/vector/VectorT.tcc

@@ -266,7 +266,7 @@ const ElementType& VectorT<ElementType>::operator()(const ptrdiff_t i) const
 {
     if((ptrdiff_t)dataSize<=i||i<0) {
         //std::__throw_out_of_range("VectorT () access out of range");
-		std::out_of_range("VectorT () access out of range");
+		throw std::out_of_range("VectorT () access out of range");
     }
     return constData[i];
 }
@@ -275,7 +275,7 @@ template<class ElementType>
 ElementType& VectorT<ElementType>::operator()(const ptrdiff_t i) {
     if((ptrdiff_t)dataSize<=i||i<0) {
         //std::__throw_out_of_range("VectorT () access out of range");
-		std::out_of_range("VectorT () access out of range");
+		throw std::out_of_range("VectorT () access out of range");
     }
     return data[i];
 }

+ 1 - 1
core/vector/ippwrapper.h

@@ -17,7 +17,7 @@
     #include <ipps.h>
     #include <ippm.h>
   #else
-    #warning "Not fully supported with IPP < 4"
+	#pragma message NICE_WARNING("Not fully supported with IPP < 4")
   #endif
 
 #else // NICE_USELIB_IPP

+ 1 - 1
core/vector/ippwrapper.tcc

@@ -1653,7 +1653,7 @@ template<class P>
 inline IppStatus ippsNorm_L2(const P* pSrc, int len, P* pNorm) {
  if(len==0)
      return ippStsSizeErr;
- *pNorm = static_cast<P>(::sqrt(std::inner_product(pSrc, pSrc + len, pSrc, static_cast<P>(0))));
+ *pNorm = static_cast<P>(::sqrt((double)std::inner_product(pSrc, pSrc + len, pSrc, static_cast<P>(0))));
  return ippStsNoErr;
 }
 template<class P1, class P2>

+ 25 - 3
readme.txt

@@ -112,10 +112,32 @@ NICE_USELIB_JPG
 NICE_USELIB_LIBMAGICK
 
 #eigene definiton zum builden der sub-test-ordners
-NICE_BUILD_TESTS	 http://www.comp.nus.edu.sg/~cs3215/tools/cppunitAll.html
-running tests: <build ordner>: cmake
-running tests mit schönen übersicht: <build ordner>: cmake --output-on-failure
 
+--------------- CPPUNIT verwenden ---------------------
+1) installation
+1-a) linux
+  if not already in path then:
+    download source from http://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz/download
+    unzip
+    create build_<pcname> dir
+    cd build_<pcname>
+    ../configure - -prefix=<path>/build_<pcname>/install
+    make 
+    make install
+    put <path>/build_<pcname>/install/include into system path variable, example in .bashrc:
+    PATH=/home/ruehle/libs/cppunit-1.12.1/build_sigma15/install/include/:$PATH
+
+1-b) Windows:
+  download http://www.comp.nus.edu.sg/~cs3215/tools/cppunitAll.html
+  build with visual studio
+  put path to generated lib in path variable (pointing to the */include path)
+2) enabling building cpp unit tests
+  NICE_BUILD_TESTS   
+  running tests: <build ordner>: cmake
+  make
+3) run the unit tests
+im <build ordner>: cmake --output-on-failure
+--------------------------------------------------------------
 
 NICE_BUILD_PROGS