function [ the_peaks ] = max_peaks( peak_list, vicinity_threshold )
sorted_peaks=sortrows(peak_list,3,'desc');
the_peaks=zeros(size(sorted_peaks));
peak_idx=1;
while(~isempty(sorted_peaks))
the_peaks(peak_idx,:)=sorted_peaks(1,:);
peak_idx=peak_idx+1;
D=pdist2(sorted_peaks(1:end,1:2),sorted_peaks(1,1:2));
np=D<vicinity_threshold;
sorted_peaks(np,:)=[];
end
the_peaks(~any(the_peaks,2),:)=[];
end
test_peaks=[1,1,0.5; 5,5,0.9; 5,1,0.6; 300,300,0.2; 303,303,0.7; 1,100,0.9; 1,104,0.95; 1,250,.7; 1,200,.75];
mP=max_peaks(test_peaks,10)
scatter (test_peaks(:,1),test_peaks(:,2),'o');
hold on
scatter (mP(:,1),mP(:,2),'*');