3
function [validx,validy,resnormx]=sortvalidpoints(fitxy)
5
% This function will free the good peaks from fitxy, captured by
6
% peak_labelling, and send them back as validx and validy. The loops you
7
% will find are not absolutely necessary and reduce the speed of this
8
% function tremendously and will be changed probably in a future version if
11
sizefitxy=size(fitxy);
12
looppoints=sizefitxy(1,1);
13
loopimages=sizefitxy(1,2)/12;
14
validpoints=fitxy(:,sizefitxy(1,2)-11);
15
validnumber(:,:)=validpoints(1:(max(find(validpoints))));
20
if counter<length(validnumber)+1
21
if fitxy(j,i*12-11)==validnumber(counter)
22
resnormx(counter,i)=fitxy(j,i*12);
23
cropwidthx(counter,i)=fitxy(j,i*12-2);
30
resnormxtemp(:,:)=resnormx(1:length(validnumber),:);
31
resnormx=resnormxtemp;
33
normresxtest=mean((resnormx./cropwidthx)')';
34
number=1:1:looppoints;
35
figure, plot(1:length(validnumber),normresxtest,'.');
40
for i=1:length(validnumber)
41
if abs(normresxtest(i,1))<10
42
validnumbertest(counter,1)=validnumber(i,1);
50
if counter<length(validnumbertest)+1
51
if fitxy(j,i*12-11)==validnumbertest(counter)
52
validx(counter,i)=fitxy(j,i*12-9);
53
validy(counter,i)=fitxy(j,i*12-5);
54
resnormx(counter,i)=fitxy(j,i*12);
60
pointnumber=size(validx);
61
validxtemp(:,:)=validx(1:pointnumber(1,1),:);
64
validytemp(:,:)=validy(1:pointnumber(1,1),:);
67
resnormxtemp(:,:)=resnormx(1:pointnumber(1,1),:);
69
resnormx=resnormxtemp;