[pktools] 01/01: Imported Upstream version 2.5.2

Francesco Lovergine frankie at moszumanska.debian.org
Thu Mar 27 15:30:19 UTC 2014


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

frankie pushed a commit to branch upstream
in repository pktools.

commit 9b0bef3dca604c2df36ea291448024d3742f898b
Author: Francesco Paolo Lovergine <frankie at debian.org>
Date:   Thu Mar 27 15:55:57 2014 +0100

    Imported Upstream version 2.5.2
---
 ChangeLog                                    |  25 ++-
 Makefile.in                                  |   1 +
 README                                       |   2 +-
 config.h                                     |   6 +-
 configure                                    |  28 ++-
 configure.ac                                 |   8 +-
 src/algorithms/Egcs.cc                       |   6 +-
 src/algorithms/Egcs.h                        |   4 +-
 src/algorithms/FeatureSelector.h             |   4 +-
 src/algorithms/Filter.h                      |  12 +-
 src/algorithms/Filter2d.cc                   |  20 +-
 src/algorithms/Filter2d.h                    |  34 +--
 src/algorithms/Makefile.am                   |   7 +-
 src/algorithms/Makefile.in                   |   9 +-
 src/algorithms/StatFactory.h                 |  67 +++---
 src/algorithms/myfann_cpp.h                  |   2 +-
 src/apps/Makefile.am                         |  36 ++--
 src/apps/Makefile.in                         | 305 +++++++++++++--------------
 src/apps/{pkclassify_nn.cc => pkann.cc}      |  17 +-
 src/apps/pkascii2img.cc                      |   2 +-
 src/apps/{pkmosaic.cc => pkcomposit.cc}      |   2 +-
 src/apps/pkdiff.cc                           |   2 +-
 src/apps/pkdumpimg.cc                        |   2 +-
 src/apps/pkextract.cc                        |  25 +--
 src/apps/{pkfs_nn.cc => pkfsann.cc}          |  30 +--
 src/apps/{pkfs_svm.cc => pkfssvm.cc}         |   6 +-
 src/apps/pklas2img.cc                        |   4 +-
 src/apps/{pkopt_svm.cc => pkoptsvm.cc}       |   8 +-
 src/apps/{pkregression_nn.cc => pkregann.cc} |   3 +-
 src/apps/pkstatascii.cc                      |   8 +-
 src/apps/{pkclassify_svm.cc => pksvm.cc}     |  15 +-
 src/base/Makefile.am                         |   7 +-
 src/base/Makefile.in                         |   9 +-
 src/base/Optionpk.h                          | 209 +++++++++---------
 src/base/Vector2d.h                          |   4 +-
 src/fileclasses/Makefile.am                  |   7 +-
 src/fileclasses/Makefile.in                  |   9 +-
 src/imageclasses/ImgReaderGdal.h             |   6 +-
 src/imageclasses/ImgWriterGdal.h             |   2 +-
 src/imageclasses/Makefile.am                 |   7 +-
 src/imageclasses/Makefile.in                 |   9 +-
 src/lasclasses/Makefile.am                   |   7 +-
 src/lasclasses/Makefile.in                   |   9 +-
 43 files changed, 547 insertions(+), 438 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 50ad0a3..d0ef20a 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -261,8 +261,27 @@ version 2.5.1
 	no automatic normalization user provided filter taps
  - pkcrop
 	correct bounding box when dx_opt and dy_opt are set
-version 2.5.2 (todo)
- - pkcrop -> pkcropnmerge
-	name was confusing as pkcrop supports spatial and spectral subsetting and merging
+ - pksieve
+	retain nodata in pksieve when mask is set
+version 2.5.2
+ - programs ported to windows and GUI with Qt
+	removed underscore for QProcess in Windows
+ - pkclassify_svm -> pksvm
+	removed underscore for QProcess in Windows
+ - pkclassify_nn -> pkann
+	removed underscore for QProcess in Windows
+ - pkregression_nn -> pkregann
+	removed underscore for QProcess in Windows
+ - pkfs_svm -> pkfssvm
+	removed underscore for QProcess in Windows
+ - pkfs_nn -> pkfsann
+	removed underscore for QProcess in Windows
+ - pkopt_svm -> pkoptsvm
+	removed underscore for QProcess in Windows
  - pkmosaic -> pkcomposit
 	name was confusing as also compositing is supported (unlike gdal_merge.py and gdalwarp)
+ - version control for libraries
+	thanks to suggestion of Francesco Paolo Lovergine
+ - subdirectory pktools for include headers
+	thanks to suggestion of Francesco Paolo Lovergine
+ -
diff --git a/Makefile.in b/Makefile.in
index 2f7ae25..5bd6c1b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -209,6 +209,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
diff --git a/README b/README
index a00e753..eca0de8 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 Description of pktools
 ----------------------
-The version of this pktools distribution is 2.4
+The version of this pktools distribution is 2.5.1
 pktools is a collection of programs written in C++ to perform operations, mostly on raster images. It heavily relies on the Geospatial Data Abstraction Library (GDAL, http://www.gdal.org) and OGR. The programs are similar to the gdal tools (gdalinfo, gdal_translate, gdal_merge,...) and some of the functionalities provided in pktools already exist in the gdal tools. The reason for implementing pktools is a combination of personal preference and additional functionality.
 
 License and distribution
diff --git a/config.h b/config.h
index 9bfbed3..975dcb0 100644
--- a/config.h
+++ b/config.h
@@ -60,7 +60,7 @@
 #define PACKAGE_NAME "pktools"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "pktools 2.5.1"
+#define PACKAGE_STRING "pktools 2.5.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "pktools"
@@ -69,13 +69,13 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "2.5.1"
+#define PACKAGE_VERSION "2.5.2"
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
 
 /* Version number of package */
-#define VERSION "2.5.1"
+#define VERSION "2.5.2"
 
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 /* #undef size_t */
diff --git a/configure b/configure
index 66c241e..05b6c09 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pktools 2.5.1.
+# Generated by GNU Autoconf 2.69 for pktools 2.5.2.
 #
 # Report bugs to <kempenep at gmail.com>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='pktools'
 PACKAGE_TARNAME='pktools'
-PACKAGE_VERSION='2.5.1'
-PACKAGE_STRING='pktools 2.5.1'
+PACKAGE_VERSION='2.5.2'
+PACKAGE_STRING='pktools 2.5.2'
 PACKAGE_BUGREPORT='kempenep at gmail.com'
 PACKAGE_URL=''
 
@@ -636,6 +636,7 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+PKTOOLS_SO_VERSION
 AM_LDFLAGS
 AM_CXXFLAGS
 USE_GSL_FALSE
@@ -1360,7 +1361,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures pktools 2.5.1 to adapt to many kinds of systems.
+\`configure' configures pktools 2.5.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1430,7 +1431,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pktools 2.5.1:";;
+     short | recursive ) echo "Configuration of pktools 2.5.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1552,7 +1553,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pktools configure 2.5.1
+pktools configure 2.5.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2313,7 +2314,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by pktools $as_me 2.5.1, which was
+It was created by pktools $as_me 2.5.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3129,7 +3130,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='pktools'
- VERSION='2.5.1'
+ VERSION='2.5.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19436,6 +19437,13 @@ fi
 
 
 
+# Define these substitions here to keep all version information in one place.
+# For information on how to properly maintain the library version information,
+# refer to the libtool manual, section "Updating library version information":
+# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+PKTOOLS_SO_VERSION=1:0:0
+
+
 # files to generate via autotools (.am or .in source files)
 ac_config_headers="$ac_config_headers config.h"
 
@@ -20001,7 +20009,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by pktools $as_me 2.5.1, which was
+This file was extended by pktools $as_me 2.5.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20067,7 +20075,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-pktools config.status 2.5.1
+pktools config.status 2.5.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index b9f6825..fae3f47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pktools], [2.5.1], [kempenep at gmail.com])
+AC_INIT([pktools], [2.5.2], [kempenep at gmail.com])
 #AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AM_INIT_AUTOMAKE([-Wall -Wno-extra-portability foreign])
 AC_CONFIG_MACRO_DIR([m4])
@@ -92,6 +92,12 @@ AC_SUBST([AM_CXXFLAGS])
 AC_SUBST([AM_LDFLAGS])
 AC_SUBST([LIBS])
 
+# Define these substitions here to keep all version information in one place.
+# For information on how to properly maintain the library version information,
+# refer to the libtool manual, section "Updating library version information":
+# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+AC_SUBST([PKTOOLS_SO_VERSION], [1:0:0])
+
 # files to generate via autotools (.am or .in source files)
 AC_CONFIG_HEADERS([config.h])
 
diff --git a/src/algorithms/Egcs.cc b/src/algorithms/Egcs.cc
index ddbf20b..9810875 100644
--- a/src/algorithms/Egcs.cc
+++ b/src/algorithms/Egcs.cc
@@ -57,14 +57,14 @@ Egcs::~Egcs(){
 }
 
 unsigned short Egcs::res2level(double resolution) const{
-  double base=pow(10,log(resolution*4)/log(10));
+  double base=pow(10,log(resolution*4.0)/log(10.0));
   double diff=base/(2*resolution);
-  return 0.5+(log(base)/log(10)*3+1-diff);
+  return 0.5+(log(base)/log(10.0)*3+1-diff);
 }
 
 double Egcs::getResolution() const{
   unsigned short exponent=(m_level+1)/3;
-  double base=pow(10,exponent);
+  double base=pow(10.0,exponent);
   if((m_level)%3==2)
     return(base/4);
   else if((m_level)%3==0)
diff --git a/src/algorithms/Egcs.h b/src/algorithms/Egcs.h
index d1fdafd..8bf5e2b 100644
--- a/src/algorithms/Egcs.h
+++ b/src/algorithms/Egcs.h
@@ -32,7 +32,7 @@ public:
   ~Egcs();
   unsigned short cell2level(const std::string& cellCode) const;
   std::string geo2cell(double x, double y) const;
-  double getSize() const {return getBaseSize()*pow(2,(m_level-19)%3);};
+  double getSize() const {return getBaseSize()*pow(2.0,(m_level-19)%3);};
   void setLevel(unsigned short level){m_level=level;};
   unsigned short getLevel() const{return m_level;};
   unsigned short res2level(double resolution) const;
@@ -41,7 +41,7 @@ public:
   void cell2bb(const std::string& cellCode, int &ulx, int &uly, int &lrx, int &lry) const;
   void cell2mid(const std::string& cellCode, double& midX, double& midY) const;
 private:
-  int getBaseSize() const {return pow(10,(m_level+1)/3);};
+  int getBaseSize() const {return pow(10.0,(m_level+1)/3);};
   unsigned short m_level;
 // level square scheme         example
 // 19    1000km xy             32
diff --git a/src/algorithms/FeatureSelector.h b/src/algorithms/FeatureSelector.h
index fafd98a..b57771e 100644
--- a/src/algorithms/FeatureSelector.h
+++ b/src/algorithms/FeatureSelector.h
@@ -26,8 +26,8 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include <algorithm>
 #include <iostream>
 #include <iomanip>
-#include "IndexValue.h"
-#include "Vector2d.h"
+#include "base/IndexValue.h"
+#include "base/Vector2d.h"
 #include "gsl/gsl_combination.h"
 
 class FeatureSelector
diff --git a/src/algorithms/Filter.h b/src/algorithms/Filter.h
index d843ded..3cdab8e 100644
--- a/src/algorithms/Filter.h
+++ b/src/algorithms/Filter.h
@@ -486,10 +486,10 @@ template<class T> void Filter::morphology(const std::vector<T>& input, std::vect
     }
     switch(getFilterType(method)){
     case(filter::dilate):
-      output[(i-offset+down-1)/down]=stat.max(statBuffer);
+      output[(i-offset+down-1)/down]=stat.mymax(statBuffer);
       break;
     case(filter::erode):
-      output[(i-offset+down-1)/down]=stat.min(statBuffer);
+      output[(i-offset+down-1)/down]=stat.mymin(statBuffer);
       break;
     default:
       std::string errorString="method not supported";
@@ -526,10 +526,10 @@ template<class T> void Filter::morphology(const std::vector<T>& input, std::vect
     }
     switch(getFilterType(method)){
     case(filter::dilate):
-      output[(i-offset+down-1)/down]=stat.max(statBuffer);
+      output[(i-offset+down-1)/down]=stat.mymax(statBuffer);
       break;
     case(filter::erode):
-      output[(i-offset+down-1)/down]=stat.min(statBuffer);
+      output[(i-offset+down-1)/down]=stat.mymin(statBuffer);
       break;
     default:
       std::string errorString="method not supported";
@@ -580,10 +580,10 @@ template<class T> void Filter::morphology(const std::vector<T>& input, std::vect
     }
     switch(getFilterType(method)){
     case(filter::dilate):
-      output[(i-offset+down-1)/down]=stat.max(statBuffer);
+      output[(i-offset+down-1)/down]=stat.mymax(statBuffer);
       break;
     case(filter::erode):
-      output[(i-offset+down-1)/down]=stat.min(statBuffer);
+      output[(i-offset+down-1)/down]=stat.mymin(statBuffer);
       break;
     default:
       std::string errorString="method not supported";
diff --git a/src/algorithms/Filter2d.cc b/src/algorithms/Filter2d.cc
index 5ca73a2..8cf0db0 100644
--- a/src/algorithms/Filter2d.cc
+++ b/src/algorithms/Filter2d.cc
@@ -479,14 +479,14 @@ void filter2d::Filter2d::doit(const ImgReaderGdal& input, ImgWriterGdal& output,
           if(windowBuffer.empty())
             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;
           else
-           outBuffer[x/down]=stat.min(windowBuffer);
+           outBuffer[x/down]=stat.mymin(windowBuffer);
           break;
         }
         case(filter2d::ismin):{
            if(windowBuffer.empty())
             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;
           else
-            outBuffer[x/down]=(stat.min(windowBuffer)==windowBuffer[centre])? 1:0;
+            outBuffer[x/down]=(stat.mymin(windowBuffer)==windowBuffer[centre])? 1:0;
           break;
         }
         case(filter2d::minmax):{//is the same as homog?
@@ -507,14 +507,14 @@ void filter2d::Filter2d::doit(const ImgReaderGdal& input, ImgWriterGdal& output,
           if(windowBuffer.empty())
             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;
           else
-            outBuffer[x/down]=stat.max(windowBuffer);
+            outBuffer[x/down]=stat.mymax(windowBuffer);
           break;
         }
         case(filter2d::ismax):{
           if(windowBuffer.empty())
             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;
           else
-            outBuffer[x/down]=(stat.max(windowBuffer)==windowBuffer[centre])? 1:0;
+            outBuffer[x/down]=(stat.mymax(windowBuffer)==windowBuffer[centre])? 1:0;
           break;
         }
         case(filter2d::order):{
@@ -523,8 +523,8 @@ void filter2d::Filter2d::doit(const ImgReaderGdal& input, ImgWriterGdal& output,
           else{
             double lbound=0;
             double ubound=dimX*dimY;
-            double theMin=stat.min(windowBuffer);
-            double theMax=stat.max(windowBuffer);
+            double theMin=stat.mymin(windowBuffer);
+            double theMax=stat.mymax(windowBuffer);
             double scale=(ubound-lbound)/(theMax-theMin);
             outBuffer[x/down]=static_cast<short>(scale*(windowBuffer[centre]-theMin)+lbound);
           }
@@ -1072,10 +1072,10 @@ void filter2d::Filter2d::morphology(const ImgReaderGdal& input, ImgWriterGdal& o
 	  if(statBuffer.size()){
             switch(getFilterType(method)){
             case(filter2d::dilate):
-              outBuffer[x]=stat.max(statBuffer);
+              outBuffer[x]=stat.mymax(statBuffer);
               break;
             case(filter2d::erode):
-              outBuffer[x]=stat.min(statBuffer);
+              outBuffer[x]=stat.mymin(statBuffer);
               break;
             default:
               std::ostringstream ess;
@@ -1146,7 +1146,7 @@ void filter2d::Filter2d::linearFeature(const ImgReaderGdal& input, ImgWriterGdal
   std::vector< Vector2d<float> > outputBuffer;
   input.readDataBlock(inputBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, band);
   if(maxDistance<=0)
-    maxDistance=sqrt(input.nrOfCol()*input.nrOfRow());
+    maxDistance=sqrt(static_cast<float>(input.nrOfCol()*input.nrOfRow()));
   linearFeature(inputBuffer,outputBuffer,angle,angleStep,maxDistance,eps, l1, a1, l2, a2,verbose);
   for(int iband=0;iband<outputBuffer.size();++iband)
     output.writeDataBlock(outputBuffer[iband],GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);
@@ -1168,7 +1168,7 @@ void filter2d::Filter2d::linearFeature(const Vector2d<float>& input, std::vector
   for(int iband=0;iband<output.size();++iband)
     output[iband].resize(input.nRows(),input.nCols());
   if(maxDistance<=0)
-    maxDistance=sqrt(input.nRows()*input.nCols());
+    maxDistance=sqrt(static_cast<float>(input.nRows()*input.nCols()));
   int indexI=0;
   int indexJ=0;
   const char* pszMessage;
diff --git a/src/algorithms/Filter2d.h b/src/algorithms/Filter2d.h
index de44136..8d3717c 100644
--- a/src/algorithms/Filter2d.h
+++ b/src/algorithms/Filter2d.h
@@ -32,6 +32,11 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #define RAD2DEG(RAD) (RAD/PI*180)
 #endif
 
+#ifdef WIN32
+#include <process.h>
+#define getpid _getpid
+#endif
+
 #include <assert.h>
 #include <math.h>
 #include <limits>
@@ -115,7 +120,7 @@ public:
   void shadowDsm(const ImgReaderGdal& input, ImgWriterGdal& output, double sza, double saa, double pixelSize, short shadowFlag=1);
   void dwt_texture(const std::string& inputFilename, const std::string& outputFilename,int dim, int scale, int down=1, int iband=0, bool verbose=false);
   void shift(const ImgReaderGdal& input, ImgWriterGdal& output, double offsetX=0, double offsetY=0, double randomSigma=0, RESAMPLE resample=BILINEAR, bool verbose=false);
-  template<class T> void shift(const Vector2d<T>& input, Vector2d<T>& output, double offsetX=0, double offsetY=0, double randomSigma=0, RESAMPLE resample=0, bool verbose=false);
+  template<class T> void shift(const Vector2d<T>& input, Vector2d<T>& output, double offsetX=0, double offsetY=0, double randomSigma=0, RESAMPLE resample=NEAR, bool verbose=false);
   void linearFeature(const Vector2d<float>& input, std::vector< Vector2d<float> >& output, float angle=361, float angleStep=1, float maxDistance=0, float eps=0, bool l1=true, bool a1=true, bool l2=true, bool a2=true, bool verbose=false);
   void linearFeature(const ImgReaderGdal& input, ImgWriterGdal& output, float angle=361, float angleStep=1, float maxDistance=0, float eps=0, bool l1=true, bool a1=true, bool l2=true, bool a2=true, int band=0, bool verbose=false);
   
@@ -358,14 +363,14 @@ template<class T1, class T2> void Filter2d::doit(const Vector2d<T1>& inputVector
         if(windowBuffer.empty())
           outBuffer[x/down]=noDataValue;
         else
-          outBuffer[x/down]=stat.min(windowBuffer);
+          outBuffer[x/down]=stat.mymin(windowBuffer);
         break;
       }
       case(filter2d::ismin):{
         if(windowBuffer.empty())
           outBuffer[x/down]=noDataValue;
         else
-          outBuffer[x/down]=(stat.min(windowBuffer)==windowBuffer[centre])? 1:0;
+          outBuffer[x/down]=(stat.mymin(windowBuffer)==windowBuffer[centre])? 1:0;
         break;
       }
       case(filter2d::minmax):{
@@ -386,14 +391,14 @@ template<class T1, class T2> void Filter2d::doit(const Vector2d<T1>& inputVector
         if(windowBuffer.empty())
           outBuffer[x/down]=noDataValue;
         else
-          outBuffer[x/down]=stat.max(windowBuffer);
+          outBuffer[x/down]=stat.mymax(windowBuffer);
         break;
       }
       case(filter2d::ismax):{
         if(windowBuffer.empty())
           outBuffer[x/down]=noDataValue;
         else
-          outBuffer[x/down]=(stat.max(windowBuffer)==windowBuffer[centre])? 1:0;
+          outBuffer[x/down]=(stat.mymax(windowBuffer)==windowBuffer[centre])? 1:0;
         break;
       }
       case(filter2d::order):{
@@ -402,8 +407,8 @@ template<class T1, class T2> void Filter2d::doit(const Vector2d<T1>& inputVector
         else{
           double lbound=0;
           double ubound=dimX*dimY;
-          double theMin=stat.min(windowBuffer);
-          double theMax=stat.max(windowBuffer);
+          double theMin=stat.mymin(windowBuffer);
+          double theMax=stat.mymax(windowBuffer);
           double scale=(ubound-lbound)/(theMax-theMin);
           outBuffer[x/down]=static_cast<short>(scale*(windowBuffer[centre]-theMin)+lbound);
         }
@@ -707,14 +712,14 @@ template<class T> unsigned long int Filter2d::morphology(const Vector2d<T>& inpu
         if(statBuffer.size()){
           switch(getFilterType(method)){
           case(filter2d::dilate):
-            if(output[y][x]<stat.max(statBuffer)-hThreshold){
-              output[y][x]=stat.max(statBuffer);
+            if(output[y][x]<stat.mymax(statBuffer)-hThreshold){
+              output[y][x]=stat.mymax(statBuffer);
               ++nchange;
             }
             break;
           case(filter2d::erode):
-            if(output[y][x]>stat.min(statBuffer)+hThreshold){
-              output[y][x]=stat.min(statBuffer);
+            if(output[y][x]>stat.mymin(statBuffer)+hThreshold){
+              output[y][x]=stat.mymin(statBuffer);
               ++nchange;
             }
             break;
@@ -800,7 +805,8 @@ template<class T> void Filter2d::dwtForward(Vector2d<T>& theBuffer, const std::s
   for(int irow=0;irow<theBuffer.size();++irow)
     while(theBuffer[irow].size()&(theBuffer[irow].size()-1))
       theBuffer[irow].push_back(theBuffer[irow].back());
-  double data[theBuffer.size()*theBuffer[0].size()];
+  std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());
+  double* data=&(vdata[0]);
   for(int irow=0;irow<theBuffer.size();++irow){
     for(int icol=0;icol<theBuffer[0].size();++icol){
       int index=irow*theBuffer[0].size()+icol;
@@ -846,7 +852,9 @@ template<class T> void Filter2d::dwtInverse(Vector2d<T>& theBuffer, const std::s
   for(int irow=0;irow<theBuffer.size();++irow)
     while(theBuffer[irow].size()&(theBuffer[irow].size()-1))
       theBuffer[irow].push_back(theBuffer[irow].back());
-  double data[theBuffer.size()*theBuffer[0].size()];
+  std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());
+  double* data=&(vdata[0]);
+  //double data[theBuffer.size()*theBuffer[0].size()];
   for(int irow=0;irow<theBuffer.size();++irow){
     for(int icol=0;icol<theBuffer[0].size();++icol){
       int index=irow*theBuffer[0].size()+icol;
diff --git a/src/algorithms/Makefile.am b/src/algorithms/Makefile.am
index 1fb3917..f06c8ff 100644
--- a/src/algorithms/Makefile.am
+++ b/src/algorithms/Makefile.am
@@ -17,7 +17,12 @@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@
 lib_LTLIBRARIES = libalgorithms.la
 
 # where to install the headers on the system
-libalgorithms_ladir = $(includedir)/algorithms
+libalgorithms_ladir = $(includedir)/pktools/algorithms
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libalgorithms_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libalgorithms_la_HEADERS = Egcs.h Filter2d.h Filter.h StatFactory.h ConfusionMatrix.h svm.h FeatureSelector.h
diff --git a/src/algorithms/Makefile.in b/src/algorithms/Makefile.in
index c9338ea..4e47a6d 100644
--- a/src/algorithms/Makefile.in
+++ b/src/algorithms/Makefile.in
@@ -108,6 +108,9 @@ am__objects_2 = $(am__objects_1) $(am__objects_1)
 am_libalgorithms_la_OBJECTS = $(am__objects_2) Egcs.lo Filter2d.lo \
 	Filter.lo ConfusionMatrix.lo svm.lo
 libalgorithms_la_OBJECTS = $(am_libalgorithms_la_OBJECTS)
+libalgorithms_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(libalgorithms_la_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -223,6 +226,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -300,7 +304,8 @@ top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libalgorithms.la
 
 # where to install the headers on the system
-libalgorithms_ladir = $(includedir)/algorithms
+libalgorithms_ladir = $(includedir)/pktools/algorithms
+libalgorithms_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libalgorithms_la_HEADERS = Egcs.h Filter2d.h Filter.h StatFactory.h \
@@ -376,7 +381,7 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	done
 libalgorithms.la: $(libalgorithms_la_OBJECTS) $(libalgorithms_la_DEPENDENCIES) $(EXTRA_libalgorithms_la_DEPENDENCIES) 
-	$(CXXLINK) -rpath $(libdir) $(libalgorithms_la_OBJECTS) $(libalgorithms_la_LIBADD) $(LIBS)
+	$(libalgorithms_la_LINK) -rpath $(libdir) $(libalgorithms_la_OBJECTS) $(libalgorithms_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
diff --git a/src/algorithms/StatFactory.h b/src/algorithms/StatFactory.h
index e59b192..ed053a7 100644
--- a/src/algorithms/StatFactory.h
+++ b/src/algorithms/StatFactory.h
@@ -135,25 +135,28 @@ public:
     }
     return randValue;
   };
-  template<class T> T min(const std::vector<T>& v) const;
-  template<class T> T max(const std::vector<T>& v) const;
-  template<class T> T min(const std::vector<T>& v, T minConstraint) const;
-  template<class T> T max(const std::vector<T>& v, T maxConstraint) const;
-//   template<class T> typename std::vector<T>::const_iterator max(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
-  template<class T> typename std::vector<T>::const_iterator min(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
-  template<class T> typename std::vector<T>::iterator min(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const;
-  template<class T> typename std::vector<T>::const_iterator min(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T minConstraint) const;
-  template<class T> typename std::vector<T>::iterator min(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T minConstraint) const;
-  template<class T> typename std::vector<T>::const_iterator max(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
-  template<class T> typename std::vector<T>::iterator max(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const;
-  template<class T> typename std::vector<T>::const_iterator max(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T maxConstraint) const;
-  template<class T> typename std::vector<T>::iterator max(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T maxConstraint) const;
+  
+
+  template<class T> T mymin(const typename std::vector<T>& v) const;
+  template<class T> T mymax(const typename std::vector<T>& v) const;
+  template<class T> T mymin(const typename std::vector<T>& v, T minConstraint) const;
+  template<class T> T mymax(const typename std::vector<T>& v, T maxConstraint) const;
+//   template<class T> typename std::vector<T>::const_iterator mymax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
+  template<class T> typename std::vector<T>::const_iterator mymin(const typename std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
+  template<class T> typename std::vector<T>::iterator mymin(const typename std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const;
+  template<class T> typename std::vector<T>::const_iterator mymin(const typename std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T minConstraint) const;
+  template<class T> typename std::vector<T>::iterator mymin(const typename std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T minConstraint) const;
+  template<class T> typename std::vector<T>::const_iterator mymax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
+  template<class T> typename std::vector<T>::iterator mymax(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const;
+  template<class T> typename std::vector<T>::const_iterator mymax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T maxConstraint) const;
+  template<class T> typename std::vector<T>::iterator mymax(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T maxConstraint) const;
   template<class T> typename std::vector<T>::const_iterator absmin(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
   template<class T> typename std::vector<T>::const_iterator absmax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const;
+  
   template<class T> void minmax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T& theMin, T& theMax) const;  
   template<class T> T sum(const std::vector<T>& v) const;
   template<class T> double mean(const std::vector<T>& v) const;
-  template<class T> T eraseNoData(std::vector<T>& v) const;
+  template<class T> void eraseNoData(std::vector<T>& v) const;
   template<class T> T median(const std::vector<T>& v) const;
   template<class T> double var(const std::vector<T>& v) const;
   template<class T> double moment(const std::vector<T>& v, int n) const;
@@ -162,11 +165,11 @@ public:
   template<class T> double kurtosis(const std::vector<T>& v) const;
   template<class T> void meanVar(const std::vector<T>& v, double& m1, double& v1) const;
   template<class T1, class T2> void  scale2byte(const std::vector<T1>& input, std::vector<T2>& output, unsigned char lbound=0, unsigned char ubound=255) const;
-  template<class T> void distribution(const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end,  std::vector<double>& output, int nbin, T &minimum=0.0, T &maximum=0.0, double sigma=0, const std::string &filename="") const;
+  template<class T> void distribution(const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end,  std::vector<double>& output, int nbin, T &minimum, T &maximum, double sigma=0, const std::string &filename="") const;
   template<class T> void distribution(const std::vector<T>& input,  std::vector<double>& output, int nbin, double sigma=0, const std::string &filename="") const{distribution(input,input.begin(),input.end(),output,nbin,0,0,sigma,filename);};
-  template<class T> void  distribution2d(const std::vector<T>& inputX, const std::vector<T>& inputY, std::vector< std::vector<double> >& output, int nbin, T& minX=0, T& maxX=0, T& minY=0, T& maxY=0, double sigma=0, const std::string& filename="") const;
+  template<class T> void  distribution2d(const std::vector<T>& inputX, const std::vector<T>& inputY, std::vector< std::vector<double> >& output, int nbin, T& minX, T& maxX, T& minY, T& maxY, double sigma=0, const std::string& filename="") const;
   template<class T> void cumulative (const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<int>& output, int nbin, T &minimum, T &maximum) const;
-  template<class T> void  percentiles (const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<T>& output, int nbin=10, T &minimum=0.0, T &maximum=0.0, const std::string &filename="") const;
+  template<class T> void  percentiles (const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<T>& output, int nbin, T &minimum, T &maximum, const std::string &filename="") const;
   template<class T> void signature(const std::vector<T>& input, double& k, double& alpha, double& beta, double e) const;
   void signature(double m1, double m2, double& k, double& alpha, double& beta, double e) const;
   template<class T> void normalize(const std::vector<T>& input, std::vector<double>& output) const;
@@ -203,7 +206,7 @@ private:
 };
 
 
-template<class T> inline typename std::vector<T>::const_iterator StatFactory::min(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const
+template<class T> inline typename std::vector<T>::const_iterator StatFactory::mymin(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const
 {
   typename std::vector<T>::const_iterator tmpIt=begin;
   for (typename std::vector<T>::const_iterator it = begin; it!=end; ++it){
@@ -214,7 +217,7 @@ template<class T> inline typename std::vector<T>::const_iterator StatFactory::mi
   return tmpIt;
 }
 
-template<class T> inline typename std::vector<T>::iterator StatFactory::min(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const
+template<class T> inline typename std::vector<T>::iterator StatFactory::mymin(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const
 {
   typename std::vector<T>::iterator tmpIt=begin;
   for (typename std::vector<T>::const_iterator it = begin; it!=end; ++it){
@@ -225,7 +228,7 @@ template<class T> inline typename std::vector<T>::iterator StatFactory::min(cons
   return tmpIt;
 }
 
-template<class T> inline  typename std::vector<T>::const_iterator StatFactory::min(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T minConstraint) const
+template<class T> inline  typename std::vector<T>::const_iterator StatFactory::mymin(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T minConstraint) const
 {
   typename std::vector<T>::const_iterator tmpIt=v.end();
   T minValue=minConstraint;
@@ -240,7 +243,7 @@ template<class T> inline  typename std::vector<T>::const_iterator StatFactory::m
   return tmpIt;
 }
 
-template<class T> inline typename std::vector<T>::iterator StatFactory::min(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T minConstraint) const
+template<class T> inline typename std::vector<T>::iterator StatFactory::mymin(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T minConstraint) const
 {
   typename std::vector<T>::iterator tmpIt=v.end();
   T minValue=minConstraint;
@@ -255,7 +258,7 @@ template<class T> inline typename std::vector<T>::iterator StatFactory::min(cons
   return tmpIt;
 }
 
-template<class T> inline typename std::vector<T>::const_iterator StatFactory::max(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const
+template<class T> inline typename std::vector<T>::const_iterator StatFactory::mymax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end) const
 {
   typename std::vector<T>::const_iterator tmpIt=begin;
   for (typename std::vector<T>::iterator it = begin; it!=end; ++it){
@@ -267,7 +270,7 @@ template<class T> inline typename std::vector<T>::const_iterator StatFactory::ma
   return tmpIt;
 }
 
-template<class T> inline typename std::vector<T>::iterator StatFactory::max(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const
+template<class T> inline typename std::vector<T>::iterator StatFactory::mymax(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) const
 {
   typename std::vector<T>::iterator tmpIt=begin;
   for (typename std::vector<T>::iterator it = begin; it!=end; ++it){
@@ -279,7 +282,7 @@ template<class T> inline typename std::vector<T>::iterator StatFactory::max(cons
   return tmpIt;
 }
 
-template<class T> inline typename std::vector<T>::const_iterator StatFactory::max(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T maxConstraint) const
+template<class T> inline typename std::vector<T>::const_iterator StatFactory::mymax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T maxConstraint) const
 {
   typename std::vector<T>::const_iterator tmpIt=v.end();
   T maxValue=maxConstraint;
@@ -294,7 +297,7 @@ template<class T> inline typename std::vector<T>::const_iterator StatFactory::ma
   return tmpIt;
 }
 
-template<class T> inline typename std::vector<T>::iterator StatFactory::max(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T maxConstraint) const
+template<class T> inline typename std::vector<T>::iterator StatFactory::mymax(const std::vector<T>& v, typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end, T maxConstraint) const
 {
   typename std::vector<T>::iterator tmpIt=v.end();
   T maxValue=maxConstraint;
@@ -312,7 +315,7 @@ template<class T> inline typename std::vector<T>::iterator StatFactory::max(cons
 
 
 
-template<class T> inline T StatFactory::min(const std::vector<T>& v) const
+template<class T> inline T StatFactory::mymin(const std::vector<T>& v) const
 {
   T minValue=*(v.begin());
   for (typename std::vector<T>::const_iterator it = v.begin(); it!=v.end(); ++it){
@@ -324,7 +327,7 @@ template<class T> inline T StatFactory::min(const std::vector<T>& v) const
   return minValue;
 }
 
- template<class T> inline T StatFactory::min(const std::vector<T>& v, T minConstraint) const
+ template<class T> inline T StatFactory::mymin(const std::vector<T>& v, T minConstraint) const
 {
   T minValue=minConstraint;
   for (typename std::vector<T>::const_iterator it = v.begin(); it!=v.end(); ++it){
@@ -334,7 +337,7 @@ template<class T> inline T StatFactory::min(const std::vector<T>& v) const
   return minValue;
 }
 
-template<class T> inline T StatFactory::max(const std::vector<T>& v) const
+template<class T> inline T StatFactory::mymax(const std::vector<T>& v) const
 {
   T maxValue=*(v.begin());
   for (typename std::vector<T>::const_iterator it = v.begin(); it!=v.end(); ++it){
@@ -346,7 +349,7 @@ template<class T> inline T StatFactory::max(const std::vector<T>& v) const
   return maxValue;
 }
 
-template<class T> inline T StatFactory::max(const std::vector<T>& v, T maxConstraint) const
+template<class T> inline T StatFactory::mymax(const std::vector<T>& v, T maxConstraint) const
 {
   T maxValue=maxConstraint;
   for (typename std::vector<T>::const_iterator it = v.begin(); it!=v.end(); ++it){
@@ -425,7 +428,7 @@ template<class T> inline double StatFactory::mean(const std::vector<T>& v) const
     return 0;
 }
 
-template<class T> inline T StatFactory::eraseNoData(std::vector<T>& v) const
+template<class T> inline void StatFactory::eraseNoData(std::vector<T>& v) const
 {
   typename std::vector<T>::iterator it=v.begin();
   while(it!=v.end()){
@@ -561,8 +564,8 @@ template<class T> void StatFactory::meanVar(const std::vector<T>& v, double& m1,
 template<class T1, class T2> void StatFactory::scale2byte(const std::vector<T1>& input, std::vector<T2>& output, unsigned char lbound,  unsigned char ubound) const
 {
   output.resize(input.size());
-  T1 minimum=min(input);
-  T1 maximum=max(input);
+  T1 minimum=mymin(input);
+  T1 maximum=mymax(input);
   assert(maximum>minimum);
   double scale=(ubound-lbound)/(maximum-minimum);
   for (int i=0;i<input.size();++i)
diff --git a/src/algorithms/myfann_cpp.h b/src/algorithms/myfann_cpp.h
index e3d4005..7938379 100644
--- a/src/algorithms/myfann_cpp.h
+++ b/src/algorithms/myfann_cpp.h
@@ -89,7 +89,7 @@
 #include <string>
 #include <vector>
 #include <cassert>
-#include "Vector2d.h"
+#include "base/Vector2d.h"
 
 /* Namespace: FANN
     The FANN namespace groups the C++ wrapper definitions */
diff --git a/src/apps/Makefile.am b/src/apps/Makefile.am
index 2fff36f..bdb3053 100644
--- a/src/apps/Makefile.am
+++ b/src/apps/Makefile.am
@@ -6,22 +6,22 @@ LDADD = $(GSL_LIBS) $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms
 ###############################################################################
 
 # the program to build and install (the names of the final binaries)
-bin_PROGRAMS = pkinfo pkcrop pkreclass pkgetmask pksetmask pkcreatect pkdumpimg pkdumpogr pksieve pkstatascii pkstatogr pkegcs pkextract pkfillnodata pkfilter pkfilterdem pkenhance pkfilterascii pkdsm2shadow pkmosaic pkndvi pkpolygonize pkascii2img pkdiff pkclassify_svm pkfs_svm pkascii2ogr pkeditogr
+bin_PROGRAMS = pkinfo pkcrop pkreclass pkgetmask pksetmask pkcreatect pkdumpimg pkdumpogr pksieve pkstatascii pkstatogr pkegcs pkextract pkfillnodata pkfilter pkfilterdem pkenhance pkfilterascii pkdsm2shadow pkcomposit pkndvi pkpolygonize pkascii2img pkdiff pksvm pkfssvm pkascii2ogr pkeditogr
 
 # the program to build but not install (the names of the final binaries)
 #noinst_PROGRAMS =  pkxcorimg pkgeom
 
 if USE_FANN
-bin_PROGRAMS += pkclassify_nn pkfs_nn pkregression_nn
-pkclassify_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.cc
-pkclassify_nn_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
-pkclassify_nn_LDADD = $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
-pkfs_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkfs_nn.cc
-pkfs_nn_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
-pkfs_nn_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
-pkregression_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkregression_nn.cc
-pkregression_nn_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
-pkregression_nn_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
+bin_PROGRAMS += pkann pkfsann pkregann
+pkann_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkann.cc
+pkann_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
+pkann_LDADD = $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
+pkfsann_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkfsann.cc
+pkfsann_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
+pkfsann_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
+pkregann_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkregann.cc
+pkregann_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
+pkregann_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
 endif
 
 if USE_LAS
@@ -30,9 +30,9 @@ pklas2img_SOURCES = pklas2img.cc
 pklas2img_LDADD = $(top_srcdir)/src/lasclasses/liblasClasses.la -llas $(AM_LDFLAGS)
 endif
 if USE_NLOPT
-bin_PROGRAMS += pkopt_svm
-pkopt_svm_SOURCES = $(top_srcdir)/src/algorithms/OptFactory.h pkopt_svm.cc
-pkopt_svm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt
+bin_PROGRAMS += pkoptsvm
+pkoptsvm_SOURCES = $(top_srcdir)/src/algorithms/OptFactory.h pkoptsvm.cc
+pkoptsvm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt
 endif
 # list of sources for the binaries
 pkinfo_SOURCES = pkinfo.cc
@@ -59,13 +59,13 @@ pkenhance_LDADD = $(AM_LDFLAGS) -lgdal
 pkfilterascii_SOURCES = pkfilterascii.cc
 pkfilterascii_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lgsl -lgdal
 pkdsm2shadow_SOURCES = pkdsm2shadow.cc
-pkmosaic_SOURCES = pkmosaic.cc
+pkcomposit_SOURCES = pkcomposit.cc
 pkndvi_SOURCES = pkndvi.cc
 pkpolygonize_SOURCES = pkpolygonize.cc
 pkdiff_SOURCES = pkdiff.cc
-pkclassify_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp  pkclassify_svm.cc
-pkfs_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkfs_svm.cc
-pkfs_svm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS)
+pksvm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pksvm.cc
+pkfssvm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkfssvm.cc
+pkfssvm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS)
 pkascii2img_SOURCES = pkascii2img.cc
 pkascii2ogr_SOURCES = pkascii2ogr.cc
 pkeditogr_SOURCES = pkeditogr.cc
diff --git a/src/apps/Makefile.in b/src/apps/Makefile.in
index da3b722..aaead1f 100644
--- a/src/apps/Makefile.in
+++ b/src/apps/Makefile.in
@@ -57,17 +57,17 @@ bin_PROGRAMS = pkinfo$(EXEEXT) pkcrop$(EXEEXT) pkreclass$(EXEEXT) \
 	pkstatascii$(EXEEXT) pkstatogr$(EXEEXT) pkegcs$(EXEEXT) \
 	pkextract$(EXEEXT) pkfillnodata$(EXEEXT) pkfilter$(EXEEXT) \
 	pkfilterdem$(EXEEXT) pkenhance$(EXEEXT) pkfilterascii$(EXEEXT) \
-	pkdsm2shadow$(EXEEXT) pkmosaic$(EXEEXT) pkndvi$(EXEEXT) \
+	pkdsm2shadow$(EXEEXT) pkcomposit$(EXEEXT) pkndvi$(EXEEXT) \
 	pkpolygonize$(EXEEXT) pkascii2img$(EXEEXT) pkdiff$(EXEEXT) \
-	pkclassify_svm$(EXEEXT) pkfs_svm$(EXEEXT) pkascii2ogr$(EXEEXT) \
+	pksvm$(EXEEXT) pkfssvm$(EXEEXT) pkascii2ogr$(EXEEXT) \
 	pkeditogr$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
 	$(am__EXEEXT_3)
 
 # the program to build but not install (the names of the final binaries)
 #noinst_PROGRAMS =  pkxcorimg pkgeom
- at USE_FANN_TRUE@am__append_1 = pkclassify_nn pkfs_nn pkregression_nn
+ at USE_FANN_TRUE@am__append_1 = pkann pkfsann pkregann
 @USE_LAS_TRUE at am__append_2 = pklas2img
- at USE_NLOPT_TRUE@am__append_3 = pkopt_svm
+ at USE_NLOPT_TRUE@am__append_3 = pkoptsvm
 subdir = src/apps
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -81,16 +81,30 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
- at USE_FANN_TRUE@am__EXEEXT_1 = pkclassify_nn$(EXEEXT) pkfs_nn$(EXEEXT) \
- at USE_FANN_TRUE@	pkregression_nn$(EXEEXT)
+ at USE_FANN_TRUE@am__EXEEXT_1 = pkann$(EXEEXT) pkfsann$(EXEEXT) \
+ at USE_FANN_TRUE@	pkregann$(EXEEXT)
 @USE_LAS_TRUE at am__EXEEXT_2 = pklas2img$(EXEEXT)
- at USE_NLOPT_TRUE@am__EXEEXT_3 = pkopt_svm$(EXEEXT)
+ at USE_NLOPT_TRUE@am__EXEEXT_3 = pkoptsvm$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
+am__pkann_SOURCES_DIST = $(top_srcdir)/src/algorithms/myfann_cpp.h \
+	pkann.cc
+ at USE_FANN_TRUE@am_pkann_OBJECTS = pkann-pkann.$(OBJEXT)
+pkann_OBJECTS = $(am_pkann_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(top_builddir)/src/algorithms/libalgorithms.la \
+	$(top_builddir)/src/imageclasses/libimageClasses.la \
+	$(top_builddir)/src/fileclasses/libfileClasses.la \
+	$(top_builddir)/src/base/libbase.la
+ at USE_FANN_TRUE@pkann_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ at USE_FANN_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+pkann_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CXXLD) $(pkann_CXXFLAGS) $(CXXFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 am_pkascii2img_OBJECTS = pkascii2img.$(OBJEXT)
 pkascii2img_OBJECTS = $(am_pkascii2img_OBJECTS)
 pkascii2img_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
 pkascii2img_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/algorithms/libalgorithms.la \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
@@ -104,26 +118,10 @@ pkascii2ogr_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
 	$(top_builddir)/src/fileclasses/libfileClasses.la \
 	$(top_builddir)/src/base/libbase.la
-am__pkclassify_nn_SOURCES_DIST =  \
-	$(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.cc
- at USE_FANN_TRUE@am_pkclassify_nn_OBJECTS =  \
- at USE_FANN_TRUE@	pkclassify_nn-pkclassify_nn.$(OBJEXT)
-pkclassify_nn_OBJECTS = $(am_pkclassify_nn_OBJECTS)
-am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(top_builddir)/src/algorithms/libalgorithms.la \
-	$(top_builddir)/src/imageclasses/libimageClasses.la \
-	$(top_builddir)/src/fileclasses/libfileClasses.la \
-	$(top_builddir)/src/base/libbase.la
- at USE_FANN_TRUE@pkclassify_nn_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- at USE_FANN_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
-pkclassify_nn_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pkclassify_nn_CXXFLAGS) \
-	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_pkclassify_svm_OBJECTS = svm.$(OBJEXT) pkclassify_svm.$(OBJEXT)
-pkclassify_svm_OBJECTS = $(am_pkclassify_svm_OBJECTS)
-pkclassify_svm_LDADD = $(LDADD)
-pkclassify_svm_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) \
+am_pkcomposit_OBJECTS = pkcomposit.$(OBJEXT)
+pkcomposit_OBJECTS = $(am_pkcomposit_OBJECTS)
+pkcomposit_LDADD = $(LDADD)
+pkcomposit_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/algorithms/libalgorithms.la \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
 	$(top_builddir)/src/fileclasses/libfileClasses.la \
@@ -218,19 +216,19 @@ pkfilterdem_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
 	$(top_builddir)/src/fileclasses/libfileClasses.la \
 	$(top_builddir)/src/base/libbase.la
-am__pkfs_nn_SOURCES_DIST = $(top_srcdir)/src/algorithms/myfann_cpp.h \
-	pkfs_nn.cc
- at USE_FANN_TRUE@am_pkfs_nn_OBJECTS = pkfs_nn-pkfs_nn.$(OBJEXT)
-pkfs_nn_OBJECTS = $(am_pkfs_nn_OBJECTS)
- at USE_FANN_TRUE@pkfs_nn_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+am__pkfsann_SOURCES_DIST = $(top_srcdir)/src/algorithms/myfann_cpp.h \
+	pkfsann.cc
+ at USE_FANN_TRUE@am_pkfsann_OBJECTS = pkfsann-pkfsann.$(OBJEXT)
+pkfsann_OBJECTS = $(am_pkfsann_OBJECTS)
+ at USE_FANN_TRUE@pkfsann_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 @USE_FANN_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 @USE_FANN_TRUE@	$(am__DEPENDENCIES_2)
-pkfs_nn_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CXXLD) $(pkfs_nn_CXXFLAGS) $(CXXFLAGS) \
+pkfsann_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CXXLD) $(pkfsann_CXXFLAGS) $(CXXFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_pkfs_svm_OBJECTS = svm.$(OBJEXT) pkfs_svm.$(OBJEXT)
-pkfs_svm_OBJECTS = $(am_pkfs_svm_OBJECTS)
-pkfs_svm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_pkfssvm_OBJECTS = svm.$(OBJEXT) pkfssvm.$(OBJEXT)
+pkfssvm_OBJECTS = $(am_pkfssvm_OBJECTS)
+pkfssvm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
 am_pkgetmask_OBJECTS = pkgetmask.$(OBJEXT)
 pkgetmask_OBJECTS = $(am_pkgetmask_OBJECTS)
 pkgetmask_LDADD = $(LDADD)
@@ -253,14 +251,6 @@ pklas2img_OBJECTS = $(am_pklas2img_OBJECTS)
 @USE_LAS_TRUE at pklas2img_DEPENDENCIES =  \
 @USE_LAS_TRUE@	$(top_srcdir)/src/lasclasses/liblasClasses.la \
 @USE_LAS_TRUE@	$(am__DEPENDENCIES_2)
-am_pkmosaic_OBJECTS = pkmosaic.$(OBJEXT)
-pkmosaic_OBJECTS = $(am_pkmosaic_OBJECTS)
-pkmosaic_LDADD = $(LDADD)
-pkmosaic_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(top_builddir)/src/algorithms/libalgorithms.la \
-	$(top_builddir)/src/imageclasses/libimageClasses.la \
-	$(top_builddir)/src/fileclasses/libfileClasses.la \
-	$(top_builddir)/src/base/libbase.la
 am_pkndvi_OBJECTS = pkndvi.$(OBJEXT)
 pkndvi_OBJECTS = $(am_pkndvi_OBJECTS)
 pkndvi_LDADD = $(LDADD)
@@ -269,11 +259,11 @@ pkndvi_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
 	$(top_builddir)/src/fileclasses/libfileClasses.la \
 	$(top_builddir)/src/base/libbase.la
-am__pkopt_svm_SOURCES_DIST =  \
-	$(top_srcdir)/src/algorithms/OptFactory.h pkopt_svm.cc
- at USE_NLOPT_TRUE@am_pkopt_svm_OBJECTS = pkopt_svm.$(OBJEXT)
-pkopt_svm_OBJECTS = $(am_pkopt_svm_OBJECTS)
- at USE_NLOPT_TRUE@pkopt_svm_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+am__pkoptsvm_SOURCES_DIST = $(top_srcdir)/src/algorithms/OptFactory.h \
+	pkoptsvm.cc
+ at USE_NLOPT_TRUE@am_pkoptsvm_OBJECTS = pkoptsvm.$(OBJEXT)
+pkoptsvm_OBJECTS = $(am_pkoptsvm_OBJECTS)
+ at USE_NLOPT_TRUE@pkoptsvm_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 @USE_NLOPT_TRUE@	$(am__DEPENDENCIES_2)
 am_pkpolygonize_OBJECTS = pkpolygonize.$(OBJEXT)
 pkpolygonize_OBJECTS = $(am_pkpolygonize_OBJECTS)
@@ -292,18 +282,16 @@ pkreclass_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
 	$(top_builddir)/src/fileclasses/libfileClasses.la \
 	$(top_builddir)/src/base/libbase.la
-am__pkregression_nn_SOURCES_DIST =  \
-	$(top_srcdir)/src/algorithms/myfann_cpp.h pkregression_nn.cc
- at USE_FANN_TRUE@am_pkregression_nn_OBJECTS =  \
- at USE_FANN_TRUE@	pkregression_nn-pkregression_nn.$(OBJEXT)
-pkregression_nn_OBJECTS = $(am_pkregression_nn_OBJECTS)
- at USE_FANN_TRUE@pkregression_nn_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+am__pkregann_SOURCES_DIST = $(top_srcdir)/src/algorithms/myfann_cpp.h \
+	pkregann.cc
+ at USE_FANN_TRUE@am_pkregann_OBJECTS = pkregann-pkregann.$(OBJEXT)
+pkregann_OBJECTS = $(am_pkregann_OBJECTS)
+ at USE_FANN_TRUE@pkregann_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 @USE_FANN_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 @USE_FANN_TRUE@	$(am__DEPENDENCIES_2)
-pkregression_nn_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
-	$(pkregression_nn_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
+pkregann_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pkregann_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 am_pksetmask_OBJECTS = pksetmask.$(OBJEXT)
 pksetmask_OBJECTS = $(am_pksetmask_OBJECTS)
 pksetmask_LDADD = $(LDADD)
@@ -331,6 +319,14 @@ pkstatogr_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(top_builddir)/src/imageclasses/libimageClasses.la \
 	$(top_builddir)/src/fileclasses/libfileClasses.la \
 	$(top_builddir)/src/base/libbase.la
+am_pksvm_OBJECTS = svm.$(OBJEXT) pksvm.$(OBJEXT)
+pksvm_OBJECTS = $(am_pksvm_OBJECTS)
+pksvm_LDADD = $(LDADD)
+pksvm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(top_builddir)/src/algorithms/libalgorithms.la \
+	$(top_builddir)/src/imageclasses/libimageClasses.la \
+	$(top_builddir)/src/fileclasses/libfileClasses.la \
+	$(top_builddir)/src/base/libbase.la
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -353,35 +349,35 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(pkascii2img_SOURCES) $(pkascii2ogr_SOURCES) \
-	$(pkclassify_nn_SOURCES) $(pkclassify_svm_SOURCES) \
+SOURCES = $(pkann_SOURCES) $(pkascii2img_SOURCES) \
+	$(pkascii2ogr_SOURCES) $(pkcomposit_SOURCES) \
 	$(pkcreatect_SOURCES) $(pkcrop_SOURCES) $(pkdiff_SOURCES) \
 	$(pkdsm2shadow_SOURCES) $(pkdumpimg_SOURCES) \
 	$(pkdumpogr_SOURCES) $(pkeditogr_SOURCES) $(pkegcs_SOURCES) \
 	$(pkenhance_SOURCES) $(pkextract_SOURCES) \
 	$(pkfillnodata_SOURCES) $(pkfilter_SOURCES) \
 	$(pkfilterascii_SOURCES) $(pkfilterdem_SOURCES) \
-	$(pkfs_nn_SOURCES) $(pkfs_svm_SOURCES) $(pkgetmask_SOURCES) \
-	$(pkinfo_SOURCES) $(pklas2img_SOURCES) $(pkmosaic_SOURCES) \
-	$(pkndvi_SOURCES) $(pkopt_svm_SOURCES) $(pkpolygonize_SOURCES) \
-	$(pkreclass_SOURCES) $(pkregression_nn_SOURCES) \
-	$(pksetmask_SOURCES) $(pksieve_SOURCES) $(pkstatascii_SOURCES) \
-	$(pkstatogr_SOURCES)
-DIST_SOURCES = $(pkascii2img_SOURCES) $(pkascii2ogr_SOURCES) \
-	$(am__pkclassify_nn_SOURCES_DIST) $(pkclassify_svm_SOURCES) \
+	$(pkfsann_SOURCES) $(pkfssvm_SOURCES) $(pkgetmask_SOURCES) \
+	$(pkinfo_SOURCES) $(pklas2img_SOURCES) $(pkndvi_SOURCES) \
+	$(pkoptsvm_SOURCES) $(pkpolygonize_SOURCES) \
+	$(pkreclass_SOURCES) $(pkregann_SOURCES) $(pksetmask_SOURCES) \
+	$(pksieve_SOURCES) $(pkstatascii_SOURCES) $(pkstatogr_SOURCES) \
+	$(pksvm_SOURCES)
+DIST_SOURCES = $(am__pkann_SOURCES_DIST) $(pkascii2img_SOURCES) \
+	$(pkascii2ogr_SOURCES) $(pkcomposit_SOURCES) \
 	$(pkcreatect_SOURCES) $(pkcrop_SOURCES) $(pkdiff_SOURCES) \
 	$(pkdsm2shadow_SOURCES) $(pkdumpimg_SOURCES) \
 	$(pkdumpogr_SOURCES) $(pkeditogr_SOURCES) $(pkegcs_SOURCES) \
 	$(pkenhance_SOURCES) $(pkextract_SOURCES) \
 	$(pkfillnodata_SOURCES) $(pkfilter_SOURCES) \
 	$(pkfilterascii_SOURCES) $(pkfilterdem_SOURCES) \
-	$(am__pkfs_nn_SOURCES_DIST) $(pkfs_svm_SOURCES) \
+	$(am__pkfsann_SOURCES_DIST) $(pkfssvm_SOURCES) \
 	$(pkgetmask_SOURCES) $(pkinfo_SOURCES) \
-	$(am__pklas2img_SOURCES_DIST) $(pkmosaic_SOURCES) \
-	$(pkndvi_SOURCES) $(am__pkopt_svm_SOURCES_DIST) \
-	$(pkpolygonize_SOURCES) $(pkreclass_SOURCES) \
-	$(am__pkregression_nn_SOURCES_DIST) $(pksetmask_SOURCES) \
-	$(pksieve_SOURCES) $(pkstatascii_SOURCES) $(pkstatogr_SOURCES)
+	$(am__pklas2img_SOURCES_DIST) $(pkndvi_SOURCES) \
+	$(am__pkoptsvm_SOURCES_DIST) $(pkpolygonize_SOURCES) \
+	$(pkreclass_SOURCES) $(am__pkregann_SOURCES_DIST) \
+	$(pksetmask_SOURCES) $(pksieve_SOURCES) $(pkstatascii_SOURCES) \
+	$(pkstatogr_SOURCES) $(pksvm_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -469,6 +465,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -530,19 +527,19 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 LDADD = $(GSL_LIBS) $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.la $(top_builddir)/src/imageclasses/libimageClasses.la $(top_builddir)/src/fileclasses/libfileClasses.la $(top_builddir)/src/base/libbase.la
- at USE_FANN_TRUE@pkclassify_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.cc
- at USE_FANN_TRUE@pkclassify_nn_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
- at USE_FANN_TRUE@pkclassify_nn_LDADD = $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
- at USE_FANN_TRUE@pkfs_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkfs_nn.cc
- at USE_FANN_TRUE@pkfs_nn_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
- at USE_FANN_TRUE@pkfs_nn_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
- at USE_FANN_TRUE@pkregression_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkregression_nn.cc
- at USE_FANN_TRUE@pkregression_nn_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
- at USE_FANN_TRUE@pkregression_nn_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
+ at USE_FANN_TRUE@pkann_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkann.cc
+ at USE_FANN_TRUE@pkann_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
+ at USE_FANN_TRUE@pkann_LDADD = $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
+ at USE_FANN_TRUE@pkfsann_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkfsann.cc
+ at USE_FANN_TRUE@pkfsann_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
+ at USE_FANN_TRUE@pkfsann_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
+ at USE_FANN_TRUE@pkregann_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkregann.cc
+ at USE_FANN_TRUE@pkregann_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(FANN_CFLAGS) -I$(top_srcdir)/src/algorithms $(AM_CXXFLAGS)
+ at USE_FANN_TRUE@pkregann_LDADD = $(GSL_LIBS) $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS)
 @USE_LAS_TRUE at pklas2img_SOURCES = pklas2img.cc
 @USE_LAS_TRUE at pklas2img_LDADD = $(top_srcdir)/src/lasclasses/liblasClasses.la -llas $(AM_LDFLAGS)
- at USE_NLOPT_TRUE@pkopt_svm_SOURCES = $(top_srcdir)/src/algorithms/OptFactory.h pkopt_svm.cc
- at USE_NLOPT_TRUE@pkopt_svm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt
+ at USE_NLOPT_TRUE@pkoptsvm_SOURCES = $(top_srcdir)/src/algorithms/OptFactory.h pkoptsvm.cc
+ at USE_NLOPT_TRUE@pkoptsvm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt
 # list of sources for the binaries
 pkinfo_SOURCES = pkinfo.cc
 pkcrop_SOURCES = pkcrop.cc
@@ -568,13 +565,13 @@ pkenhance_LDADD = $(AM_LDFLAGS) -lgdal
 pkfilterascii_SOURCES = pkfilterascii.cc
 pkfilterascii_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lgsl -lgdal
 pkdsm2shadow_SOURCES = pkdsm2shadow.cc
-pkmosaic_SOURCES = pkmosaic.cc
+pkcomposit_SOURCES = pkcomposit.cc
 pkndvi_SOURCES = pkndvi.cc
 pkpolygonize_SOURCES = pkpolygonize.cc
 pkdiff_SOURCES = pkdiff.cc
-pkclassify_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp  pkclassify_svm.cc
-pkfs_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkfs_svm.cc
-pkfs_svm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS)
+pksvm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pksvm.cc
+pkfssvm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkfssvm.cc
+pkfssvm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS)
 pkascii2img_SOURCES = pkascii2img.cc
 pkascii2ogr_SOURCES = pkascii2ogr.cc
 pkeditogr_SOURCES = pkeditogr.cc
@@ -659,18 +656,18 @@ clean-binPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
+pkann$(EXEEXT): $(pkann_OBJECTS) $(pkann_DEPENDENCIES) $(EXTRA_pkann_DEPENDENCIES) 
+	@rm -f pkann$(EXEEXT)
+	$(pkann_LINK) $(pkann_OBJECTS) $(pkann_LDADD) $(LIBS)
 pkascii2img$(EXEEXT): $(pkascii2img_OBJECTS) $(pkascii2img_DEPENDENCIES) $(EXTRA_pkascii2img_DEPENDENCIES) 
 	@rm -f pkascii2img$(EXEEXT)
 	$(CXXLINK) $(pkascii2img_OBJECTS) $(pkascii2img_LDADD) $(LIBS)
 pkascii2ogr$(EXEEXT): $(pkascii2ogr_OBJECTS) $(pkascii2ogr_DEPENDENCIES) $(EXTRA_pkascii2ogr_DEPENDENCIES) 
 	@rm -f pkascii2ogr$(EXEEXT)
 	$(CXXLINK) $(pkascii2ogr_OBJECTS) $(pkascii2ogr_LDADD) $(LIBS)
-pkclassify_nn$(EXEEXT): $(pkclassify_nn_OBJECTS) $(pkclassify_nn_DEPENDENCIES) $(EXTRA_pkclassify_nn_DEPENDENCIES) 
-	@rm -f pkclassify_nn$(EXEEXT)
-	$(pkclassify_nn_LINK) $(pkclassify_nn_OBJECTS) $(pkclassify_nn_LDADD) $(LIBS)
-pkclassify_svm$(EXEEXT): $(pkclassify_svm_OBJECTS) $(pkclassify_svm_DEPENDENCIES) $(EXTRA_pkclassify_svm_DEPENDENCIES) 
-	@rm -f pkclassify_svm$(EXEEXT)
-	$(CXXLINK) $(pkclassify_svm_OBJECTS) $(pkclassify_svm_LDADD) $(LIBS)
+pkcomposit$(EXEEXT): $(pkcomposit_OBJECTS) $(pkcomposit_DEPENDENCIES) $(EXTRA_pkcomposit_DEPENDENCIES) 
+	@rm -f pkcomposit$(EXEEXT)
+	$(CXXLINK) $(pkcomposit_OBJECTS) $(pkcomposit_LDADD) $(LIBS)
 pkcreatect$(EXEEXT): $(pkcreatect_OBJECTS) $(pkcreatect_DEPENDENCIES) $(EXTRA_pkcreatect_DEPENDENCIES) 
 	@rm -f pkcreatect$(EXEEXT)
 	$(CXXLINK) $(pkcreatect_OBJECTS) $(pkcreatect_LDADD) $(LIBS)
@@ -713,12 +710,12 @@ pkfilterascii$(EXEEXT): $(pkfilterascii_OBJECTS) $(pkfilterascii_DEPENDENCIES) $
 pkfilterdem$(EXEEXT): $(pkfilterdem_OBJECTS) $(pkfilterdem_DEPENDENCIES) $(EXTRA_pkfilterdem_DEPENDENCIES) 
 	@rm -f pkfilterdem$(EXEEXT)
 	$(CXXLINK) $(pkfilterdem_OBJECTS) $(pkfilterdem_LDADD) $(LIBS)
-pkfs_nn$(EXEEXT): $(pkfs_nn_OBJECTS) $(pkfs_nn_DEPENDENCIES) $(EXTRA_pkfs_nn_DEPENDENCIES) 
-	@rm -f pkfs_nn$(EXEEXT)
-	$(pkfs_nn_LINK) $(pkfs_nn_OBJECTS) $(pkfs_nn_LDADD) $(LIBS)
-pkfs_svm$(EXEEXT): $(pkfs_svm_OBJECTS) $(pkfs_svm_DEPENDENCIES) $(EXTRA_pkfs_svm_DEPENDENCIES) 
-	@rm -f pkfs_svm$(EXEEXT)
-	$(CXXLINK) $(pkfs_svm_OBJECTS) $(pkfs_svm_LDADD) $(LIBS)
+pkfsann$(EXEEXT): $(pkfsann_OBJECTS) $(pkfsann_DEPENDENCIES) $(EXTRA_pkfsann_DEPENDENCIES) 
+	@rm -f pkfsann$(EXEEXT)
+	$(pkfsann_LINK) $(pkfsann_OBJECTS) $(pkfsann_LDADD) $(LIBS)
+pkfssvm$(EXEEXT): $(pkfssvm_OBJECTS) $(pkfssvm_DEPENDENCIES) $(EXTRA_pkfssvm_DEPENDENCIES) 
+	@rm -f pkfssvm$(EXEEXT)
+	$(CXXLINK) $(pkfssvm_OBJECTS) $(pkfssvm_LDADD) $(LIBS)
 pkgetmask$(EXEEXT): $(pkgetmask_OBJECTS) $(pkgetmask_DEPENDENCIES) $(EXTRA_pkgetmask_DEPENDENCIES) 
 	@rm -f pkgetmask$(EXEEXT)
 	$(CXXLINK) $(pkgetmask_OBJECTS) $(pkgetmask_LDADD) $(LIBS)
@@ -728,24 +725,21 @@ pkinfo$(EXEEXT): $(pkinfo_OBJECTS) $(pkinfo_DEPENDENCIES) $(EXTRA_pkinfo_DEPENDE
 pklas2img$(EXEEXT): $(pklas2img_OBJECTS) $(pklas2img_DEPENDENCIES) $(EXTRA_pklas2img_DEPENDENCIES) 
 	@rm -f pklas2img$(EXEEXT)
 	$(CXXLINK) $(pklas2img_OBJECTS) $(pklas2img_LDADD) $(LIBS)
-pkmosaic$(EXEEXT): $(pkmosaic_OBJECTS) $(pkmosaic_DEPENDENCIES) $(EXTRA_pkmosaic_DEPENDENCIES) 
-	@rm -f pkmosaic$(EXEEXT)
-	$(CXXLINK) $(pkmosaic_OBJECTS) $(pkmosaic_LDADD) $(LIBS)
 pkndvi$(EXEEXT): $(pkndvi_OBJECTS) $(pkndvi_DEPENDENCIES) $(EXTRA_pkndvi_DEPENDENCIES) 
 	@rm -f pkndvi$(EXEEXT)
 	$(CXXLINK) $(pkndvi_OBJECTS) $(pkndvi_LDADD) $(LIBS)
-pkopt_svm$(EXEEXT): $(pkopt_svm_OBJECTS) $(pkopt_svm_DEPENDENCIES) $(EXTRA_pkopt_svm_DEPENDENCIES) 
-	@rm -f pkopt_svm$(EXEEXT)
-	$(CXXLINK) $(pkopt_svm_OBJECTS) $(pkopt_svm_LDADD) $(LIBS)
+pkoptsvm$(EXEEXT): $(pkoptsvm_OBJECTS) $(pkoptsvm_DEPENDENCIES) $(EXTRA_pkoptsvm_DEPENDENCIES) 
+	@rm -f pkoptsvm$(EXEEXT)
+	$(CXXLINK) $(pkoptsvm_OBJECTS) $(pkoptsvm_LDADD) $(LIBS)
 pkpolygonize$(EXEEXT): $(pkpolygonize_OBJECTS) $(pkpolygonize_DEPENDENCIES) $(EXTRA_pkpolygonize_DEPENDENCIES) 
 	@rm -f pkpolygonize$(EXEEXT)
 	$(CXXLINK) $(pkpolygonize_OBJECTS) $(pkpolygonize_LDADD) $(LIBS)
 pkreclass$(EXEEXT): $(pkreclass_OBJECTS) $(pkreclass_DEPENDENCIES) $(EXTRA_pkreclass_DEPENDENCIES) 
 	@rm -f pkreclass$(EXEEXT)
 	$(CXXLINK) $(pkreclass_OBJECTS) $(pkreclass_LDADD) $(LIBS)
-pkregression_nn$(EXEEXT): $(pkregression_nn_OBJECTS) $(pkregression_nn_DEPENDENCIES) $(EXTRA_pkregression_nn_DEPENDENCIES) 
-	@rm -f pkregression_nn$(EXEEXT)
-	$(pkregression_nn_LINK) $(pkregression_nn_OBJECTS) $(pkregression_nn_LDADD) $(LIBS)
+pkregann$(EXEEXT): $(pkregann_OBJECTS) $(pkregann_DEPENDENCIES) $(EXTRA_pkregann_DEPENDENCIES) 
+	@rm -f pkregann$(EXEEXT)
+	$(pkregann_LINK) $(pkregann_OBJECTS) $(pkregann_LDADD) $(LIBS)
 pksetmask$(EXEEXT): $(pksetmask_OBJECTS) $(pksetmask_DEPENDENCIES) $(EXTRA_pksetmask_DEPENDENCIES) 
 	@rm -f pksetmask$(EXEEXT)
 	$(CXXLINK) $(pksetmask_OBJECTS) $(pksetmask_LDADD) $(LIBS)
@@ -758,6 +752,9 @@ pkstatascii$(EXEEXT): $(pkstatascii_OBJECTS) $(pkstatascii_DEPENDENCIES) $(EXTRA
 pkstatogr$(EXEEXT): $(pkstatogr_OBJECTS) $(pkstatogr_DEPENDENCIES) $(EXTRA_pkstatogr_DEPENDENCIES) 
 	@rm -f pkstatogr$(EXEEXT)
 	$(CXXLINK) $(pkstatogr_OBJECTS) $(pkstatogr_LDADD) $(LIBS)
+pksvm$(EXEEXT): $(pksvm_OBJECTS) $(pksvm_DEPENDENCIES) $(EXTRA_pksvm_DEPENDENCIES) 
+	@rm -f pksvm$(EXEEXT)
+	$(CXXLINK) $(pksvm_OBJECTS) $(pksvm_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -765,10 +762,10 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkann-pkann.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkascii2img.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkascii2ogr.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkclassify_nn-pkclassify_nn.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkclassify_svm.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkcomposit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkcreatect.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkcrop.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkdiff.Po at am__quote@
@@ -783,21 +780,21 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfilter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfilterascii.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfilterdem.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfs_nn-pkfs_nn.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfs_svm.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfsann-pkfsann.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkfssvm.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkgetmask.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkinfo.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pklas2img.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkmosaic.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkndvi.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkopt_svm.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkoptsvm.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkpolygonize.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkreclass.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkregression_nn-pkregression_nn.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkregann-pkregann.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pksetmask.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pksieve.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkstatascii.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pkstatogr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pksvm.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svm.Po at am__quote@
 
 .cc.o:
@@ -821,19 +818,33 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
 
-pkclassify_nn-pkclassify_nn.o: pkclassify_nn.cc
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkclassify_nn_CXXFLAGS) $(CXXFLAGS) -MT pkclassify_nn-pkclassify_nn.o -MD -MP -MF $(DEPDIR)/pkclassify_nn-pkclassify_nn.Tpo -c -o pkclassify_nn-pkclassify_nn.o `test -f 'pkclassify_nn.cc' || echo '$(srcdir)/'`pkclassify_nn.cc
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkclassify_nn-pkclassify_nn.Tpo $(DEPDIR)/pkclassify_nn-pkclassify_nn.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkclassify_nn.cc' object='pkclassify_nn-pkclassify_nn.o' libtool=no @AMDEPBACKSLASH@
+pkann-pkann.o: pkann.cc
+ at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkann_CXXFLAGS) $(CXXFLAGS) -MT pkann-pkann.o -MD -MP -MF $(DEPDIR)/pkann-pkann.Tpo -c -o pkann-pkann.o `test -f 'pkann.cc' || echo '$(srcdir)/'`pkann.cc
+ at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkann-pkann.Tpo $(DEPDIR)/pkann-pkann.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkann.cc' object='pkann-pkann.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkann_CXXFLAGS) $(CXXFLAGS) -c -o pkann-pkann.o `test -f 'pkann.cc' || echo '$(srcdir)/'`pkann.cc
+
+pkann-pkann.obj: pkann.cc
+ at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkann_CXXFLAGS) $(CXXFLAGS) -MT pkann-pkann.obj -MD -MP -MF $(DEPDIR)/pkann-pkann.Tpo -c -o pkann-pkann.obj `if test -f 'pkann.cc'; then $(CYGPATH_W) 'pkann.cc'; else $(CYGPATH_W) '$(srcdir)/pkann.cc'; fi`
+ at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkann-pkann.Tpo $(DEPDIR)/pkann-pkann.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkann.cc' object='pkann-pkann.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkann_CXXFLAGS) $(CXXFLAGS) -c -o pkann-pkann.obj `if test -f 'pkann.cc'; then $(CYGPATH_W) 'pkann.cc'; else $(CYGPATH_W) '$(srcdir)/pkann.cc'; fi`
+
+pkfsann-pkfsann.o: pkfsann.cc
+ at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfsann_CXXFLAGS) $(CXXFLAGS) -MT pkfsann-pkfsann.o -MD -MP -MF $(DEPDIR)/pkfsann-pkfsann.Tpo -c -o pkfsann-pkfsann.o `test -f 'pkfsann.cc' || echo '$(srcdir)/'`pkfsann.cc
+ at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkfsann-pkfsann.Tpo $(DEPDIR)/pkfsann-pkfsann.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkfsann.cc' object='pkfsann-pkfsann.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkclassify_nn_CXXFLAGS) $(CXXFLAGS) -c -o pkclassify_nn-pkclassify_nn.o `test -f 'pkclassify_nn.cc' || echo '$(srcdir)/'`pkclassify_nn.cc
+ at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfsann_CXXFLAGS) $(CXXFLAGS) -c -o pkfsann-pkfsann.o `test -f 'pkfsann.cc' || echo '$(srcdir)/'`pkfsann.cc
 
-pkclassify_nn-pkclassify_nn.obj: pkclassify_nn.cc
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkclassify_nn_CXXFLAGS) $(CXXFLAGS) -MT pkclassify_nn-pkclassify_nn.obj -MD -MP -MF $(DEPDIR)/pkclassify_nn-pkclassify_nn.Tpo -c -o pkclassify_nn-pkclassify_nn.obj `if test -f 'pkclassify_nn.cc'; then $(CYGPATH_W) 'pkclassify_nn.cc'; else $(CYGPATH_W) '$(srcdir)/pkclassify_nn.cc'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkclassify_nn-pkclassify_nn.Tpo $(DEPDIR)/pkclassify_nn-pkclassify_nn.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkclassify_nn.cc' object='pkclassify_nn-pkclassify_nn.obj' libtool=no @AMDEPBACKSLASH@
+pkfsann-pkfsann.obj: pkfsann.cc
+ at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfsann_CXXFLAGS) $(CXXFLAGS) -MT pkfsann-pkfsann.obj -MD -MP -MF $(DEPDIR)/pkfsann-pkfsann.Tpo -c -o pkfsann-pkfsann.obj `if test -f 'pkfsann.cc'; then $(CYGPATH_W) 'pkfsann.cc'; else $(CYGPATH_W) '$(srcdir)/pkfsann.cc'; fi`
+ at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkfsann-pkfsann.Tpo $(DEPDIR)/pkfsann-pkfsann.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkfsann.cc' object='pkfsann-pkfsann.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkclassify_nn_CXXFLAGS) $(CXXFLAGS) -c -o pkclassify_nn-pkclassify_nn.obj `if test -f 'pkclassify_nn.cc'; then $(CYGPATH_W) 'pkclassify_nn.cc'; else $(CYGPATH_W) '$(srcdir)/pkclassify_nn.cc'; fi`
+ at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfsann_CXXFLAGS) $(CXXFLAGS) -c -o pkfsann-pkfsann.obj `if test -f 'pkfsann.cc'; then $(CYGPATH_W) 'pkfsann.cc'; else $(CYGPATH_W) '$(srcdir)/pkfsann.cc'; fi`
 
 svm.o: $(top_srcdir)/src/algorithms/svm.cpp
 @am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT svm.o -MD -MP -MF $(DEPDIR)/svm.Tpo -c -o svm.o `test -f '$(top_srcdir)/src/algorithms/svm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/src/algorithms/svm.cpp
@@ -849,33 +860,19 @@ svm.obj: $(top_srcdir)/src/algorithms/svm.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o svm.obj `if test -f '$(top_srcdir)/src/algorithms/svm.cpp'; then $(CYGPATH_W) '$(top_srcdir)/src/algorithms/svm.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/src/algorithms/svm.cpp'; fi`
 
-pkfs_nn-pkfs_nn.o: pkfs_nn.cc
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfs_nn_CXXFLAGS) $(CXXFLAGS) -MT pkfs_nn-pkfs_nn.o -MD -MP -MF $(DEPDIR)/pkfs_nn-pkfs_nn.Tpo -c -o pkfs_nn-pkfs_nn.o `test -f 'pkfs_nn.cc' || echo '$(srcdir)/'`pkfs_nn.cc
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkfs_nn-pkfs_nn.Tpo $(DEPDIR)/pkfs_nn-pkfs_nn.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkfs_nn.cc' object='pkfs_nn-pkfs_nn.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfs_nn_CXXFLAGS) $(CXXFLAGS) -c -o pkfs_nn-pkfs_nn.o `test -f 'pkfs_nn.cc' || echo '$(srcdir)/'`pkfs_nn.cc
-
-pkfs_nn-pkfs_nn.obj: pkfs_nn.cc
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfs_nn_CXXFLAGS) $(CXXFLAGS) -MT pkfs_nn-pkfs_nn.obj -MD -MP -MF $(DEPDIR)/pkfs_nn-pkfs_nn.Tpo -c -o pkfs_nn-pkfs_nn.obj `if test -f 'pkfs_nn.cc'; then $(CYGPATH_W) 'pkfs_nn.cc'; else $(CYGPATH_W) '$(srcdir)/pkfs_nn.cc'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkfs_nn-pkfs_nn.Tpo $(DEPDIR)/pkfs_nn-pkfs_nn.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkfs_nn.cc' object='pkfs_nn-pkfs_nn.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkfs_nn_CXXFLAGS) $(CXXFLAGS) -c -o pkfs_nn-pkfs_nn.obj `if test -f 'pkfs_nn.cc'; then $(CYGPATH_W) 'pkfs_nn.cc'; else $(CYGPATH_W) '$(srcdir)/pkfs_nn.cc'; fi`
-
-pkregression_nn-pkregression_nn.o: pkregression_nn.cc
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregression_nn_CXXFLAGS) $(CXXFLAGS) -MT pkregression_nn-pkregression_nn.o -MD -MP -MF $(DEPDIR)/pkregression_nn-pkregression_nn.Tpo -c -o pkregression_nn-pkregression_nn.o `test -f 'pkregression_nn.cc' || echo '$(srcdir)/'`pkregression_nn.cc
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkregression_nn-pkregression_nn.Tpo $(DEPDIR)/pkregression_nn-pkregression_nn.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkregression_nn.cc' object='pkregression_nn-pkregression_nn.o' libtool=no @AMDEPBACKSLASH@
+pkregann-pkregann.o: pkregann.cc
+ at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregann_CXXFLAGS) $(CXXFLAGS) -MT pkregann-pkregann.o -MD -MP -MF $(DEPDIR)/pkregann-pkregann.Tpo -c -o pkregann-pkregann.o `test -f 'pkregann.cc' || echo '$(srcdir)/'`pkregann.cc
+ at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkregann-pkregann.Tpo $(DEPDIR)/pkregann-pkregann.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkregann.cc' object='pkregann-pkregann.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregression_nn_CXXFLAGS) $(CXXFLAGS) -c -o pkregression_nn-pkregression_nn.o `test -f 'pkregression_nn.cc' || echo '$(srcdir)/'`pkregression_nn.cc
+ at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregann_CXXFLAGS) $(CXXFLAGS) -c -o pkregann-pkregann.o `test -f 'pkregann.cc' || echo '$(srcdir)/'`pkregann.cc
 
-pkregression_nn-pkregression_nn.obj: pkregression_nn.cc
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregression_nn_CXXFLAGS) $(CXXFLAGS) -MT pkregression_nn-pkregression_nn.obj -MD -MP -MF $(DEPDIR)/pkregression_nn-pkregression_nn.Tpo -c -o pkregression_nn-pkregression_nn.obj `if test -f 'pkregression_nn.cc'; then $(CYGPATH_W) 'pkregression_nn.cc'; else $(CYGPATH_W) '$(srcdir)/pkregression_nn.cc'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkregression_nn-pkregression_nn.Tpo $(DEPDIR)/pkregression_nn-pkregression_nn.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkregression_nn.cc' object='pkregression_nn-pkregression_nn.obj' libtool=no @AMDEPBACKSLASH@
+pkregann-pkregann.obj: pkregann.cc
+ at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregann_CXXFLAGS) $(CXXFLAGS) -MT pkregann-pkregann.obj -MD -MP -MF $(DEPDIR)/pkregann-pkregann.Tpo -c -o pkregann-pkregann.obj `if test -f 'pkregann.cc'; then $(CYGPATH_W) 'pkregann.cc'; else $(CYGPATH_W) '$(srcdir)/pkregann.cc'; fi`
+ at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/pkregann-pkregann.Tpo $(DEPDIR)/pkregann-pkregann.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='pkregann.cc' object='pkregann-pkregann.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregression_nn_CXXFLAGS) $(CXXFLAGS) -c -o pkregression_nn-pkregression_nn.obj `if test -f 'pkregression_nn.cc'; then $(CYGPATH_W) 'pkregression_nn.cc'; else $(CYGPATH_W) '$(srcdir)/pkregression_nn.cc'; fi`
+ at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pkregann_CXXFLAGS) $(CXXFLAGS) -c -o pkregann-pkregann.obj `if test -f 'pkregann.cc'; then $(CYGPATH_W) 'pkregann.cc'; else $(CYGPATH_W) '$(srcdir)/pkregann.cc'; fi`
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/apps/pkclassify_nn.cc b/src/apps/pkann.cc
similarity index 98%
rename from src/apps/pkclassify_nn.cc
rename to src/apps/pkann.cc
index 3fadf15..c4eefd4 100644
--- a/src/apps/pkclassify_nn.cc
+++ b/src/apps/pkann.cc
@@ -17,6 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
+#include <stdlib.h>
 #include <vector>
 #include <map>
 #include <algorithm>
@@ -28,7 +29,7 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include "base/PosValue.h"
 #include "algorithms/ConfusionMatrix.h"
 #include "floatfann.h"
-#include "myfann_cpp.h"
+#include "algorithms/myfann_cpp.h"
 
 using namespace std;
 
@@ -41,6 +42,7 @@ int main(int argc, char *argv[])
   Optionpk<string> training_opt("t", "training", "training shape file. A single shape file contains all training features (must be set as: B0, B1, B2,...) for all classes (class numbers identified by label option). Use multiple training files for bootstrap aggregation (alternative to the bag and bsize options, where a random subset is taken from a single training file)"); 
   Optionpk<string> label_opt("label", "label", "identifier for class label in training shape file.","label"); 
   Optionpk<unsigned int> balance_opt("bal", "balance", "balance the input data to this number of samples for each class", 0);
+  Optionpk<bool> random_opt("random", "random", "in case of balance, randomize input data", true);
   Optionpk<int> minSize_opt("min", "min", "if number of training pixels is less then min, do not take this class into account (0: consider all classes)", 0);
   Optionpk<double> start_opt("s", "start", "start band sequence number (set to 0)",0); 
   Optionpk<double> end_opt("e", "end", "end band sequence number (set to 0 for all bands)", 0); 
@@ -83,6 +85,7 @@ int main(int argc, char *argv[])
     training_opt.retrieveOption(argc,argv);
     label_opt.retrieveOption(argc,argv);
     balance_opt.retrieveOption(argc,argv);
+    random_opt.retrieveOption(argc,argv);
     minSize_opt.retrieveOption(argc,argv);
     start_opt.retrieveOption(argc,argv);
     end_opt.retrieveOption(argc,argv);
@@ -261,7 +264,7 @@ int main(int argc, char *argv[])
       if(balance_opt[0]>0){
         while(balance_opt.size()<nclass)
           balance_opt.push_back(balance_opt.back());
-        if(random)
+        if(random_opt[0])
           srand(time(NULL));
         totalSamples=0;
         for(int iclass=0;iclass<nclass;++iclass){
@@ -387,7 +390,7 @@ int main(int argc, char *argv[])
       int nctraining=0;
       if(verbose_opt[0]>=1)
         cout << "calculating features for class " << iclass << endl;
-      if(random)
+      if(random_opt[0])
         srand(time(NULL));
       nctraining=(bagSize_opt[iclass]<100)? trainingPixels[iclass].size()/100.0*bagSize_opt[iclass] : trainingPixels[iclass].size();//bagSize_opt[iclass] given in % of training size
       if(nctraining<=0)
@@ -850,7 +853,7 @@ int main(int argc, char *argv[])
               probOut[iclass][icol]+=result[iclass]*priors[iclass];//add probabilities for each bag
               break;
             case(1)://product rule
-              probOut[iclass][icol]*=pow(priors[iclass],static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
+              probOut[iclass][icol]*=pow(static_cast<float>(priors[iclass]),static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
               break;
             case(2)://max rule
               if(priors[iclass]*result[iclass]>probOut[iclass][icol])
@@ -889,7 +892,7 @@ int main(int argc, char *argv[])
         for(short iclass=0;iclass<nclass;++iclass){
           float prv=probOut[iclass][icol];
           prv/=normBag;
-          entropy[icol]-=prv*log(prv)/log(2);
+          entropy[icol]-=prv*log(prv)/log(2.0);
           prv*=100.0;
             
           probOut[iclass][icol]=static_cast<short>(prv+0.5);
@@ -897,7 +900,7 @@ int main(int argc, char *argv[])
           // assert(classValueMap[nameVector[iclass]]>=0);
           // probOut[classValueMap[nameVector[iclass]]][icol]=static_cast<short>(prv+0.5);
         }
-        entropy[icol]/=log(nclass)/log(2);
+        entropy[icol]/=log(static_cast<double>(nclass))/log(2.0);
         entropy[icol]=static_cast<short>(100*entropy[icol]+0.5);
 	if(active_opt.size()){
 	  if(entropy[icol]>activePoints.back().value){
@@ -1042,7 +1045,7 @@ int main(int argc, char *argv[])
 		probOut[iclass]+=result[iclass]*priors[iclass];//add probabilities for each bag
               break;
 	      case(1)://product rule
-		probOut[iclass]*=pow(priors[iclass],static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
+		probOut[iclass]*=pow(static_cast<float>(priors[iclass]),static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
 		break;
 	      case(2)://max rule
 		if(priors[iclass]*result[iclass]>probOut[iclass])
diff --git a/src/apps/pkascii2img.cc b/src/apps/pkascii2img.cc
index 82a10bb..57bf31c 100644
--- a/src/apps/pkascii2img.cc
+++ b/src/apps/pkascii2img.cc
@@ -19,7 +19,7 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
 #include <string>
 #include <fstream>
-#include "Optionpk.h"
+#include "base/Optionpk.h"
 #include <assert.h>
 #include "imageclasses/ImgWriterGdal.h"
 
diff --git a/src/apps/pkmosaic.cc b/src/apps/pkcomposit.cc
similarity index 99%
rename from src/apps/pkmosaic.cc
rename to src/apps/pkcomposit.cc
index 4e3e4aa..a88a430 100644
--- a/src/apps/pkmosaic.cc
+++ b/src/apps/pkcomposit.cc
@@ -894,7 +894,7 @@ int main(int argc, char *argv[])
       else{
         for(int icol=0;icol<imgWriter.nrOfCol();++icol){
           vector<short>::iterator maxit=maxBuffer[icol].begin();
-          maxit=stat.max(maxBuffer[icol],maxBuffer[icol].begin(),maxBuffer[icol].end());
+          maxit=stat.mymax(maxBuffer[icol],maxBuffer[icol].begin(),maxBuffer[icol].end());
           writeBuffer[0][icol]=distance(maxBuffer[icol].begin(),maxit);
           fileBuffer[icol]=*(maxit);
         }
diff --git a/src/apps/pkdiff.cc b/src/apps/pkdiff.cc
index d299fe5..ae744a2 100644
--- a/src/apps/pkdiff.cc
+++ b/src/apps/pkdiff.cc
@@ -22,7 +22,7 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include "imageclasses/ImgWriterGdal.h"
 #include "imageclasses/ImgReaderOgr.h"
 #include "imageclasses/ImgWriterOgr.h"
-#include "Optionpk.h"
+#include "base/Optionpk.h"
 #include "algorithms/ConfusionMatrix.h"
 
 using namespace std;
diff --git a/src/apps/pkdumpimg.cc b/src/apps/pkdumpimg.cc
index 671d4e2..0e40462 100644
--- a/src/apps/pkdumpimg.cc
+++ b/src/apps/pkdumpimg.cc
@@ -22,7 +22,7 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include <vector>
 #include <iostream>
 #include <assert.h>
-#include "Optionpk.h"
+#include "base/Optionpk.h"
 #include "imageclasses/ImgReaderOgr.h"
 #include "imageclasses/ImgWriterGdal.h"
 // #include "imageclasses/ImgWriterOgr.h"
diff --git a/src/apps/pkextract.cc b/src/apps/pkextract.cc
index 8b61bbd..889faf4 100644
--- a/src/apps/pkextract.cc
+++ b/src/apps/pkextract.cc
@@ -19,6 +19,7 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
 #include <assert.h>
 #include <math.h>
+#include <stdlib.h>
 #include <sstream>
 #include <string>
 #include <algorithm>
@@ -241,7 +242,7 @@ int main(int argc, char *argv[])
   void* pProgressArg=NULL;
   GDALProgressFunc pfnProgress=GDALTermProgress;
   double progress=0;
-  srandom(time(NULL));
+  srand(time(NULL));
 
   bool sampleIsRaster=false;
   ImgReaderOgr sampleReaderOgr;
@@ -422,7 +423,7 @@ int main(int argc, char *argv[])
               }
               float theThreshold=(threshold_opt.size()>1)?threshold_opt[processClass]:threshold_opt[0];
               if(theThreshold>0){//percentual value
-                double p=static_cast<double>(random())/(RAND_MAX);
+                double p=static_cast<double>(rand())/(RAND_MAX);
                 p*=100.0;
                 if(p>theThreshold)
 		  continue;//do not select for now, go to next column
@@ -666,7 +667,7 @@ int main(int argc, char *argv[])
               }
               float theThreshold=(threshold_opt.size()>1)?threshold_opt[processClass]:threshold_opt[0];
               if(theThreshold>0){//percentual value
-                double p=static_cast<double>(random())/(RAND_MAX);
+                double p=static_cast<double>(rand())/(RAND_MAX);
                 p*=100.0;
                 if(p>theThreshold)
                   continue;//do not select for now, go to next column
@@ -886,7 +887,7 @@ int main(int argc, char *argv[])
 	if(verbose_opt[0]>0)
 	  std::cout << "reading feature " << readFeature->GetFID() << std::endl;
 	if(threshold_opt[0]>0){//percentual value
-	  double p=static_cast<double>(random())/(RAND_MAX);
+	  double p=static_cast<double>(rand())/(RAND_MAX);
 	  p*=100.0;
 	  if(p>threshold_opt[0]){
 	    if(test_opt.size())
@@ -1695,7 +1696,7 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  std::cout << "number of points in polygon: " << nPointPolygon << std::endl;
 		//search for min class
-		int minClass=stat.max(class_opt);
+		int minClass=stat.mymax(class_opt);
 		for(int iclass=0;iclass<class_opt.size();++iclass){
 		  if(polyValues[iclass]>0){
 		    if(verbose_opt[0]>1)
@@ -1715,7 +1716,7 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  std::cout << "number of points in polygon: " << nPointPolygon << std::endl;
 		//search for max class
-		int maxClass=stat.min(class_opt);
+		int maxClass=stat.mymin(class_opt);
 		for(int iclass=0;iclass<class_opt.size();++iclass){
 		  if(polyValues[iclass]>0){
 		    if(verbose_opt[0]>1)
@@ -1735,9 +1736,9 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  std::cout << "number of points in polygon: " << nPointPolygon << std::endl;
 		//search for class with maximum votes
-		int maxClass=stat.min(class_opt);
+		int maxClass=stat.mymin(class_opt);
 		vector<double>::iterator maxit;
-		maxit=stat.max(polyValues,polyValues.begin(),polyValues.end());
+		maxit=stat.mymax(polyValues,polyValues.begin(),polyValues.end());
 		int maxIndex=distance(polyValues.begin(),maxit);
 		maxClass=class_opt[maxIndex];
 		if(verbose_opt[0]>0)
@@ -2300,7 +2301,7 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  std::cout << "number of points in polygon: " << nPointPolygon << std::endl;
 		//search for min class
-		int minClass=stat.max(class_opt);
+		int minClass=stat.mymax(class_opt);
 		for(int iclass=0;iclass<class_opt.size();++iclass){
 		  if(polyValues[iclass]>0){
 		    if(verbose_opt[0]>1)
@@ -2319,7 +2320,7 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  std::cout << "number of points in polygon: " << nPointPolygon << std::endl;
 		//search for max class
-		int maxClass=stat.min(class_opt);
+		int maxClass=stat.mymin(class_opt);
 		for(int iclass=0;iclass<class_opt.size();++iclass){
 		  if(polyValues[iclass]>0){
 		    if(verbose_opt[0]>1)
@@ -2338,9 +2339,9 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  std::cout << "number of points in polygon: " << nPointPolygon << std::endl;
 		//search for max votes
-		int maxClass=stat.min(class_opt);
+		int maxClass=stat.mymin(class_opt);
 		vector<double>::iterator maxit;
-		maxit=stat.max(polyValues,polyValues.begin(),polyValues.end());
+		maxit=stat.mymax(polyValues,polyValues.begin(),polyValues.end());
 		int maxIndex=distance(polyValues.begin(),maxit);
 		maxClass=class_opt[maxIndex];
 	      }
diff --git a/src/apps/pkfs_nn.cc b/src/apps/pkfsann.cc
similarity index 97%
rename from src/apps/pkfs_nn.cc
rename to src/apps/pkfsann.cc
index 99bbb48..4a8c939 100644
--- a/src/apps/pkfs_nn.cc
+++ b/src/apps/pkfsann.cc
@@ -17,29 +17,28 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
+#include <stdlib.h>
 #include <vector>
 #include <string>
 #include <map>
 #include <algorithm>
-#include "floatfann.h"
-#include "imageclasses/ImgReaderOgr.h"
-// #include "imageclasses/ImgReaderGdal.h"
-// #include "imageclasses/ImgWriterGdal.h"
-// #include "imageclasses/ImgWriterOgr.h"
 #include "base/Optionpk.h"
-#include "algorithms/myfann_cpp.h"
+#include "imageclasses/ImgReaderOgr.h"
 #include "algorithms/ConfusionMatrix.h"
 #include "algorithms/FeatureSelector.h"
+#include "floatfann.h"
+#include "algorithms/myfann_cpp.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+enum SelectorValue  { NA=0, SFFS=1, SFS=2, SBS=3, BFS=4 };
+
 using namespace std;
 
 #define Malloc(type,n) (type *)malloc((n)*sizeof(type))
 
-enum SelectorValue  { NA=0, SFFS=1, SFS=2, SBS=3, BFS=4 };
 
 //global parameters used in cost function getCost
 map<string,short> classValueMap;
@@ -159,11 +158,6 @@ double getCost(const vector<Vector2d<float> > &trainingFeatures)
   else{//not working yet. please repair...
     assert(cv_opt[0]>0);
     bool initWeights=true;
-    //test
-    cout << "tempFeatures.size(): " << tmpFeatures.size() << endl;
-    cout << "ntraining: " << ntraining << endl;
-    cout << "initWeights: " << initWeights << endl;
-    cout << "maxit_opt.size(): " << maxit_opt.size() << endl;
     net.train_on_data(tmpFeatures,ntraining,initWeights, maxit_opt[0],
                       iterations_between_reports, desired_error);
     vector<Vector2d<float> > testFeatures(nclass);
@@ -175,8 +169,6 @@ double getCost(const vector<Vector2d<float> > &trainingFeatures)
 	for(int ifeature=0;ifeature<nFeatures;++ifeature){
           testFeatures[iclass][isample][ifeature]=trainingFeatures[iclass][nctraining[iclass]+isample][ifeature];
         }
-	//test
-	cout << "isample:" << isample<< endl;
         result=net.run(testFeatures[iclass][isample]);
         string refClassName=nameVector[iclass];
         float maxP=-1;
@@ -187,19 +179,13 @@ double getCost(const vector<Vector2d<float> > &trainingFeatures)
             maxClass=ic;
           }
         }
-	//test
-	cout << "maxClass:" << maxClass << "(" << nameVector.size() << ")" << endl;
         string className=nameVector[maxClass];
-	//test
-	cout << "className:" << nameVector[maxClass] << endl;
         if(classValueMap.size())
           cm.incrementResult(type2string<short>(classValueMap[refClassName]),type2string<short>(classValueMap[className]),1.0);
         else
           cm.incrementResult(cm.getClass(referenceVector[isample]),cm.getClass(outputVector[isample]),1.0);
       }
     }
-    //test
-    cout << "debug12" << endl;
   }
   assert(cm.nReference());
   return(cm.kappa());
@@ -215,6 +201,7 @@ int main(int argc, char *argv[])
   Optionpk<string> label_opt("\0", "label", "identifier for class label in training shape file.","label"); 
   Optionpk<unsigned short> maxFeatures_opt("n", "nf", "number of features to select (0 to select optimal number, see also ecost option)", 0);
   Optionpk<unsigned int> balance_opt("\0", "balance", "balance the input data to this number of samples for each class", 0);
+  Optionpk<bool> random_opt("random","random", "in case of balance, randomize input data", true);
   Optionpk<int> minSize_opt("m", "min", "if number of training pixels is less then min, do not take this class into account", 0);
   Optionpk<double> start_opt("s", "start", "start band sequence number (set to 0)",0); 
   Optionpk<double> end_opt("e", "end", "end band sequence number (set to 0 for all bands)", 0); 
@@ -233,6 +220,7 @@ int main(int argc, char *argv[])
     maxFeatures_opt.retrieveOption(argc,argv);
     label_opt.retrieveOption(argc,argv);
     balance_opt.retrieveOption(argc,argv);
+    random_opt.retrieveOption(argc,argv);
     minSize_opt.retrieveOption(argc,argv);
     start_opt.retrieveOption(argc,argv);
     end_opt.retrieveOption(argc,argv);
@@ -418,7 +406,7 @@ int main(int argc, char *argv[])
   //do not remove outliers here: could easily be obtained through ogr2ogr -where 'B2<110' output.shp input.shp
   //balance training data
   if(balance_opt[0]>0){
-    if(random)
+    if(random_opt[0])
       srand(time(NULL));
     totalSamples=0;
     for(int iclass=0;iclass<nclass;++iclass){
diff --git a/src/apps/pkfs_svm.cc b/src/apps/pkfssvm.cc
similarity index 99%
rename from src/apps/pkfs_svm.cc
rename to src/apps/pkfssvm.cc
index bc839cf..65c6cab 100644
--- a/src/apps/pkfs_svm.cc
+++ b/src/apps/pkfssvm.cc
@@ -17,6 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
+#include <stdlib.h>
 #include <vector>
 #include <string>
 #include <map>
@@ -224,6 +225,7 @@ int main(int argc, char *argv[])
   Optionpk<string> label_opt("\0", "label", "identifier for class label in training shape file.","label"); 
   Optionpk<unsigned short> maxFeatures_opt("n", "nf", "number of features to select (0 to select optimal number, see also ecost option)", 0);
   Optionpk<unsigned int> balance_opt("\0", "balance", "balance the input data to this number of samples for each class", 0);
+  Optionpk<bool> random_opt("random","random", "in case of balance, randomize input data", true);
   Optionpk<int> minSize_opt("m", "min", "if number of training pixels is less then min, do not take this class into account", 0);
   Optionpk<double> start_opt("s", "start", "start band sequence number (set to 0)",0); 
   Optionpk<double> end_opt("e", "end", "end band sequence number (set to 0 for all bands)", 0); 
@@ -240,6 +242,7 @@ int main(int argc, char *argv[])
     maxFeatures_opt.retrieveOption(argc,argv);
     label_opt.retrieveOption(argc,argv);
     balance_opt.retrieveOption(argc,argv);
+    random_opt.retrieveOption(argc,argv);
     minSize_opt.retrieveOption(argc,argv);
     start_opt.retrieveOption(argc,argv);
     end_opt.retrieveOption(argc,argv);
@@ -439,8 +442,9 @@ int main(int argc, char *argv[])
 
   //do not remove outliers here: could easily be obtained through ogr2ogr -where 'B2<110' output.shp input.shp
   //balance training data
+  //todo: do I mean to use random_opt?
   if(balance_opt[0]>0){
-    if(random)
+    if(random_opt[0])
       srand(time(NULL));
     totalSamples=0;
     for(int iclass=0;iclass<nclass;++iclass){
diff --git a/src/apps/pklas2img.cc b/src/apps/pklas2img.cc
index 77aa6a0..293318a 100644
--- a/src/apps/pklas2img.cc
+++ b/src/apps/pklas2img.cc
@@ -352,9 +352,9 @@ int main(int argc,char **argv) {
       else{
         statfactory::StatFactory stat;
         if(composite_opt[0]=="min")
-          outputData[irow][icol]=stat.min(inputData[irow][icol]);
+          outputData[irow][icol]=stat.mymin(inputData[irow][icol]);
         else if(composite_opt[0]=="max")
-          outputData[irow][icol]=stat.max(inputData[irow][icol]);
+          outputData[irow][icol]=stat.mymax(inputData[irow][icol]);
         else if(composite_opt[0]=="median")
           outputData[irow][icol]=stat.median(inputData[irow][icol]);
         else if(composite_opt[0]=="mean")
diff --git a/src/apps/pkopt_svm.cc b/src/apps/pkoptsvm.cc
similarity index 98%
rename from src/apps/pkopt_svm.cc
rename to src/apps/pkoptsvm.cc
index 0a8ff6b..b1422bc 100644
--- a/src/apps/pkopt_svm.cc
+++ b/src/apps/pkoptsvm.cc
@@ -235,6 +235,7 @@ int main(int argc, char *argv[])
   Optionpk<string> label_opt("\0", "label", "identifier for class label in training shape file.","label"); 
   // Optionpk<unsigned short> reclass_opt("\0", "rc", "reclass code (e.g. --rc=12 --rc=23 to reclass first two classes to 12 and 23 resp.).", 0);
   Optionpk<unsigned int> balance_opt("\0", "balance", "balance the input data to this number of samples for each class", 0);
+  Optionpk<bool> random_opt("random","random", "in case of balance, randomize input data", true);
   Optionpk<int> minSize_opt("m", "min", "if number of training pixels is less then min, do not take this class into account", 0);
   Optionpk<double> start_opt("s", "start", "start band sequence number (set to 0)",0); 
   Optionpk<double> end_opt("e", "end", "end band sequence number (set to 0 for all bands)", 0); 
@@ -255,6 +256,7 @@ int main(int argc, char *argv[])
     label_opt.retrieveOption(argc,argv);
     // reclass_opt.retrieveOption(argc,argv);
     balance_opt.retrieveOption(argc,argv);
+	random_opt.retrieveOption(argc,argv);
     minSize_opt.retrieveOption(argc,argv);
     start_opt.retrieveOption(argc,argv);
     end_opt.retrieveOption(argc,argv);
@@ -453,7 +455,7 @@ int main(int argc, char *argv[])
   //do not remove outliers here: could easily be obtained through ogr2ogr -where 'B2<110' output.shp input.shp
   //balance training data
   if(balance_opt[0]>0){
-    if(random)
+    if(random_opt[0])
       srand(time(NULL));
     totalSamples=0;
     for(int iclass=0;iclass<nclass;++iclass){
@@ -601,8 +603,8 @@ int main(int argc, char *argv[])
     double progress=0;
     if(!verbose_opt[0])
       pfnProgress(progress,pszMessage,pProgressArg);
-    double ncost=log(ccost_opt[1])/log(10)-log(ccost_opt[0])/log(10);
-    double ngamma=log(gamma_opt[1])/log(10)-log(gamma_opt[0])/log(10);
+    double ncost=log(ccost_opt[1])/log(10.0)-log(ccost_opt[0])/log(10.0);
+    double ngamma=log(gamma_opt[1])/log(10.0)-log(gamma_opt[0])/log(10.0);
     for(double ccost=ccost_opt[0];ccost<=ccost_opt[1];ccost*=step_opt[0]){
       for(double gamma=gamma_opt[0];gamma<=gamma_opt[1];gamma*=step_opt[1]){
 	x[0]=ccost;
diff --git a/src/apps/pkregression_nn.cc b/src/apps/pkregann.cc
similarity index 99%
rename from src/apps/pkregression_nn.cc
rename to src/apps/pkregann.cc
index 88155e0..1e052a1 100644
--- a/src/apps/pkregression_nn.cc
+++ b/src/apps/pkregann.cc
@@ -22,8 +22,7 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include "base/Optionpk.h"
 #include "fileclasses/FileReaderAscii.h"
 #include "floatfann.h"
-#include "myfann_cpp.h"
-
+#include "algorithms/myfann_cpp.h"
 using namespace std;
 
 int main(int argc, char *argv[])
diff --git a/src/apps/pkstatascii.cc b/src/apps/pkstatascii.cc
index 787607e..6dbb3f1 100644
--- a/src/apps/pkstatascii.cc
+++ b/src/apps/pkstatascii.cc
@@ -194,13 +194,13 @@ int main(int argc, char *argv[])
     if(median_opt[0])
       cout << "median value column " << col_opt[icol] << ": " << stat.median(dataVector[icol]) << endl;
     if(minmax_opt[0]){
-      cout << "min value column " << col_opt[icol] << ": " << stat.min(dataVector[icol]) << endl;
-      cout << "max value column " << col_opt[icol] << ": " << stat.max(dataVector[icol]) << endl;
+      cout << "min value column " << col_opt[icol] << ": " << stat.mymin(dataVector[icol]) << endl;
+      cout << "max value column " << col_opt[icol] << ": " << stat.mymax(dataVector[icol]) << endl;
     }
     if(min_opt[0])
-      cout << "min value column " << col_opt[icol] << ": " << stat.min(dataVector[icol]) << endl;
+      cout << "min value column " << col_opt[icol] << ": " << stat.mymin(dataVector[icol]) << endl;
     if(max_opt[0])
-      cout << "max value column " << col_opt[icol] << ": " << stat.max(dataVector[icol]) << endl;
+      cout << "max value column " << col_opt[icol] << ": " << stat.mymax(dataVector[icol]) << endl;
     if(histogram_opt[0]){
       //todo: support kernel density function and estimate sigma as in practical estimate of the bandwith in http://en.wikipedia.org/wiki/Kernel_density_estimation
       double sigma=0;
diff --git a/src/apps/pkclassify_svm.cc b/src/apps/pksvm.cc
similarity index 98%
rename from src/apps/pkclassify_svm.cc
rename to src/apps/pksvm.cc
index 1ed2ffa..b428f95 100644
--- a/src/apps/pkclassify_svm.cc
+++ b/src/apps/pksvm.cc
@@ -17,6 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
+#include <stdlib.h>
 #include <vector>
 #include <map>
 #include <algorithm>
@@ -51,6 +52,7 @@ int main(int argc, char *argv[])
   Optionpk<string> training_opt("t", "training", "training shape file. A single shape file contains all training features (must be set as: B0, B1, B2,...) for all classes (class numbers identified by label option). Use multiple training files for bootstrap aggregation (alternative to the bag and bsize options, where a random subset is taken from a single training file)"); 
   Optionpk<string> label_opt("label", "label", "identifier for class label in training shape file.","label"); 
   Optionpk<unsigned int> balance_opt("bal", "balance", "balance the input data to this number of samples for each class", 0);
+  Optionpk<bool> random_opt("random", "random", "in case of balance, randomize input data", true);
   Optionpk<int> minSize_opt("min", "min", "if number of training pixels is less then min, do not take this class into account (0: consider all classes)", 0);
   Optionpk<double> start_opt("s", "start", "start band sequence number (set to 0)",0); 
   Optionpk<double> end_opt("e", "end", "end band sequence number (set to 0 for all bands)", 0); 
@@ -99,6 +101,7 @@ int main(int argc, char *argv[])
     training_opt.retrieveOption(argc,argv);
     label_opt.retrieveOption(argc,argv);
     balance_opt.retrieveOption(argc,argv);
+    random_opt.retrieveOption(argc,argv);
     minSize_opt.retrieveOption(argc,argv);
     start_opt.retrieveOption(argc,argv);
     end_opt.retrieveOption(argc,argv);
@@ -311,7 +314,7 @@ int main(int argc, char *argv[])
       if(balance_opt[0]>0){
         while(balance_opt.size()<nclass)
           balance_opt.push_back(balance_opt.back());
-        if(random)
+        if(random_opt[0])
           srand(time(NULL));
         totalSamples=0;
         for(short iclass=0;iclass<nclass;++iclass){
@@ -438,7 +441,7 @@ int main(int argc, char *argv[])
       int nctraining=0;
       if(verbose_opt[0]>=1)
         std::cout << "calculating features for class " << iclass << std::endl;
-      if(random)
+      if(random_opt[0])
         srand(time(NULL));
       nctraining=(bagSize_opt[iclass]<100)? trainingPixels[iclass].size()/100.0*bagSize_opt[iclass] : trainingPixels[iclass].size();//bagSize_opt[iclass] given in % of training size
       if(nctraining<=0)
@@ -847,7 +850,7 @@ int main(int argc, char *argv[])
               probOut[iclass][icol]+=result[iclass]*priors[iclass];//add probabilities for each bag
                break;
             case(1)://product rule
-              probOut[iclass][icol]*=pow(priors[iclass],static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
+              probOut[iclass][icol]*=pow(static_cast<float>(priors[iclass]),static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
               break;
             case(2)://max rule
               if(priors[iclass]*result[iclass]>probOut[iclass][icol])
@@ -887,7 +890,7 @@ int main(int argc, char *argv[])
         for(short iclass=0;iclass<nclass;++iclass){
           float prv=probOut[iclass][icol];
           prv/=normBag;
-          entropy[icol]-=prv*log(prv)/log(2);
+          entropy[icol]-=prv*log(prv)/log(2.0);
           prv*=100.0;
             
           probOut[iclass][icol]=static_cast<short>(prv+0.5);
@@ -895,7 +898,7 @@ int main(int argc, char *argv[])
           // assert(classValueMap[nameVector[iclass]]>=0);
           // probOut[classValueMap[nameVector[iclass]]][icol]=static_cast<short>(prv+0.5);
         }
-        entropy[icol]/=log(nclass)/log(2);
+        entropy[icol]/=log(static_cast<double>(nclass))/log(2.0);
         entropy[icol]=static_cast<short>(100*entropy[icol]+0.5);
 	if(active_opt.size()){
 	  if(entropy[icol]>activePoints.back().value){
@@ -1061,7 +1064,7 @@ int main(int argc, char *argv[])
 		probOut[iclass]+=result[iclass]*priors[iclass];//add probabilities for each bag
 	      break;
 	      case(1)://product rule
-		probOut[iclass]*=pow(priors[iclass],static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
+		probOut[iclass]*=pow(static_cast<float>(priors[iclass]),static_cast<float>(1.0-nbag)/nbag)*result[iclass];//multiply probabilities for each bag
 		break;
 	      case(2)://max rule
 		if(priors[iclass]*result[iclass]>probOut[iclass])
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index efde6a4..d641e68 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -19,7 +19,12 @@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@
 lib_LTLIBRARIES = libbase.la
 
 # where to install the headers on the system
-libbase_ladir = $(includedir)/base
+libbase_ladir = $(includedir)/pktools/base
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libbase_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libbase_la_HEADERS = $(top_srcdir)/config.h Vector2d.h IndexValue.h Optionpk.h PosValue.h
diff --git a/src/base/Makefile.in b/src/base/Makefile.in
index 1e0564a..f985404 100644
--- a/src/base/Makefile.in
+++ b/src/base/Makefile.in
@@ -105,6 +105,9 @@ libbase_la_LIBADD =
 am__objects_1 =
 am_libbase_la_OBJECTS = $(am__objects_1)
 libbase_la_OBJECTS = $(am_libbase_la_OBJECTS)
+libbase_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libbase_la_LDFLAGS) $(LDFLAGS) -o $@
 PROGRAMS = $(noinst_PROGRAMS)
 am_pktestOption_OBJECTS = pktestOption.$(OBJEXT)
 pktestOption_OBJECTS = $(am_pktestOption_OBJECTS)
@@ -223,6 +226,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -293,7 +297,8 @@ top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libbase.la
 
 # where to install the headers on the system
-libbase_ladir = $(includedir)/base
+libbase_ladir = $(includedir)/pktools/base
+libbase_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libbase_la_HEADERS = $(top_srcdir)/config.h Vector2d.h IndexValue.h Optionpk.h PosValue.h
@@ -371,7 +376,7 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	done
 libbase.la: $(libbase_la_OBJECTS) $(libbase_la_DEPENDENCIES) $(EXTRA_libbase_la_DEPENDENCIES) 
-	$(LINK) -rpath $(libdir) $(libbase_la_OBJECTS) $(libbase_la_LIBADD) $(LIBS)
+	$(libbase_la_LINK) -rpath $(libdir) $(libbase_la_OBJECTS) $(libbase_la_LIBADD) $(LIBS)
 
 clean-noinstPROGRAMS:
 	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
diff --git a/src/base/Optionpk.h b/src/base/Optionpk.h
index b1fdbaf..1905978 100644
--- a/src/base/Optionpk.h
+++ b/src/base/Optionpk.h
@@ -29,7 +29,12 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include <iomanip>
 #include <sstream>
 #include <typeinfo>
+#ifndef WIN32
 #include <cxxabi.h>
+#define mytypeid(T) abi::__cxa_demangle(typeid(T).name(),0,0,&status)
+#else
+#define mytypeid(T) typeid(T).name()
+#endif
 #include "ogr_feature.h"
 
 #ifdef HAVE_CONFIG_H
@@ -63,23 +68,6 @@ template<typename T> inline T string2type(std::string const& s,bool failIfLeftov
   return x;
 }
 
-///specialization for string
-template<> inline std::string string2type(std::string const& s){
-  return s;
-}
-
-///specialization for OGRFieldType
-template<> inline OGRFieldType string2type(std::string const& s){
-  OGRFieldType ftype;
-  int ogr_typecount=11;//hard coded for now!
-  for(int iType = 0; iType < ogr_typecount; ++iType){
-    if( OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType) != NULL
-        && EQUAL(OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType),s.c_str()))
-      ftype=(OGRFieldType) iType;
-  }
-  return ftype;
-}
-
 ///serialization for help or to dump option values to screen in verbose mode
 template<typename T> inline std::string type2string(T const& value){
   std::ostringstream oss;
@@ -87,40 +75,6 @@ template<typename T> inline std::string type2string(T const& value){
   return oss.str();
 }
 
-///specialization for bool
-template<> inline std::string type2string(bool const& value){
-  if(value)
-    return("true");
-  else
-    return("false");
-}
-
-///specialization for string
-template<> inline std::string type2string(std::string const& value){
-  // if(value.empty())
-  //   return("<empty string>");
-  // else
-    return(value);
-}
-
-///specialization for float
-template<> inline std::string type2string(float const& value){
-  std::ostringstream oss;
-  // oss.precision(1);
-  // oss.setf(ios::fixed);
-  oss << value;
-  return oss.str();
-}
-
-///specialization for double
-template<> inline std::string type2string(double const& value){
-  std::ostringstream oss;
-  // oss.precision(1);
-  //  oss.setf(ios::fixed);
-  oss << value;
-  return oss.str();
-}
-
 /**
 Class to implement command line options. With the constructor you can define an option, in both short `-` and long `--` format, of a specific type, help information and a default value.\n
 This class inherits from std::vector, so the option variable is a vector, supporting multiple inputs for the same option (e.g., --input file1 [--input file2 ...].
@@ -188,8 +142,11 @@ public:
                                           \n\
     You should have received a copy of the GNU General Public License\n\
     along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");};
-  std::vector<std::string>::const_iterator findSubstring(const std::string& argument) const;
-private:
+
+  //this function only makes sense for T=std::string (will need a specialization)
+  typename std::vector<T>::const_iterator findSubstring(const T& argument) const {std::string errorString="Error: findSubstring only defined for options of type std::string"; throw(errorString);};
+
+ private:
   bool hasArgument() const {return m_hasArgument;};//all options except bools should have arguments
   bool hasShortOption() const {return m_shortName.compare("\0");};
   bool hasLongOption() const {return m_longName.compare("\0");};
@@ -214,7 +171,7 @@ template<class T1> std::ostream& operator<<(std::ostream& os, const Optionpk<T1>
   return os;
 }
 
-template<class T> Optionpk<T>::Optionpk() 
+template<class T> inline Optionpk<T>::Optionpk() 
 : m_hasDefault(false)
 {
 }
@@ -225,7 +182,7 @@ shortName is option invoked with `-`\n
 longName is option invoked with `--`\n
 helpInfo is the help message that is shown when option -h or --help is invoked\n
 **/
-template<class T> Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+template<class T> inline Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
 : m_hasDefault(false)
 {
   setAll(shortName,longName,helpInfo);
@@ -241,12 +198,12 @@ hide=0 : option is visible for in both short (`-h`) and long (`--help`) help. Ty
 hide=1 : option is only visible in long help (`--help`). Typical use: expert options\n
 hide=2 : option is hidden for user. Typical use: Easter eggs or options only known to author
 **/
-template<class T> Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
+template<class T> inline Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
 {
   setAll(shortName,longName,helpInfo,defaultValue, hide);
 }
 
-template<class T> std::string Optionpk<T>::usage() const
+template<class T> inline std::string Optionpk<T>::usage() const
 {
   std::ostringstream helpss;
   std::string shortOption=m_shortName;
@@ -267,7 +224,7 @@ template<class T> std::string Optionpk<T>::usage() const
   return helpss.str();
 }
 
-template<class T> std::string Optionpk<T>::usageDoxygen() const
+template<class T> inline std::string Optionpk<T>::usageDoxygen() const
 {
   std::ostringstream helpss;
   std::string shortOption=m_shortName;
@@ -282,7 +239,8 @@ template<class T> std::string Optionpk<T>::usageDoxygen() const
   else
     helpss << std::setiosflags(std::ios::left) << "                     | ";
   int status;
-  helpss << std::setiosflags(std::ios::left) << std::setw(4) << abi::__cxa_demangle(typeid(T).name(),0,0,&status) << " | ";
+  helpss << std::setiosflags(std::ios::left) << std::setw(4) << mytypeid(T) << " | ";
+  //helpss << std::setiosflags(std::ios::left) << std::setw(4) << abi::__cxa_demangle(typeid(T).name(),0,0,&status) << " | ";
   if(m_hasDefault)
     helpss <<std::setiosflags(std::ios::left) << std::setw(5) << type2string<T>(m_defaultValue) << " |";
   else
@@ -292,7 +250,7 @@ template<class T> std::string Optionpk<T>::usageDoxygen() const
   return helpss.str();
 }
 
-template<class T> void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+template<class T> inline void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
 {
   m_shortName=shortName;
   m_longName=longName;
@@ -301,7 +259,7 @@ template<class T> void Optionpk<T>::setAll(const std::string& shortName, const s
   m_hide=0;
 }
 
-template<class T> void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
+template<class T> inline void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
 {
   m_shortName=shortName;
   m_longName=longName;
@@ -312,47 +270,15 @@ template<class T> void Optionpk<T>::setAll(const std::string& shortName, const s
   m_hide=hide;
 }
 
-///specialization for bool
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo);
 
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
-{
-  m_shortName=shortName;
-  m_longName=longName;
-  m_hasArgument=false;
-  m_help=helpInfo;
-  m_hide=0;
-}
-
-///specialization for bool
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide);
-
-///specialization for bool
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
-{
-  m_shortName=shortName;
-  m_longName=longName;
-  m_hasArgument=false;
-  m_help=helpInfo;
-  m_defaultValue=defaultValue;
-  m_hasDefault=true;
-  m_hide=hide;
-}
-
-///specialization for bool
-template<> Optionpk<bool>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
-{
-  setAll(shortName,longName,helpInfo,defaultValue, hide);
-}
-
-template<class T> Optionpk<T>::~Optionpk() 
+template<class T> inline Optionpk<T>::~Optionpk() 
 {
 }
 
 /**
 make sure to call this function first before using the option in main program (or segmentation fault will occur...)
 **/
-template<class T> bool Optionpk<T>::retrieveOption(int argc, char **argv){ 
+template<class T> inline bool Optionpk<T>::retrieveOption(int argc, char **argv){ 
   bool noHelp=true;//return value, alert main program that hard coded option (help, version, license, doxygen) was invoked
   std::string helpStringShort="-h";//short option for help (hard coded)
   std::string helpStringLong="--help";//long option for help (hard coded)
@@ -420,8 +346,99 @@ template<class T> bool Optionpk<T>::retrieveOption(int argc, char **argv){
   return(noHelp);
 }
 
+//template<class T> typename std::vector<T>::const_iterator Optionpk<T>::findSubstring(const T& argument) const {std::string errorString="Error: findSubstring only defined for options of type std::string"; throw(errorString);}
+
+//todo: to be put in .cc file
+/////////////////// Specializations /////////////////
+
+///specialization for string
+template<> inline std::string string2type(std::string const& s){
+  return s;
+}
+
+///specialization for OGRFieldType
+template<> inline OGRFieldType string2type(std::string const& s){
+  OGRFieldType ftype;
+  int ogr_typecount=11;//hard coded for now!
+  for(int iType = 0; iType < ogr_typecount; ++iType){
+    if( OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType) != NULL
+        && EQUAL(OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType),s.c_str()))
+      ftype=(OGRFieldType) iType;
+  }
+  return ftype;
+}
+
+///specialization for bool
+template<> inline std::string type2string(bool const& value){
+  if(value)
+    return("true");
+  else
+    return("false");
+}
+
+///specialization for string
+template<> inline std::string type2string(std::string const& value){
+  // if(value.empty())
+  //   return("<empty string>");
+  // else
+    return(value);
+}
+
+///specialization for float
+template<> inline std::string type2string(float const& value){
+  std::ostringstream oss;
+  // oss.precision(1);
+  // oss.setf(ios::fixed);
+  oss << value;
+  return oss.str();
+}
+
+///specialization for double
+template<> inline std::string type2string(double const& value){
+  std::ostringstream oss;
+  // oss.precision(1);
+  //  oss.setf(ios::fixed);
+  oss << value;
+  return oss.str();
+}
+
+///specialization for bool
+template<> inline void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+{
+  m_shortName=shortName;
+  m_longName=longName;
+  m_hasArgument=false;
+  m_help=helpInfo;
+  m_hide=0;
+}
+
+///specialization for bool
+template<> inline void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
+{
+  m_shortName=shortName;
+  m_longName=longName;
+  m_hasArgument=false;
+  m_help=helpInfo;
+  m_defaultValue=defaultValue;
+  m_hasDefault=true;
+  m_hide=hide;
+}
+
+///specialization for bool
+template<> inline Optionpk<bool>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+{
+  setAll(shortName,longName,helpInfo);
+}
+
+///specialization for bool
+template<> inline Optionpk<bool>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
+{
+  setAll(shortName,longName,helpInfo,defaultValue, hide);
+}
+
+//specialization (only makes sense for T=std::string), generic function throws exception
 //find a substring in string option (e.g., option is of type -co INTERLEAVE=BAND)
-template<> std::vector<std::string>::const_iterator Optionpk<std::string>::findSubstring(const std::string& argument) const{
+template<> inline std::vector<std::string>::const_iterator Optionpk<std::string>::findSubstring(const std::string& argument) const{
   std::vector<std::string>::const_iterator opit=this->begin();
   while(opit!=this->end()){
     if(opit->find(argument)!=std::string::npos)
diff --git a/src/base/Vector2d.h b/src/base/Vector2d.h
index a10c192..12ac813 100644
--- a/src/base/Vector2d.h
+++ b/src/base/Vector2d.h
@@ -66,7 +66,7 @@ public:
 //   template<class T> std::ostream& operator<<(std::ostream& os, const Vector2d<T>& v);
   template<class T1> friend std::ostream& operator<<(std::ostream & os, const Vector2d<T1>& v);
   Vector2d<T> sum(const Vector2d<T>& v1, const Vector2d<T>& v2) const;
-  T max(int& x, int& y, double maxValue) const;
+  T mymax(int& x, int& y, double maxValue) const;
 
   T sum() const;
 };
@@ -285,7 +285,7 @@ template<class T> T Vector2d<T>::sum() const{
   return theSum;
 }
 
-template<class T> T Vector2d<T>::max(int& x, int& y, double maxValue) const{
+template<class T> T Vector2d<T>::mymax(int& x, int& y, double maxValue) const{
   //todo: what if this->operator[](0)[0] >=maxValue?
   // double theMax=(this->operator[](0))[0];
   double theMax=0;
diff --git a/src/fileclasses/Makefile.am b/src/fileclasses/Makefile.am
index 232603a..8b5c600 100644
--- a/src/fileclasses/Makefile.am
+++ b/src/fileclasses/Makefile.am
@@ -9,7 +9,12 @@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@
 lib_LTLIBRARIES = libfileClasses.la
 
 # where to install the headers on the system
-libfileClasses_ladir = $(includedir)/fileclasses
+libfileClasses_ladir = $(includedir)/pktools/fileclasses
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libfileClasses_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libfileClasses_la_HEADERS = FileReaderAscii.h
diff --git a/src/fileclasses/Makefile.in b/src/fileclasses/Makefile.in
index d70ef88..a8c1055 100644
--- a/src/fileclasses/Makefile.in
+++ b/src/fileclasses/Makefile.in
@@ -100,6 +100,9 @@ libfileClasses_la_LIBADD =
 am__objects_1 =
 am_libfileClasses_la_OBJECTS = $(am__objects_1) FileReaderAscii.lo
 libfileClasses_la_OBJECTS = $(am_libfileClasses_la_OBJECTS)
+libfileClasses_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(libfileClasses_la_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -212,6 +215,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -281,7 +285,8 @@ top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libfileClasses.la
 
 # where to install the headers on the system
-libfileClasses_ladir = $(includedir)/fileclasses
+libfileClasses_ladir = $(includedir)/pktools/fileclasses
+libfileClasses_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libfileClasses_la_HEADERS = FileReaderAscii.h
@@ -355,7 +360,7 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	done
 libfileClasses.la: $(libfileClasses_la_OBJECTS) $(libfileClasses_la_DEPENDENCIES) $(EXTRA_libfileClasses_la_DEPENDENCIES) 
-	$(CXXLINK) -rpath $(libdir) $(libfileClasses_la_OBJECTS) $(libfileClasses_la_LIBADD) $(LIBS)
+	$(libfileClasses_la_LINK) -rpath $(libdir) $(libfileClasses_la_OBJECTS) $(libfileClasses_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
diff --git a/src/imageclasses/ImgReaderGdal.h b/src/imageclasses/ImgReaderGdal.h
index adf903c..c3303c1 100644
--- a/src/imageclasses/ImgReaderGdal.h
+++ b/src/imageclasses/ImgReaderGdal.h
@@ -80,7 +80,7 @@ public:
   int getNoDataValues(std::vector<double>& noDataValues) const;
   bool isNoData(double value) const{if(m_noDataValues.empty()) return false;else return find(m_noDataValues.begin(),m_noDataValues.end(),value)!=m_noDataValues.end();};
   int pushNoDataValue(double noDataValue);
-  CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {getRasterBand(band)->SetNoDataValue(noDataValue);};
+  CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {return getRasterBand(band)->SetNoDataValue(noDataValue);};
   bool covers(double x, double y) const;
   bool covers(double ulx, double  uly, double lrx, double lry) const;
   bool geo2image(double x, double y, double& i, double& j) const;
@@ -89,11 +89,11 @@ public:
   double getDeltaY(void) const {double gt[6];getGeoTransform(gt);return -gt[5];};
   template<typename T> void readData(T& value, const GDALDataType& dataType, int col, int row, int band=0) const;
   template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, int row, int band=0) const;
-  template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, double row, int band=0, RESAMPLE resample=0) const;
+  template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, double row, int band=0, RESAMPLE resample=NEAR) const;
   template<typename T> void readDataBlock(Vector2d<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, int minRow, int maxRow, int band=0) const;
   template<typename T> void readDataBlock(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, int minRow, int maxRow, int band=0) const;
   template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType, int row, int band=0) const;
-  template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType, double row, int band=0, RESAMPLE resample=0) const;
+  template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType, double row, int band=0, RESAMPLE resample=NEAR) const;
   void getMinMax(int startCol, int endCol, int startRow, int endRow, int band, double& minValue, double& maxValue) const;
   void getMinMax(double& minValue, double& maxValue, int band=0, bool exhaustiveSearch=false) const;
   double getMin(int& col, int& row, int band=0) const;
diff --git a/src/imageclasses/ImgWriterGdal.h b/src/imageclasses/ImgWriterGdal.h
index 98da98b..a90f586 100644
--- a/src/imageclasses/ImgWriterGdal.h
+++ b/src/imageclasses/ImgWriterGdal.h
@@ -47,7 +47,7 @@ public:
   void setProjection(const std::string& projection);
   std::string setProjectionProj4(const std::string& projection);
   void setImageDescription(const std::string& imageDescription){m_gds->SetMetadataItem( "TIFFTAG_IMAGEDESCRIPTION",imageDescription.c_str());};
-  CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {getRasterBand(band)->SetNoDataValue(noDataValue);};
+  CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {return getRasterBand(band)->SetNoDataValue(noDataValue);};
   std::string getProjection(void) const;
   std::string getGeoTransform() const;
   void getGeoTransform(double* gt) const;
diff --git a/src/imageclasses/Makefile.am b/src/imageclasses/Makefile.am
index 4af4a99..3f03c8b 100644
--- a/src/imageclasses/Makefile.am
+++ b/src/imageclasses/Makefile.am
@@ -10,7 +10,12 @@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GSL_CFLAGS) $(GDAL_CFLAGS) @AM_CXXFLAGS@
 lib_LTLIBRARIES = libimageClasses.la
 
 # where to install the headers on the system
-libimageClasses_ladir = $(includedir)/imageclasses
+libimageClasses_ladir = $(includedir)/pktools/imageclasses
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libimageClasses_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libimageClasses_la_HEADERS = ImgReaderGdal.h  ImgReaderOgr.h  ImgWriterGdal.h  ImgWriterOgr.h
diff --git a/src/imageclasses/Makefile.in b/src/imageclasses/Makefile.in
index a87e9be..4fae88e 100644
--- a/src/imageclasses/Makefile.in
+++ b/src/imageclasses/Makefile.in
@@ -101,6 +101,9 @@ am__objects_1 =
 am_libimageClasses_la_OBJECTS = $(am__objects_1) ImgReaderGdal.lo \
 	ImgReaderOgr.lo ImgWriterGdal.lo ImgWriterOgr.lo
 libimageClasses_la_OBJECTS = $(am_libimageClasses_la_OBJECTS)
+libimageClasses_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(libimageClasses_la_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -213,6 +216,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -283,7 +287,8 @@ top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libimageClasses.la
 
 # where to install the headers on the system
-libimageClasses_ladir = $(includedir)/imageclasses
+libimageClasses_ladir = $(includedir)/pktools/imageclasses
+libimageClasses_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 libimageClasses_la_HEADERS = ImgReaderGdal.h  ImgReaderOgr.h  ImgWriterGdal.h  ImgWriterOgr.h
@@ -357,7 +362,7 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	done
 libimageClasses.la: $(libimageClasses_la_OBJECTS) $(libimageClasses_la_DEPENDENCIES) $(EXTRA_libimageClasses_la_DEPENDENCIES) 
-	$(CXXLINK) -rpath $(libdir) $(libimageClasses_la_OBJECTS) $(libimageClasses_la_LIBADD) $(LIBS)
+	$(libimageClasses_la_LINK) -rpath $(libdir) $(libimageClasses_la_OBJECTS) $(libimageClasses_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
diff --git a/src/lasclasses/Makefile.am b/src/lasclasses/Makefile.am
index e97db8c..51f906d 100644
--- a/src/lasclasses/Makefile.am
+++ b/src/lasclasses/Makefile.am
@@ -9,7 +9,12 @@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@
 lib_LTLIBRARIES = liblasClasses.la
 
 # where to install the headers on the system
-liblasClasses_ladir = $(includedir)/lasclasses
+liblasClasses_ladir = $(includedir)/pktools/lasclasses
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+liblasClasses_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 liblasClasses_la_HEADERS = FileReaderLas.h
diff --git a/src/lasclasses/Makefile.in b/src/lasclasses/Makefile.in
index e9b9c1f..053edc8 100644
--- a/src/lasclasses/Makefile.in
+++ b/src/lasclasses/Makefile.in
@@ -100,6 +100,9 @@ liblasClasses_la_LIBADD =
 am__objects_1 =
 am_liblasClasses_la_OBJECTS = $(am__objects_1) FileReaderLas.lo
 liblasClasses_la_OBJECTS = $(am_liblasClasses_la_OBJECTS)
+liblasClasses_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(liblasClasses_la_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -212,6 +215,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKTOOLS_SO_VERSION = @PKTOOLS_SO_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -281,7 +285,8 @@ top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = liblasClasses.la
 
 # where to install the headers on the system
-liblasClasses_ladir = $(includedir)/lasclasses
+liblasClasses_ladir = $(includedir)/pktools/lasclasses
+liblasClasses_la_LDFLAGS = -version-info $(PKTOOLS_SO_VERSION) $(AM_LDFLAGS)
 
 # the list of header files that belong to the library (to be installed later)
 liblasClasses_la_HEADERS = FileReaderLas.h
@@ -355,7 +360,7 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	done
 liblasClasses.la: $(liblasClasses_la_OBJECTS) $(liblasClasses_la_DEPENDENCIES) $(EXTRA_liblasClasses_la_DEPENDENCIES) 
-	$(CXXLINK) -rpath $(libdir) $(liblasClasses_la_OBJECTS) $(liblasClasses_la_LIBADD) $(LIBS)
+	$(liblasClasses_la_LINK) -rpath $(libdir) $(liblasClasses_la_OBJECTS) $(liblasClasses_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git



More information about the Pkg-grass-devel mailing list