function  [vysledek] = filtr_GPMADR(nefilt,delka,metoda)

h = waitbar(0,'Pracuji...');
tic
for z=1:delka % počet snimku
    Im=cell2mat(nefilt(z));
    [x,y]=size(Im); 
    lambda=0.12;%(0d 0 po 0.25)
    K=0.12;
    pom=zeros(x,y);
    for t=1:250
        for i=2:x-1 
            for j=2:y-1
                if Im(i,j)==0;%kontrola jestli není okolí mimo vějíř UZV dat
                elseif Im(i-1,j)==0
                    pom(i,j)=Im(i,j);
                elseif Im(i-1,j)==0
                    pom(i,j)=Im(i,j);
                elseif Im(i-1,j)==0
                    pom(i,j)=Im(i,j);                    
                elseif Im(i-1,j)==0
                    pom(i,j)=Im(i,j);
                else %pokud je okoli snimku UZV data
                    
                    rN=sqrt(abs(Im(i-1,j)-Im(i,j))); %vypocet  RDF r5
                    rW=sqrt(abs(Im(i,j-1)-Im(i,j)));
                    rE=sqrt(abs(Im(i,j+1)-Im(i,j)));
                    rS=sqrt(abs(Im(i+1,j)-Im(i,j)));
                    
                    
                    psiN=sign((Im(i-1,j)-Im(i,j)))*rN;
                    psiW=sign((Im(i,j-1)-Im(i,j)))*rW;
                    psiE=sign((Im(i,j+1)-Im(i,j)))*rE;
                    psiS=sign((Im(i+1,j)-Im(i,j)))*rS;
                    
                    zN=exp(1)^(-((psiN)/K)^2); %vypocet z pomoci funkce g1
                    zW=exp(1)^(-((psiW)/K)^2);
                    zE=exp(1)^(-((psiE)/K)^2);
                    zS=exp(1)^(-((psiS)/K)^2);
                    
                    pom(i,j)=Im(i,j)+lambda*(zN*psiN+zW*psiW+zE*psiE+zS*psiS); %vypocet hodnoty intenzity pixelu
                end
            end
        end
        Im=pom;
    end
    timestr = [metoda, remain_time(z,delka)];
    waitbar(z/delka,h,timestr);%nastaveni waitbaru
    vysledek(z)={(Im)};
end
close(h)




