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 2e876d29af02f654b58a4bdf52b6918c2895bbf6 Author: Pieter Kempeneers <kempe...@gmail.com> Date: Thu Dec 6 18:04:49 2012 +0100 updates in Changelog --- ChangeLog | 22 ++++++++++++++ src/algorithms/Filter2d.cc | 14 +++++---- src/algorithms/Filter2d.h | 2 +- src/algorithms/Histogram.h | 15 ++++++++++ src/apps/pkclassify_svm.cc | 3 +- src/apps/pkdumpimg.cc | 62 ++++++++++++++++++++++++---------------- src/apps/pkfilter.cc | 5 +++- src/apps/pkgetmask.cc | 4 +-- src/apps/pkinfo.cc | 17 +++++++---- src/apps/pkstat.cc | 8 ++++++ src/apps/pkstatogr.cc | 4 +-- src/imageclasses/ImgReaderGdal.h | 1 + src/imageclasses/ImgWriterGdal.h | 1 + 13 files changed, 116 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28af616..b9914df 100755 --- a/ChangeLog +++ b/ChangeLog @@ -29,3 +29,25 @@ version 2.1 pksieve pkstat pkstatogr +version 2.3 + - New configure options (--enable instead of --with) + --enable-fann (when FANN is installed, needed for pkclassify_nn) + --enable-las (when LIBLAS is installed, needed for pklas2img) + --enable-nlopt (when NLOPT is installed, needed for pksensormodel and pkgetchandelier) + - ImgReaderGdal.cc + in addition to internal setNoData member variable, also support GDALSetNoData + - ImgWriterGdal.cc + in addition to internal setNoData member variable, also support GDALSetNoData + - pkinfo + support of nodata value when calculating histogram and image statistics + options min and max are now set with -min (--min) and -max (--max) + - pkfilter + bug solved in update of progress bar + support of standard deviation + - pkgetmask + options min and max are now set with -min (--min) and -max (--max) + - pkstatogr + options min and max are now set with -min (--min) and -max (--max) + - pkclassify_svm + do not output input file if no input data was defined in verbose mode + diff --git a/src/algorithms/Filter2d.cc b/src/algorithms/Filter2d.cc index 6675c8d..12dd080 100644 --- a/src/algorithms/Filter2d.cc +++ b/src/algorithms/Filter2d.cc @@ -411,6 +411,11 @@ void Filter2d::Filter2d::doit(const ImgReaderGdal& input, ImgWriterGdal& output, assert(dimX); assert(dimY); Histogram hist; + const char* pszMessage; + void* pProgressArg=NULL; + GDALProgressFunc pfnProgress=GDALTermProgress; + double progress=0; + pfnProgress(progress,pszMessage,pProgressArg); for(int iband=0;iband<input.nrOfBand();++iband){ Vector2d<double> inBuffer(dimY,input.nrOfCol()); vector<double> outBuffer((input.nrOfCol()+down-1)/down); @@ -426,11 +431,6 @@ void Filter2d::Filter2d::doit(const ImgReaderGdal& input, ImgWriterGdal& output, } ++indexJ; } - const char* pszMessage; - void* pProgressArg=NULL; - GDALProgressFunc pfnProgress=GDALTermProgress; - double progress=0; - pfnProgress(progress,pszMessage,pProgressArg); for(int y=0;y<input.nrOfRow();++y){ if(y){//inBuffer already initialized for y=0 //erase first line from inBuffer @@ -509,6 +509,10 @@ void Filter2d::Filter2d::doit(const ImgReaderGdal& input, ImgWriterGdal& output, outBuffer[x/down]=hist.var(windowBuffer); break; } + case(STDEV):{ + outBuffer[x/down]=sqrt(hist.var(windowBuffer)); + break; + } case(MEAN):{ outBuffer[x/down]=hist.mean(windowBuffer); break; diff --git a/src/algorithms/Filter2d.h b/src/algorithms/Filter2d.h index 1a4a870..3a76df0 100644 --- a/src/algorithms/Filter2d.h +++ b/src/algorithms/Filter2d.h @@ -42,7 +42,7 @@ using namespace std; // using namespace cimg_library; namespace Filter2d { - enum Type { MEDIAN=0, VAR=1 , MIN=2, MAX=3, SUM=4, MEAN=5, MINMAX=6, DILATE=7, ERODE=8, CLOSE=9, OPEN=10, HOMOG=11, SOBELX=12, SOBELY=13, SOBELXY=14, SOBELYX=-14, SMOOTH=15, DENSITY=16, MAJORITY=17, MIXED=18, SMOOTHNODATA=19, THRESHOLD=20, ISMIN=21, ISMAX=22, HETEROG=23, ORDER=24}; + enum Type { MEDIAN=0, VAR=1 , MIN=2, MAX=3, SUM=4, MEAN=5, MINMAX=6, DILATE=7, ERODE=8, CLOSE=9, OPEN=10, HOMOG=11, SOBELX=12, SOBELY=13, SOBELXY=14, SOBELYX=-14, SMOOTH=15, DENSITY=16, MAJORITY=17, MIXED=18, SMOOTHNODATA=19, THRESHOLD=20, ISMIN=21, ISMAX=22, HETEROG=23, ORDER=24, STDEV=25}; class Filter2d { diff --git a/src/algorithms/Histogram.h b/src/algorithms/Histogram.h index 700b3a3..8d41dff 100644 --- a/src/algorithms/Histogram.h +++ b/src/algorithms/Histogram.h @@ -61,6 +61,8 @@ public: template<class T> double var(const vector<T>& v) const; template<class T> double moment(const vector<T>& v, int n) const; template<class T> double cmoment(const vector<T>& v, int n) const; + template<class T> double skewness(const vector<T>& v) const; + template<class T> double kurtosis(const vector<T>& v) const; template<class T> void meanVar(const vector<T>& v, double& m1, double& v1) const; template<class T1, class T2> void scale2byte(const vector<T1>& input, vector<T2>& output, unsigned char lbound=0, unsigned char ubound=255) const; template<class T> void distribution(const vector<T>& input, typename vector<T>::const_iterator begin, typename vector<T>::const_iterator end, vector<int>& output, int nbin, T &minimum=0.0, T &maximum=0.0, const string &filename=""); @@ -216,6 +218,7 @@ template<class T> double Histogram::moment(const vector<T>& v, int n) const return m/v.size(); } + //central moment template<class T> double Histogram::cmoment(const vector<T>& v, int n) const { assert(v.size()); @@ -228,6 +231,18 @@ template<class T> double Histogram::cmoment(const vector<T>& v, int n) const return m/v.size(); } +template<class T> double Histogram::skewness(const vector<T>& v) const +{ + return cmoment(v,3)/pow(var(v),1.5); +} + +template<class T> double Histogram::kurtosis(const vector<T>& v) const +{ + double m2=cmoment(v,2); + double m4=cmoment(v,4); + return m4/m2/m2-3.0; +} + template<class T> void Histogram::meanVar(const vector<T>& v, double& m1, double& v1) const { typename vector<T>::const_iterator it; diff --git a/src/apps/pkclassify_svm.cc b/src/apps/pkclassify_svm.cc index 25eb555..43508cb 100644 --- a/src/apps/pkclassify_svm.cc +++ b/src/apps/pkclassify_svm.cc @@ -154,7 +154,8 @@ int main(int argc, char *argv[]) } if(verbose_opt[0]>=1){ - std::cout << "image filename: " << input_opt[0] << std::endl; + if(input_opt.size()) + std::cout << "image filename: " << input_opt[0] << std::endl; if(mask_opt.size()) std::cout << "mask filename: " << mask_opt[0] << std::endl; if(training_opt[0].size()){ diff --git a/src/apps/pkdumpimg.cc b/src/apps/pkdumpimg.cc index f2900b2..36e82de 100644 --- a/src/apps/pkdumpimg.cc +++ b/src/apps/pkdumpimg.cc @@ -48,14 +48,15 @@ int main(int argc, char *argv[]) Optionpk<string> oformat_opt("of", "oformat", "Output format (matrix form or list (x,y,z) form. Default is matrix form", "matrix"); Optionpk<int> band_opt("b", "band", "band index to crop (-1: crop all bands)", 0); Optionpk<string> extent_opt("e", "extent", "get boundary from extent from polygons in vector file", ""); - Optionpk<double> ulx_opt("ulx", "ulx", "Upper left x value bounding box (in geocoordinates if georef is true)", 0.0); - Optionpk<double> uly_opt("uly", "uly", "Upper left y value bounding box (in geocoordinates if georef is true)", 0.0); - Optionpk<double> lrx_opt("lrx", "lrx", "Lower left x value bounding box (in geocoordinates if georef is true)", 0.0); - Optionpk<double> lry_opt("lry", "lry", "Lower left y value bounding box (in geocoordinates if georef is true)", 0.0); - Optionpk<double> dx_opt("dx", "dx", "Output resolution in x (in meter) (0.0: keep original resolution)", 0.0); - Optionpk<double> dy_opt("dy", "dy", "Output resolution in y (in meter) (0.0: keep original resolution)", 0.0); + Optionpk<double> ulx_opt("ulx", "ulx", "Upper left x value bounding box (in geocoordinates if georef is true)",0.0); + Optionpk<double> uly_opt("uly", "uly", "Upper left y value bounding box (in geocoordinates if georef is true)",0.0); + Optionpk<double> lrx_opt("lrx", "lrx", "Lower left x value bounding box (in geocoordinates if georef is true)",0.0); + Optionpk<double> lry_opt("lry", "lry", "Lower left y value bounding box (in geocoordinates if georef is true)",0.0); + Optionpk<double> dx_opt("dx", "dx", "Output resolution in x (in meter) (0.0: keep original resolution)",0.0); + Optionpk<double> dy_opt("dy", "dy", "Output resolution in y (in meter) (0.0: keep original resolution)",0.0); Optionpk<string> resample_opt("r", "resampling-method", "Resampling method (near: nearest neighbour, bilinear: bi-linear interpolation).", "near"); Optionpk<short> flag_opt("f", "flag", "Flag value to put in image if out of bounds.", 0); + Optionpk<double> nodata_opt("nodata", "nodata", "set no data value(s) for calculations (flags in input image)"); Optionpk<short> verbose_opt("v", "verbose", "verbose (Default: 0)", 0); version_opt.retrieveOption(argc,argv); @@ -86,6 +87,7 @@ int main(int argc, char *argv[]) dy_opt.retrieveOption(argc,argv); resample_opt.retrieveOption(argc,argv); flag_opt.retrieveOption(argc,argv); + nodata_opt.retrieveOption(argc,argv); verbose_opt.retrieveOption(argc,argv); if(help_opt[0]){ @@ -117,6 +119,9 @@ int main(int argc, char *argv[]) GDALDataType theType; ImgReaderGdal imgReader(input_opt[0]); + for(int inodata=0;inodata<nodata_opt.size();++inodata) + imgReader.pushNoDataValue(nodata_opt[inodata]); + ImgWriterGdal virtualWriter;//only for coordinate conversion (no output file defined) int nband=imgReader.nrOfBand(); @@ -145,18 +150,27 @@ int main(int argc, char *argv[]) cerr << "Error: could not get extent from " << extent_opt[0] << endl; exit(1); } - if(ulx_opt[0]<cropulx) + if(!iextent){ cropulx=ulx_opt[0]; - if(uly_opt[0]>cropuly) cropuly=uly_opt[0]; - if(lry_opt[0]<croplry) croplry=lry_opt[0]; - if(lrx_opt[0]>croplrx) croplrx=lrx_opt[0]; + } + else{ + if(ulx_opt[0]<cropulx) + cropulx=ulx_opt[0]; + if(uly_opt[0]>cropuly) + cropuly=uly_opt[0]; + if(lry_opt[0]<croplry) + croplry=lry_opt[0]; + if(lrx_opt[0]>croplrx) + croplrx=lrx_opt[0]; + } extentReader.close(); } } - double uli,ulj,lri,lrj;//image coordinates + double uli,ulj,lri,lrj;//image coordinates + double magicX=1,magicY=1; if(ulx_opt[0]>=lrx_opt[0]){//default bounding box: no cropping uli=0; lri=imgReader.nrOfCol()-1; @@ -165,14 +179,17 @@ int main(int argc, char *argv[]) ncropcol=imgReader.nrOfCol(); ncroprow=imgReader.nrOfRow(); imgReader.getBoundingBox(cropulx,cropuly,croplrx,croplry); - imgReader.geo2image(cropulx,cropuly,uli,ulj); - imgReader.geo2image(croplrx,croplry,lri,lrj); + imgReader.geo2image(cropulx+(magicX-1.0)*imgReader.getDeltaX(),cropuly-(magicY-1.0)*imgReader.getDeltaY(),uli,ulj); + imgReader.geo2image(croplrx+(magicX-2.0)*imgReader.getDeltaX(),croplry-(magicY-2.0)*imgReader.getDeltaY(),lri,lrj); + ncropcol=ceil((croplrx-cropulx)/dx); + ncroprow=ceil((cropuly-croplry)/dy); ncropcol=ceil((croplrx-cropulx)/dx); ncroprow=ceil((cropuly-croplry)/dy); } else{ - imgReader.geo2image(cropulx,cropuly,uli,ulj); - imgReader.geo2image(croplrx,croplry,lri,lrj); + imgReader.geo2image(cropulx+(magicX-1.0)*imgReader.getDeltaX(),cropuly-(magicY-1.0)*imgReader.getDeltaY(),uli,ulj); + imgReader.geo2image(croplrx+(magicX-2.0)*imgReader.getDeltaX(),croplry-(magicY-2.0)*imgReader.getDeltaY(),lri,lrj); + ncropcol=ceil((croplrx-cropulx)/dx); ncroprow=ceil((cropuly-croplry)/dy); uli=floor(uli); @@ -201,8 +218,6 @@ int main(int argc, char *argv[]) cout << "selected upper left row of input image: " << ulj << endl; cout << "selected lower right column in input image: " << lri << endl; cout << "selected lower right row in input image: " << lrj << endl; - cout << "new number of cols: " << ncropcol << endl; - cout << "new number of rows: " << ncroprow << endl; } imgWriter.setGeoTransform(cropulx,cropuly,dx,dy,0,0); @@ -275,12 +290,11 @@ int main(int argc, char *argv[]) else outputStream << (readCol-0.5-lowerCol)*readBuffer[upperCol-startCol]+(1-readCol+0.5+lowerCol)*readBuffer[lowerCol-startCol] << " "; } - else{ - if(output_opt[0].empty()) - std::cout << x << " " << y << " " << (readCol-0.5-lowerCol)*readBuffer[upperCol-startCol]+(1-readCol+0.5+lowerCol)*readBuffer[lowerCol-startCol] << " " << endl; - else - outputStream << x << " " << y << " " << (readCol-0.5-lowerCol)*readBuffer[upperCol-startCol]+(1-readCol+0.5+lowerCol)*readBuffer[lowerCol-startCol] << " " << endl; - + else if(!imgReader.isNoData(readBuffer[upperCol-startCol])&&!imgReader.isNoData(readBuffer[lowerCol-startCol])){ + if(output_opt[0].empty()) + std::cout << x << " " << y << " " << (readCol-0.5-lowerCol)*readBuffer[upperCol-startCol]+(1-readCol+0.5+lowerCol)*readBuffer[lowerCol-startCol] << " " << endl; + else + outputStream << x << " " << y << " " << (readCol-0.5-lowerCol)*readBuffer[upperCol-startCol]+(1-readCol+0.5+lowerCol)*readBuffer[lowerCol-startCol] << " " << endl; } break; default: @@ -296,7 +310,7 @@ int main(int argc, char *argv[]) else outputStream << readBuffer[readCol] << " "; } - else{ + else if(!imgReader.isNoData(readBuffer[readCol])){ if(output_opt[0].empty()) std::cout << x << " " << y << " " << readBuffer[readCol] << std::endl; else diff --git a/src/apps/pkfilter.cc b/src/apps/pkfilter.cc index 88f86c3..f77fb21 100644 --- a/src/apps/pkfilter.cc +++ b/src/apps/pkfilter.cc @@ -54,7 +54,7 @@ int main(int argc,char **argv) { Optionpk<std::string> output_opt("o", "output", "Output image file", ""); Optionpk<bool> disc_opt("c", "circular", "circular disc kernel for dilation and erosion", false); Optionpk<double> angle_opt("a", "angle", "angle used for directional filtering in dilation."); - Optionpk<int> function_opt("f", "filter", "filter function (0: median, 1: variance, 2: min, 3: max, 4: sum, 5: mean, 6: minmax, 7: dilation, 8: erosion, 9: closing, 10: opening, 11: spatially homogeneous (central pixel must be identical to all other pixels within window), 12: SobelX edge detection in X, 13: SobelY edge detection in Y, 14: SobelXY, -14: SobelYX, 15: smooth, 16: density, 17: majority voting (only for classes), 18: forest aggregation (mixed), 19: smooth no data (mask) val [...] + Optionpk<int> function_opt("f", "filter", "filter function (0: median, 1: variance, 2: min, 3: max, 4: sum, 5: mean, 6: minmax, 7: dilation, 8: erosion, 9: closing, 10: opening, 11: spatially homogeneous (central pixel must be identical to all other pixels within window), 12: SobelX edge detection in X, 13: SobelY edge detection in Y, 14: SobelXY, -14: SobelYX, 15: smooth, 16: density, 17: majority voting (only for classes), 18: forest aggregation (mixed), 19: smooth no data (mask) val [...] Optionpk<int> dimX_opt("dx", "dx", "filter kernel size in x, must be odd", 3); Optionpk<int> dimY_opt("dy", "dy", "filter kernel size in y, must be odd", 3); Optionpk<int> dimZ_opt("dz", "dz", "filter kernel size in z (band or spectral dimension), must be odd (example: 3).. Set dz>0 if 1-D filter must be used in band domain"); @@ -220,6 +220,9 @@ int main(int argc,char **argv) { case(Filter2d::VAR): filter2d.doit(input,output,Filter2d::VAR,dimX_opt[0],dimY_opt[0],down_opt[0],disc_opt[0]); break; + case(Filter2d::STDEV): + filter2d.doit(input,output,Filter2d::STDEV,dimX_opt[0],dimY_opt[0],down_opt[0],disc_opt[0]); + break; case(Filter2d::MIN): filter2d.doit(input,output,Filter2d::MIN,dimX_opt[0],dimY_opt[0],down_opt[0],disc_opt[0]); break; diff --git a/src/apps/pkgetmask.cc b/src/apps/pkgetmask.cc index fcc61c6..03e7aaf 100644 --- a/src/apps/pkgetmask.cc +++ b/src/apps/pkgetmask.cc @@ -41,8 +41,8 @@ int main(int argc,char **argv) { Optionpk<bool> todo_opt("\0","todo","",false); Optionpk<string> input_opt("i", "input", "Input image file", ""); Optionpk<short> band_opt("b", "band", "band(s) used for mask", 0); - Optionpk<double> min_opt("m", "min", "Values smaller than min threshold(s) are masked as invalid. Use one threshold for each band", 0); - Optionpk<double> max_opt("M", "max", "Values greater than max threshold(s) are masked as invalid. Use one threshold for each band", 0); + Optionpk<double> min_opt("min", "min", "Values smaller than min threshold(s) are masked as invalid. Use one threshold for each band", 0); + Optionpk<double> max_opt("max", "max", "Values greater than max threshold(s) are masked as invalid. Use one threshold for each band", 0); Optionpk<string> operator_opt("p", "operator", "Operator: [AND,OR].", "OR"); Optionpk<unsigned short> valid_opt("t", "tvalue", "value(s) for valid pixels: between min and max", 1); Optionpk<unsigned short> invalid_opt("f", "fvalue", "value(s) for invalid pixels: not between min and max", 0); diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc index a014816..95ecaf1 100644 --- a/src/apps/pkinfo.cc +++ b/src/apps/pkinfo.cc @@ -53,8 +53,8 @@ int main(int argc, char *argv[]) Optionpk<bool> dy_opt("dy", "dy", "get resolution in y (in m)", false); Optionpk<bool> minmax_opt("mm", "minmax", "Show min and max value of the image ", false); Optionpk<bool> stat_opt("stat", "stat", "Show statistics (min,max, mean and stdDev of the image ", false); - Optionpk<double> min_opt("m", "min", "Show min value of the image (or set minimum for histogram)", 0); - Optionpk<double> max_opt("M", "max", "Show max value of the image (or set maximum for histogram)", 0); + Optionpk<double> min_opt("min", "min", "Show min value of the image (or set minimum for histogram)", 0); + Optionpk<double> max_opt("max", "max", "Show max value of the image (or set maximum for histogram)", 0); Optionpk<bool> relative_opt("rel", "rel", "Calculate relative histogram in percentage", false); Optionpk<bool> projection_opt("p", "projection", "Show projection of the image ", false); Optionpk<bool> geo_opt("geo", "geo", "get geotransform: ", false); @@ -150,9 +150,11 @@ 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<nodata_opt.size();++inodata) + for(int inodata=0;inodata<nodata_opt.size();++inodata){ + if(!inodata) + imgReader.GDALSetNoDataValue(nodata_opt[0],band_opt[0]);//only single no data can be set in GDALRasterBand (used for ComputeStatistics) imgReader.pushNoDataValue(nodata_opt[inodata]); - + } if(filename_opt[0]) std::cout << " --input " << input_opt[ifile] << " "; if(centre_opt[0]){ @@ -297,8 +299,11 @@ int main(int argc, char *argv[]) ++ninvalid; else if(lineBuffer[icol]==maxValue) ++output[nbin-1]; - else if(static_cast<double>(lineBuffer[icol]-minValue)/(maxValue-minValue)*nbin>=nbin) - ++output[nbin-1]; + // else if(static_cast<double>(lineBuffer[icol]-minValue)/(maxValue-minValue)*nbin>=nbin){ + // //test + // std::cout << "..." << lineBuffer[icol] << std::endl; + // ++output[nbin-1]; + // } else ++output[static_cast<int>(static_cast<double>(lineBuffer[icol]-minValue)/(maxValue-minValue)*nbin)]; } diff --git a/src/apps/pkstat.cc b/src/apps/pkstat.cc index ffc2f25..d24f3e6 100644 --- a/src/apps/pkstat.cc +++ b/src/apps/pkstat.cc @@ -51,6 +51,8 @@ int main(int argc, char *argv[]) Optionpk<bool> mean_opt("m","mean","calculate mean value",false); Optionpk<bool> median_opt("med","median","calculate median",false); Optionpk<bool> var_opt("var","var","calculate variance",false); + Optionpk<bool> skewness_opt("skew","skewness","calculate skewness",false); + Optionpk<bool> kurtosis_opt("kurt","kurtosis","calculate kurtosis",false); Optionpk<bool> stdev_opt("stdev","stdev","calculate standard deviation",false); Optionpk<bool> sum_opt("s","sum","calculate sum of column",false); Optionpk<bool> minmax_opt("mm","minmax","calculate minimum and maximum value",false); @@ -78,6 +80,8 @@ int main(int argc, char *argv[]) median_opt.retrieveOption(argc,argv); var_opt.retrieveOption(argc,argv); stdev_opt.retrieveOption(argc,argv); + skewness_opt.retrieveOption(argc,argv); + kurtosis_opt.retrieveOption(argc,argv); sum_opt.retrieveOption(argc,argv); minmax_opt.retrieveOption(argc,argv); min_opt.retrieveOption(argc,argv); @@ -203,6 +207,10 @@ int main(int argc, char *argv[]) cout << "variance value column " << col_opt[icol] << ": " << hist.var(dataVector[icol]) << endl; if(stdev_opt[0]) cout << "standard deviation column " << col_opt[icol] << ": " << sqrt(hist.var(dataVector[icol])) << endl; + if(skewness_opt[0]) + cout << "skewness value column " << col_opt[icol] << ": " << hist.skewness(dataVector[icol]) << endl; + if(kurtosis_opt[0]) + cout << "kurtosis value column " << col_opt[icol] << ": " << hist.kurtosis(dataVector[icol]) << endl; if(sum_opt[0]){ cout << setprecision(2); cout << fixed << "sum column " << col_opt[icol] << ": " << (hist.sum(dataVector[icol])) << endl; diff --git a/src/apps/pkstatogr.cc b/src/apps/pkstatogr.cc index 0d48a77..51ff299 100644 --- a/src/apps/pkstatogr.cc +++ b/src/apps/pkstatogr.cc @@ -44,8 +44,8 @@ int main(int argc, char *argv[]) Optionpk<string> input_opt("i", "input", "Input shape file", ""); Optionpk<string> fieldname_opt("n", "fname", "fields on which to calculate statistics", ""); Optionpk<short> nbin_opt("nbin", "nbin", "number of bins", 0); - Optionpk<bool> min_opt("m","min","calculate minimum value",false); - Optionpk<bool> max_opt("M","max","calculate maximum value",false); + Optionpk<bool> min_opt("min","min","calculate minimum value",false); + Optionpk<bool> max_opt("max","max","calculate maximum value",false); 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); diff --git a/src/imageclasses/ImgReaderGdal.h b/src/imageclasses/ImgReaderGdal.h index 5ced726..5a9f3b7 100644 --- a/src/imageclasses/ImgReaderGdal.h +++ b/src/imageclasses/ImgReaderGdal.h @@ -61,6 +61,7 @@ public: 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); + CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {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; diff --git a/src/imageclasses/ImgWriterGdal.h b/src/imageclasses/ImgWriterGdal.h index fad06bc..d8c7d90 100644 --- a/src/imageclasses/ImgWriterGdal.h +++ b/src/imageclasses/ImgWriterGdal.h @@ -50,6 +50,7 @@ public: void setProjection(const string& projection); string setProjectionProj4(const string& projection); void setImageDescription(const string& imageDescription){m_gds->SetMetadataItem( "TIFFTAG_IMAGEDESCRIPTION",imageDescription.c_str());}; + CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {getRasterBand(band)->SetNoDataValue(noDataValue);}; string getProjection(void) const; string getGeoTransform() const; void getGeoTransform(double& ulx, double& uly, double& deltaX, double& deltaY, double& rot1, double& rot2) const; -- 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