[pktools] 327/375: corrected 1d filter of dimz>1 in pkfilter.cc in plane

Bas Couwenberg sebastic at xs4all.nl
Wed Dec 3 21:54:26 UTC 2014


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 aec126e7a6799d97e99ec0f6e1f326644ecdca5b
Author: Pieter Kempeneers <kempenep at gmail.com>
Date:   Sat Sep 27 00:53:41 2014 -0700

    corrected 1d filter of dimz>1 in pkfilter.cc in plane
---
 src/algorithms/Filter.cc | 5 ++++-
 src/algorithms/Filter.h  | 8 ++++----
 src/apps/pkfilter.cc     | 2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/algorithms/Filter.cc b/src/algorithms/Filter.cc
index fd4124a..6330117 100644
--- a/src/algorithms/Filter.cc
+++ b/src/algorithms/Filter.cc
@@ -403,8 +403,11 @@ void filter::Filter::filter(const ImgReaderGdal& input, ImgWriterGdal& output, c
     for(int x=0;x<input.nrOfCol();++x){
       pixelInput=lineInput.selectCol(x);
       filter(pixelInput,pixelOutput,method,dim);
-      for(int iband=0;iband<pixelOutput.size();++iband)
+      for(int iband=0;iband<pixelOutput.size();++iband){
         lineOutput[iband][x]=pixelOutput[iband];
+	if(pixelInput[iband]!=0)
+	  assert(pixelOutput[iband]!=0);
+      }
     }
     for(int iband=0;iband<input.nrOfBand();++iband){
       try{
diff --git a/src/algorithms/Filter.h b/src/algorithms/Filter.h
index 53be2b7..70955a1 100644
--- a/src/algorithms/Filter.h
+++ b/src/algorithms/Filter.h
@@ -489,7 +489,7 @@ template<class T> void Filter::filter(const std::vector<T>& input, std::vector<T
         statBuffer.push_back(input[i+t]);
       }
     }
-    assert(statBuffer.size()==dim);
+    /* assert(statBuffer.size()==dim); */
     /* if((i-offset)%down){ */
     /*   statBuffer.clear(); */
     /*   continue; */
@@ -535,7 +535,7 @@ template<class T> void Filter::filter(const std::vector<T>& input, std::vector<T
       else
         statBuffer.push_back(input[i-dim/2+t]);
     }
-    assert(statBuffer.size()==dim);
+    /* assert(statBuffer.size()==dim); */
     switch(getFilterType(method)){
     case(filter::median):
       output[i]=stat.median(statBuffer);
@@ -658,7 +658,7 @@ template<class T> void Filter::morphology(const std::vector<T>& input, std::vect
         statBuffer.push_back(input[i+t]);
       }
     }
-    assert(statBuffer.size()==dim);
+    /* assert(statBuffer.size()==dim); */
     if((i-offset)%down){
       statBuffer.clear();
       continue;
@@ -698,7 +698,7 @@ template<class T> void Filter::morphology(const std::vector<T>& input, std::vect
       else
         statBuffer.push_back(input[i-dim/2+t]);
     }
-    assert(statBuffer.size()==dim);
+    /* assert(statBuffer.size()==dim); */
     if((i-offset)%down){
       statBuffer.clear();
       continue;
diff --git a/src/apps/pkfilter.cc b/src/apps/pkfilter.cc
index 2d704e1..4018896 100644
--- a/src/apps/pkfilter.cc
+++ b/src/apps/pkfilter.cc
@@ -709,7 +709,7 @@ int main(int argc,char **argv) {
 	std::cout << "classes set" << std::endl;
     default:
       if(dimZ_opt.size()){
-	if(dimZ_opt.size()==1)
+	if(dimZ_opt[0]==1)
 	  filter1d.stat(input,output,method_opt[0],down_opt[0]);
 	else{
 	  assert(down_opt[0]==1);//not implemented yet...

-- 
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