function [out, poc] = remove_hot_pixels(data,lev)
velikost=size(data);
mat_out=isoutlier(data,'mean');
soucet=zeros(velikost(1),velikost(2));

for i=1:velikost(3)
     soucet(:,:)=soucet(:,:)+mat_out(:,:,i);
end
 
[s,r]=find(soucet>lev);
 poc=length(s);
for k=1:velikost(3)
  for j=1:poc
         X=data(:,:,k);
         data(s(j),r(j),k)=mean(X(:)); 

  end

end
 out=data;
end

