This is an automated email from the git hooks/post-receive script. sebastic-guest pushed a commit to branch upstream-master in repository pktools.
commit 59e07e824a17c04047e259eb7a5c51fe365c06b3 Author: Pieter Kempeneers <kempe...@gmail.com> Date: Fri Nov 30 17:58:24 2012 +0100 support of nodata in pkinfo when calculating histogram --- src/algorithms/Histogram.h | 8 +++-- src/algorithms/Makefile.am | 6 ++-- src/algorithms/Makefile.in | 25 +++++++++++--- src/apps/Makefile.am | 9 +++++- src/apps/Makefile.in | 68 +++++++++++++++++++++++++++++++-------- src/apps/pkcrop.cc | 2 +- src/apps/pkegcs.cc | 2 +- src/apps/pkinfo.cc | 14 ++++---- src/apps/pkndvi.cc | 2 +- src/apps/pkstatogr.cc | 63 ++++++++++++++++++++++++------------ src/imageclasses/ImgReaderGdal.cc | 4 +-- src/imageclasses/ImgReaderGdal.h | 5 +-- src/imageclasses/ImgWriterOgr.cc | 1 - 13 files changed, 149 insertions(+), 60 deletions(-) diff --git a/src/algorithms/Histogram.h b/src/algorithms/Histogram.h index 4b37e66..700b3a3 100644 --- a/src/algorithms/Histogram.h +++ b/src/algorithms/Histogram.h @@ -260,7 +260,11 @@ template<class T> void Histogram::distribution (const vector<T>& input, typenam // minimum=*(min(input,begin,end)); // if(!maximum) // maximum=*(max(input,begin,end)); - assert(maximum>minimum); + if(maximum<=minimum){ + ostringstream s; + s<<"Error: could not calculate distribution (min>=max) in " << filename; + throw(s.str()); + } assert(nbin>1); assert(input.size()); if(output.size()!=nbin){ @@ -279,7 +283,7 @@ template<class T> void Histogram::distribution (const vector<T>& input, typenam outputfile.open(filename.c_str()); if(!outputfile){ ostringstream s; - s<<"error opening distribution file , " << filename; + s<<"Error opening distribution file , " << filename; throw(s.str()); } for(int bin=0;bin<nbin;++bin) diff --git a/src/algorithms/Makefile.am b/src/algorithms/Makefile.am index acd551d..f6d547d 100644 --- a/src/algorithms/Makefile.am +++ b/src/algorithms/Makefile.am @@ -1,4 +1,4 @@ -AM_LDFLAGS = $(GDAL_LDFLAGS) @AM_LDFLAGS@ +AM_LDFLAGS = $(GSL_LIBS) $(GDAL_LDFLAGS) @AM_LDFLAGS@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@ ############################################################################### @@ -12,8 +12,8 @@ noinst_LIBRARIES = libalgorithms.a libalgorithms_adir = $(includedir)/algorithms # the list of header files that belong to the library (to be installed later) -libalgorithms_a_HEADERS = Egcs.h Filter2d.h Filter.h Histogram.h ConfusionMatrix.h myfann_cpp.h +libalgorithms_a_HEADERS = Egcs.h Filter2d.h Filter.h Histogram.h ConfusionMatrix.h myfann_cpp.h svm.h SensorModel.h # the sources to add to the library and to add to the source distribution -libalgorithms_a_SOURCES = $(libalgorithms_a_HEADERS) Egcs.cc Filter2d.cc Filter.cc Histogram.cc ConfusionMatrix.cc +libalgorithms_a_SOURCES = $(libalgorithms_a_HEADERS) Egcs.cc Filter2d.cc Filter.cc Histogram.cc ConfusionMatrix.cc svm.cpp ############################################################################### diff --git a/src/algorithms/Makefile.in b/src/algorithms/Makefile.in index cb28be7..50c609b 100644 --- a/src/algorithms/Makefile.in +++ b/src/algorithms/Makefile.in @@ -53,7 +53,7 @@ libalgorithms_a_LIBADD = am__objects_1 = am_libalgorithms_a_OBJECTS = $(am__objects_1) Egcs.$(OBJEXT) \ Filter2d.$(OBJEXT) Filter.$(OBJEXT) Histogram.$(OBJEXT) \ - ConfusionMatrix.$(OBJEXT) + ConfusionMatrix.$(OBJEXT) svm.$(OBJEXT) libalgorithms_a_OBJECTS = $(am_libalgorithms_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -99,7 +99,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@ -AM_LDFLAGS = $(GDAL_LDFLAGS) @AM_LDFLAGS@ +AM_LDFLAGS = $(GSL_LIBS) $(GDAL_LDFLAGS) @AM_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -218,14 +218,14 @@ noinst_LIBRARIES = libalgorithms.a libalgorithms_adir = $(includedir)/algorithms # the list of header files that belong to the library (to be installed later) -libalgorithms_a_HEADERS = Egcs.h Filter2d.h Filter.h Histogram.h ConfusionMatrix.h myfann_cpp.h +libalgorithms_a_HEADERS = Egcs.h Filter2d.h Filter.h Histogram.h ConfusionMatrix.h myfann_cpp.h svm.h SensorModel.h # the sources to add to the library and to add to the source distribution -libalgorithms_a_SOURCES = $(libalgorithms_a_HEADERS) Egcs.cc Filter2d.cc Filter.cc Histogram.cc ConfusionMatrix.cc +libalgorithms_a_SOURCES = $(libalgorithms_a_HEADERS) Egcs.cc Filter2d.cc Filter.cc Histogram.cc ConfusionMatrix.cc svm.cpp all: all-am .SUFFIXES: -.SUFFIXES: .cc .o .obj +.SUFFIXES: .cc .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -275,6 +275,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Filter2d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Histogram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/svm.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -289,6 +290,20 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` install-libalgorithms_aHEADERS: $(libalgorithms_a_HEADERS) @$(NORMAL_INSTALL) test -z "$(libalgorithms_adir)" || $(MKDIR_P) "$(DESTDIR)$(libalgorithms_adir)" diff --git a/src/apps/Makefile.am b/src/apps/Makefile.am index d8b1238..e7d473f 100644 --- a/src/apps/Makefile.am +++ b/src/apps/Makefile.am @@ -6,7 +6,7 @@ LDADD = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.a $(top_bui ############################################################################### # the program to build (the names of the final binaries) -bin_PROGRAMS = pkinfo pkcrop pkreclass pkgetmask pksetmask pkcreatect pkdumpimg pkdumpogr pksieve pkstat pkstatogr pkegcs pkextract pkfillnodata pkfilter pkdsm2shadow pkmosaic pkndvi pkpolygonize pkascii2img pkdiff pkclassify_svm +bin_PROGRAMS = pkinfo pkcrop pkreclass pkgetmask pksetmask pkcreatect pkdumpimg pkdumpogr pksieve pkstat pkstatogr pkegcs pkextract pkfillnodata pkfilter pkdsm2shadow pkmosaic pkndvi pkpolygonize pkascii2img pkascii2ogr pkdiff pkclassify_svm pkgeom if USE_FANN bin_PROGRAMS += pkclassify_nn pkclassify_nn_SOURCES = $(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.h pkclassify_nn.cc @@ -19,6 +19,11 @@ bin_PROGRAMS += pklas2img pklas2img_SOURCES = pklas2img.cc pklas2img_LDADD = -L$(top_builddir)/src/fileclasses -lfileClasses -llas $(AM_LDFLAGS) endif +if USE_NLOPT +bin_PROGRAMS += pksensormodel +pksensormodel_SOURCES = $(top_srcdir)/src/algorithms/SensorModel.h pksensormodel.h pksensormodel.cc +pksensormodel_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt -lm -lgslwrap +endif # list of sources for the binaries pkinfo_SOURCES = pkinfo.cc pkcrop_SOURCES = pkcrop.cc @@ -43,6 +48,8 @@ pkmosaic_SOURCES = pkmosaic.cc pkndvi_SOURCES = pkndvi.cc pkpolygonize_SOURCES = pkpolygonize.cc pkascii2img_SOURCES = pkascii2img.cc +pkascii2ogr_SOURCES = pkascii2ogr.cc pkdiff_SOURCES = pkdiff.cc pkclassify_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkclassify_svm.cc +pkgeom_SOURCES = pkgeom.cc ############################################################################### diff --git a/src/apps/Makefile.in b/src/apps/Makefile.in index f83de84..74adf28 100644 --- a/src/apps/Makefile.in +++ b/src/apps/Makefile.in @@ -38,10 +38,13 @@ bin_PROGRAMS = pkinfo$(EXEEXT) pkcrop$(EXEEXT) pkreclass$(EXEEXT) \ pkstat$(EXEEXT) pkstatogr$(EXEEXT) pkegcs$(EXEEXT) \ pkextract$(EXEEXT) pkfillnodata$(EXEEXT) pkfilter$(EXEEXT) \ pkdsm2shadow$(EXEEXT) pkmosaic$(EXEEXT) pkndvi$(EXEEXT) \ - pkpolygonize$(EXEEXT) pkascii2img$(EXEEXT) pkdiff$(EXEEXT) \ - pkclassify_svm$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) + pkpolygonize$(EXEEXT) pkascii2img$(EXEEXT) \ + pkascii2ogr$(EXEEXT) pkdiff$(EXEEXT) pkclassify_svm$(EXEEXT) \ + pkgeom$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) @USE_FANN_TRUE@am__append_1 = pkclassify_nn @USE_LAS_TRUE@am__append_2 = pklas2img +@USE_NLOPT_TRUE@am__append_3 = pksensormodel subdir = src/apps DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -55,6 +58,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @USE_FANN_TRUE@am__EXEEXT_1 = pkclassify_nn$(EXEEXT) @USE_LAS_TRUE@am__EXEEXT_2 = pklas2img$(EXEEXT) +@USE_NLOPT_TRUE@am__EXEEXT_3 = pksensormodel$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_pkascii2img_OBJECTS = pkascii2img.$(OBJEXT) @@ -64,6 +68,12 @@ am__DEPENDENCIES_1 = pkascii2img_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/src/algorithms/libalgorithms.a \ $(top_builddir)/src/imageclasses/libimageClasses.a +am_pkascii2ogr_OBJECTS = pkascii2ogr.$(OBJEXT) +pkascii2ogr_OBJECTS = $(am_pkascii2ogr_OBJECTS) +pkascii2ogr_LDADD = $(LDADD) +pkascii2ogr_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/algorithms/libalgorithms.a \ + $(top_builddir)/src/imageclasses/libimageClasses.a am__pkclassify_nn_SOURCES_DIST = \ $(top_srcdir)/src/algorithms/myfann_cpp.h pkclassify_nn.h \ pkclassify_nn.cc @@ -140,6 +150,12 @@ pkfilter_LDADD = $(LDADD) pkfilter_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/src/algorithms/libalgorithms.a \ $(top_builddir)/src/imageclasses/libimageClasses.a +am_pkgeom_OBJECTS = pkgeom.$(OBJEXT) +pkgeom_OBJECTS = $(am_pkgeom_OBJECTS) +pkgeom_LDADD = $(LDADD) +pkgeom_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/algorithms/libalgorithms.a \ + $(top_builddir)/src/imageclasses/libimageClasses.a am_pkgetmask_OBJECTS = pkgetmask.$(OBJEXT) pkgetmask_OBJECTS = $(am_pkgetmask_OBJECTS) pkgetmask_LDADD = $(LDADD) @@ -180,6 +196,13 @@ pkreclass_LDADD = $(LDADD) pkreclass_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/src/algorithms/libalgorithms.a \ $(top_builddir)/src/imageclasses/libimageClasses.a +am__pksensormodel_SOURCES_DIST = \ + $(top_srcdir)/src/algorithms/SensorModel.h pksensormodel.h \ + pksensormodel.cc +@USE_NLOPT_TRUE@am_pksensormodel_OBJECTS = pksensormodel.$(OBJEXT) +pksensormodel_OBJECTS = $(am_pksensormodel_OBJECTS) +@USE_NLOPT_TRUE@pksensormodel_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@USE_NLOPT_TRUE@ $(am__DEPENDENCIES_2) am_pksetmask_OBJECTS = pksetmask.$(OBJEXT) pksetmask_OBJECTS = $(am_pksetmask_OBJECTS) pksetmask_LDADD = $(LDADD) @@ -214,27 +237,28 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(pkascii2img_SOURCES) $(pkclassify_nn_SOURCES) \ - $(pkclassify_svm_SOURCES) $(pkcreatect_SOURCES) \ - $(pkcrop_SOURCES) $(pkdiff_SOURCES) $(pkdsm2shadow_SOURCES) \ - $(pkdumpimg_SOURCES) $(pkdumpogr_SOURCES) $(pkegcs_SOURCES) \ - $(pkextract_SOURCES) $(pkfillnodata_SOURCES) \ - $(pkfilter_SOURCES) $(pkgetmask_SOURCES) $(pkinfo_SOURCES) \ - $(pklas2img_SOURCES) $(pkmosaic_SOURCES) $(pkndvi_SOURCES) \ - $(pkpolygonize_SOURCES) $(pkreclass_SOURCES) \ +SOURCES = $(pkascii2img_SOURCES) $(pkascii2ogr_SOURCES) \ + $(pkclassify_nn_SOURCES) $(pkclassify_svm_SOURCES) \ + $(pkcreatect_SOURCES) $(pkcrop_SOURCES) $(pkdiff_SOURCES) \ + $(pkdsm2shadow_SOURCES) $(pkdumpimg_SOURCES) \ + $(pkdumpogr_SOURCES) $(pkegcs_SOURCES) $(pkextract_SOURCES) \ + $(pkfillnodata_SOURCES) $(pkfilter_SOURCES) $(pkgeom_SOURCES) \ + $(pkgetmask_SOURCES) $(pkinfo_SOURCES) $(pklas2img_SOURCES) \ + $(pkmosaic_SOURCES) $(pkndvi_SOURCES) $(pkpolygonize_SOURCES) \ + $(pkreclass_SOURCES) $(pksensormodel_SOURCES) \ $(pksetmask_SOURCES) $(pksieve_SOURCES) $(pkstat_SOURCES) \ $(pkstatogr_SOURCES) -DIST_SOURCES = $(pkascii2img_SOURCES) \ +DIST_SOURCES = $(pkascii2img_SOURCES) $(pkascii2ogr_SOURCES) \ $(am__pkclassify_nn_SOURCES_DIST) $(pkclassify_svm_SOURCES) \ $(pkcreatect_SOURCES) $(pkcrop_SOURCES) $(pkdiff_SOURCES) \ $(pkdsm2shadow_SOURCES) $(pkdumpimg_SOURCES) \ $(pkdumpogr_SOURCES) $(pkegcs_SOURCES) $(pkextract_SOURCES) \ - $(pkfillnodata_SOURCES) $(pkfilter_SOURCES) \ + $(pkfillnodata_SOURCES) $(pkfilter_SOURCES) $(pkgeom_SOURCES) \ $(pkgetmask_SOURCES) $(pkinfo_SOURCES) \ $(am__pklas2img_SOURCES_DIST) $(pkmosaic_SOURCES) \ $(pkndvi_SOURCES) $(pkpolygonize_SOURCES) $(pkreclass_SOURCES) \ - $(pksetmask_SOURCES) $(pksieve_SOURCES) $(pkstat_SOURCES) \ - $(pkstatogr_SOURCES) + $(am__pksensormodel_SOURCES_DIST) $(pksetmask_SOURCES) \ + $(pksieve_SOURCES) $(pkstat_SOURCES) $(pkstatogr_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -354,6 +378,8 @@ LDADD = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.a $(top_bui @USE_FANN_TRUE@pkclassify_nn_LDADD = $(FANN_LIBS) $(FANN_CFLAGS) $(AM_LDFLAGS) @USE_LAS_TRUE@pklas2img_SOURCES = pklas2img.cc @USE_LAS_TRUE@pklas2img_LDADD = -L$(top_builddir)/src/fileclasses -lfileClasses -llas $(AM_LDFLAGS) +@USE_NLOPT_TRUE@pksensormodel_SOURCES = $(top_srcdir)/src/algorithms/SensorModel.h pksensormodel.h pksensormodel.cc +@USE_NLOPT_TRUE@pksensormodel_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt -lm -lgslwrap # list of sources for the binaries pkinfo_SOURCES = pkinfo.cc pkcrop_SOURCES = pkcrop.cc @@ -378,8 +404,10 @@ pkmosaic_SOURCES = pkmosaic.cc pkndvi_SOURCES = pkndvi.cc pkpolygonize_SOURCES = pkpolygonize.cc pkascii2img_SOURCES = pkascii2img.cc +pkascii2ogr_SOURCES = pkascii2ogr.cc pkdiff_SOURCES = pkdiff.cc pkclassify_svm_SOURCES = $(top_srcdir)/src/algorithms/svm.h $(top_srcdir)/src/algorithms/svm.cpp pkclassify_svm.cc +pkgeom_SOURCES = pkgeom.cc all: all-am .SUFFIXES: @@ -454,6 +482,9 @@ clean-binPROGRAMS: pkascii2img$(EXEEXT): $(pkascii2img_OBJECTS) $(pkascii2img_DEPENDENCIES) @rm -f pkascii2img$(EXEEXT) $(CXXLINK) $(pkascii2img_OBJECTS) $(pkascii2img_LDADD) $(LIBS) +pkascii2ogr$(EXEEXT): $(pkascii2ogr_OBJECTS) $(pkascii2ogr_DEPENDENCIES) + @rm -f pkascii2ogr$(EXEEXT) + $(CXXLINK) $(pkascii2ogr_OBJECTS) $(pkascii2ogr_LDADD) $(LIBS) pkclassify_nn$(EXEEXT): $(pkclassify_nn_OBJECTS) $(pkclassify_nn_DEPENDENCIES) @rm -f pkclassify_nn$(EXEEXT) $(pkclassify_nn_LINK) $(pkclassify_nn_OBJECTS) $(pkclassify_nn_LDADD) $(LIBS) @@ -490,6 +521,9 @@ pkfillnodata$(EXEEXT): $(pkfillnodata_OBJECTS) $(pkfillnodata_DEPENDENCIES) pkfilter$(EXEEXT): $(pkfilter_OBJECTS) $(pkfilter_DEPENDENCIES) @rm -f pkfilter$(EXEEXT) $(CXXLINK) $(pkfilter_OBJECTS) $(pkfilter_LDADD) $(LIBS) +pkgeom$(EXEEXT): $(pkgeom_OBJECTS) $(pkgeom_DEPENDENCIES) + @rm -f pkgeom$(EXEEXT) + $(CXXLINK) $(pkgeom_OBJECTS) $(pkgeom_LDADD) $(LIBS) pkgetmask$(EXEEXT): $(pkgetmask_OBJECTS) $(pkgetmask_DEPENDENCIES) @rm -f pkgetmask$(EXEEXT) $(CXXLINK) $(pkgetmask_OBJECTS) $(pkgetmask_LDADD) $(LIBS) @@ -511,6 +545,9 @@ pkpolygonize$(EXEEXT): $(pkpolygonize_OBJECTS) $(pkpolygonize_DEPENDENCIES) pkreclass$(EXEEXT): $(pkreclass_OBJECTS) $(pkreclass_DEPENDENCIES) @rm -f pkreclass$(EXEEXT) $(CXXLINK) $(pkreclass_OBJECTS) $(pkreclass_LDADD) $(LIBS) +pksensormodel$(EXEEXT): $(pksensormodel_OBJECTS) $(pksensormodel_DEPENDENCIES) + @rm -f pksensormodel$(EXEEXT) + $(CXXLINK) $(pksensormodel_OBJECTS) $(pksensormodel_LDADD) $(LIBS) pksetmask$(EXEEXT): $(pksetmask_OBJECTS) $(pksetmask_DEPENDENCIES) @rm -f pksetmask$(EXEEXT) $(CXXLINK) $(pksetmask_OBJECTS) $(pksetmask_LDADD) $(LIBS) @@ -531,6 +568,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkascii2img.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkascii2ogr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkclassify_nn-pkclassify_nn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkclassify_svm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkcreatect.Po@am__quote@ @@ -543,6 +581,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkextract.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkfillnodata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkfilter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkgeom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkgetmask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pklas2img.Po@am__quote@ @@ -550,6 +589,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkndvi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkpolygonize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkreclass.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pksensormodel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pksetmask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pksieve.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkstat.Po@am__quote@ diff --git a/src/apps/pkcrop.cc b/src/apps/pkcrop.cc index 562c179..f17dc28 100644 --- a/src/apps/pkcrop.cc +++ b/src/apps/pkcrop.cc @@ -483,7 +483,7 @@ int main(int argc, char *argv[]) } imgReader.close(); } - if(extent_opt[0]!=""){ + if(extent_opt[0]!=""&&mask_opt[0]){ extentReader.close(); } imgWriter.close(); diff --git a/src/apps/pkegcs.cc b/src/apps/pkegcs.cc index f8f28e6..60357f3 100644 --- a/src/apps/pkegcs.cc +++ b/src/apps/pkegcs.cc @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) if(refpixel_opt[0]){ assert(band_opt[0]<imgReader.nrOfBand()); for(int inodata=0;inodata<maskValue_opt.size();++inodata) - imgReader.pushNoDataValue(maskValue_opt[inodata],band_opt[0]); + imgReader.pushNoDataValue(maskValue_opt[inodata]); // if(verbose_opt[0]){ // vector<double> noData; // imgReader.getNoDataValues(noData,band_opt[0]); diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc index d3fa74e..a014816 100644 --- a/src/apps/pkinfo.cc +++ b/src/apps/pkinfo.cc @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) Optionpk<bool> type_opt("ot", "otype", "Return data type", false); Optionpk<bool> description_opt("d", "description", "Return image description", false); Optionpk<bool> metadata_opt("meta", "meta", "Show meta data ", false); - Optionpk<double> maskValue_opt("mask", "mask", "mask value(s) for no data to calculate reference pixel in image",0); + Optionpk<double> nodata_opt("nodata", "nodata", "set no data value(s) for calculations (flags in input image)"); version_opt.retrieveOption(argc,argv); license_opt.retrieveOption(argc,argv); @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) type_opt.retrieveOption(argc,argv); description_opt.retrieveOption(argc,argv); metadata_opt.retrieveOption(argc,argv); - maskValue_opt.retrieveOption(argc,argv); + nodata_opt.retrieveOption(argc,argv); if(help_opt[0]){ std::cout << "usage: pkinfo -i imagefile [OPTIONS]" << std::endl; @@ -150,8 +150,8 @@ int main(int argc, char *argv[]) ImgReaderGdal imgReader; for(int ifile=0;ifile<input_opt.size();++ifile){ imgReader.open(input_opt[ifile]); - for(int inodata=0;inodata<maskValue_opt.size();++inodata) - imgReader.pushNoDataValue(maskValue_opt[inodata],band_opt[0]); + for(int inodata=0;inodata<nodata_opt.size();++inodata) + imgReader.pushNoDataValue(nodata_opt[inodata]); if(filename_opt[0]) std::cout << " --input " << input_opt[ifile] << " "; @@ -289,7 +289,9 @@ int main(int argc, char *argv[]) for(int irow=0;irow<imgReader.nrOfRow();++irow){ imgReader.readData(lineBuffer,GDT_Float64,irow,band_opt[0]); for(int icol=0;icol<imgReader.nrOfCol();++icol){ - if(lineBuffer[icol]>maxValue) + if(imgReader.isNoData(lineBuffer[icol])) + ++ninvalid; + else if(lineBuffer[icol]>maxValue) ++ninvalid; else if(lineBuffer[icol]<minValue) ++ninvalid; @@ -422,6 +424,6 @@ int main(int argc, char *argv[]) std::cout << "no intersect" << std::endl; } // std::cout << "bounding box mosaic (ULX ULY LRX LRY): " << minULX << " " << maxULY << " " << maxLRX << " " << minLRY << std::endl; - if(!read_opt[0]) + if(!read_opt[0]&&!hist_opt[0]) std::cout << std::endl; } diff --git a/src/apps/pkndvi.cc b/src/apps/pkndvi.cc index db40e7a..d792b2f 100644 --- a/src/apps/pkndvi.cc +++ b/src/apps/pkndvi.cc @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) denom=(lineInput[1][icol]-offset_opt[0])/scale_opt[0]-(lineInput[0][icol]-offset_opt[0])/scale_opt[0]; nom=(lineInput[1][icol]-offset_opt[0])/scale_opt[0]+(lineInput[0][icol]-offset_opt[0])/scale_opt[0]; } - if(rule_opt[0]=="ndvi2"){//normalized difference with different wavelengths used in denom and nom + else if(rule_opt[0]=="ndvi2"){//normalized difference with different wavelengths used in denom and nom //Example of indices addressed by ndvi2 //Structure Intensive Pigment index (SIPI Penuelas 1995): b0=R_450, b1=R_800, b2=R_650, b=R_800 //Vogelmann index 2 (Vog2 Vogelmann1993): b0=R_747, b1=R_735, b2=R_715, b3=R_726 diff --git a/src/apps/pkstatogr.cc b/src/apps/pkstatogr.cc index 04862e1..0d48a77 100644 --- a/src/apps/pkstatogr.cc +++ b/src/apps/pkstatogr.cc @@ -49,6 +49,7 @@ int main(int argc, char *argv[]) Optionpk<bool> mean_opt("mean","mean","calculate mean value",false); Optionpk<bool> median_opt("median","median","calculate median value",false); Optionpk<bool> stdev_opt("stdev","stdev","calculate standard deviation",false); + Optionpk<bool> size_opt("s","size","sample size (number of points)",false); Optionpk<short> verbose_opt("v", "verbose", "verbose mode if > 0", 0); version_opt.retrieveOption(argc,argv); @@ -64,6 +65,7 @@ int main(int argc, char *argv[]) mean_opt.retrieveOption(argc,argv); median_opt.retrieveOption(argc,argv); stdev_opt.retrieveOption(argc,argv); + size_opt.retrieveOption(argc,argv); verbose_opt.retrieveOption(argc,argv); if(version_opt[0]||todo_opt[0]){ @@ -72,7 +74,7 @@ int main(int argc, char *argv[]) exit(0); } if(license_opt[0]){ - cout << Optionpk<bool>::getGPLv3License() << endl; + std::cout << Optionpk<bool>::getGPLv3License() << std::endl; exit(0); } if(help_opt[0]){ @@ -85,7 +87,7 @@ int main(int argc, char *argv[]) imgReader.open(input_opt[0]); } catch(string errorstring){ - cerr << errorstring << endl; + std::cerr << errorstring << std::endl; } ImgReaderOgr inputReader(input_opt[0]); @@ -95,33 +97,52 @@ int main(int argc, char *argv[]) for(int ifield=0;ifield<fieldname_opt.size();++ifield){ if(verbose_opt[0]) - cout << "field: " << ifield << endl; + std::cout << "field: " << ifield << std::endl; theData.clear(); inputReader.readData(theData,OFTReal,fieldname_opt[ifield],0,verbose_opt[0]); vector<int> binData; double minimum=0; double maximum=0; int nbin=(nbin_opt[0]>1)? nbin_opt[0] : 2; - hist.distribution(theData,theData.begin(),theData.end(),binData,nbin,minimum,maximum); - double theMean=0; - double theVar=0; - hist.meanVar(theData,theMean,theVar); std::cout << " --fname " << fieldname_opt[ifield]; - if(mean_opt[0]) - std::cout << " --mean " << theMean; - if(stdev_opt[0]) - std::cout << " --stdev " << sqrt(theVar); - if(min_opt[0]) - cout << " -m " << minimum; - if(max_opt[0]) - cout << " -M " << maximum; - if(median_opt[0]) - std::cout << " -median " << hist.median(theData); - std::cout << std::endl; - if(nbin_opt[0]>1){ + try{ + hist.distribution(theData,theData.begin(),theData.end(),binData,nbin,minimum,maximum); + double theMean=0; + double theVar=0; + hist.meanVar(theData,theMean,theVar); + if(mean_opt[0]) + std::cout << " --mean " << theMean; + if(stdev_opt[0]) + std::cout << " --stdev " << sqrt(theVar); + if(min_opt[0]) + cout << " -m " << minimum; + if(max_opt[0]) + cout << " -M " << maximum; + if(median_opt[0]) + std::cout << " -median " << hist.median(theData); + if(size_opt[0]) + std::cout << " -size " << theData.size(); std::cout << std::endl; - for(int bin=0;bin<nbin;++bin) - cout << (maximum-minimum)*bin/(nbin-1)+minimum << " " << static_cast<double>(binData[bin])/theData.size() << endl; + if(nbin_opt[0]>1){ + for(int bin=0;bin<nbin;++bin) + std::cout << (maximum-minimum)*bin/(nbin-1)+minimum << " " << static_cast<double>(binData[bin])/theData.size() << std::endl; + } + } + catch(string theError){ + if(mean_opt[0]) + std::cout << " --mean " << theData.back(); + if(stdev_opt[0]) + std::cout << " --stdev " << "0"; + if(min_opt[0]) + cout << " -m " << theData.back(); + if(max_opt[0]) + cout << " -M " << theData.back(); + if(median_opt[0]) + std::cout << " -median " << theData.back(); + if(size_opt[0]) + std::cout << " -size " << theData.size(); + std::cout << std::endl; + std::cerr << "Warning: all identical values in data" << std::endl; } } imgReader.close(); diff --git a/src/imageclasses/ImgReaderGdal.cc b/src/imageclasses/ImgReaderGdal.cc index 0456e74..7760d7e 100644 --- a/src/imageclasses/ImgReaderGdal.cc +++ b/src/imageclasses/ImgReaderGdal.cc @@ -418,7 +418,7 @@ void ImgReaderGdal::getRange(vector<short>& range, int band) const sort(range.begin(),range.end()); } -int ImgReaderGdal::getNoDataValues(vector<double>& noDataValues, int band) const +int ImgReaderGdal::getNoDataValues(vector<double>& noDataValues) const { if(m_noDataValues.size()){ noDataValues=m_noDataValues; @@ -428,7 +428,7 @@ int ImgReaderGdal::getNoDataValues(vector<double>& noDataValues, int band) const return 0; } -int ImgReaderGdal::pushNoDataValue(double noDataValue, int band) +int ImgReaderGdal::pushNoDataValue(double noDataValue) { if(find(m_noDataValues.begin(),m_noDataValues.end(),noDataValue)==m_noDataValues.end()) m_noDataValues.push_back(noDataValue); diff --git a/src/imageclasses/ImgReaderGdal.h b/src/imageclasses/ImgReaderGdal.h index 7580b4a..5ced726 100644 --- a/src/imageclasses/ImgReaderGdal.h +++ b/src/imageclasses/ImgReaderGdal.h @@ -58,8 +58,9 @@ public: double getLrx() const {return (m_isGeoRef)? m_ulx+nrOfCol()*m_delta_x : nrOfCol()-1;}; double getLry() const {return (m_isGeoRef)? m_uly-nrOfRow()*m_delta_y : 0;}; // bool getMagicPixel(double& magicX, double& magicY) const {magicX=m_magic_x;magicY=m_magic_y;}; - int getNoDataValues(vector<double>& noDataValues, int band=0) const; - int pushNoDataValue(double noDataValue,int band=0); + int getNoDataValues(vector<double>& noDataValues) const; + bool isNoData(double value) const{return find(m_noDataValues.begin(),m_noDataValues.end(),value)!=m_noDataValues.end();}; + int pushNoDataValue(double 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; diff --git a/src/imageclasses/ImgWriterOgr.cc b/src/imageclasses/ImgWriterOgr.cc index 3cda0a2..0ed887d 100644 --- a/src/imageclasses/ImgWriterOgr.cc +++ b/src/imageclasses/ImgWriterOgr.cc @@ -400,7 +400,6 @@ int ImgWriterOgr::ascii2shape(const string& filename, const string &layername, c createLayer(layername, theProjection, eGType, papszOptions); //create attribute fields that should appear on the layer. Fields must be added to the layer before any features are written. To create a field we initialize an OGRField object with the information about the field. In the case of Shapefiles, the field width and precision is significant in the creation of the output .dbf file, so we set it specifically, though generally the defaults are OK int ncol=fieldName.size(); - assert(fieldName.size()==fieldType.size()); assert(colX>=0); assert(colY>=0); assert(colX<ncol+2); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel