-
Notifications
You must be signed in to change notification settings - Fork 1
/
Normlinescan_distance.m
111 lines (72 loc) · 2.37 KB
/
Normlinescan_distance.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
% normalize distance
% txt with 2 row (umpos,Grayvalue) get norm with nullpos and onepos
% plus 5% beyond and set to lenght 120 save in csv
clear all
close all
choice='Yes';
index=0;
P=1;
while P>0
index=index+1;
[donorName,donorPathName] = uigetfile('*.txt','txt_gree');%bild
A=importdata([donorPathName,donorName]);
X1=A.data(:,1);
Y1=A.data(:,2);
xnorm=X1;
ynorm=Y1;
prompt = ['What is the original null in um? from lenght max ' num2str(max(X1))];
null = inputdlg(prompt);
null=str2double(null);
prompt = ['What is the original eins in um? from lenght max ' num2str(max(X1))];
eins = inputdlg(prompt);
eins=str2double(eins);
%auf pixel pos
%
% prompt = ['What is zout pixel size um' num2str(max(X1))];
% pixelziye = inputdlg(prompt);
% pixelziye=str2double(pixelziye);
%xnorm = round(X1./X1(2))
einspixel=round(eins./X1(2));
nullpixel=round(null./X1(2));
%00 prozent der l?nge von x
areabeyond=round((einspixel-nullpixel)*0.005)
xnorm=xnorm(nullpixel:einspixel);
ynorm=ynorm(nullpixel:einspixel);
% % normalize
%
%
% ynorm=(ynorm-min(Y1));
% normalize not
xnorm=xnorm-null;
xnorm=xnorm/(eins-null);
ynorm=ynorm;
%normieren der laenge auf 120
newNum = 100; % new number of elements in the "buffed" vector
%x120 and %y120, 10% area on each side makes new length
Xnormahunderzwanzig=interp1(linspace(0,1,numel(xnorm)), xnorm, linspace(0,1,newNum) );
Ynormahunderzwanzig=interp1(linspace(0,1,numel(ynorm)), ynorm, linspace(0,1,newNum) );
[pathstr,name,ext] = fileparts([donorPathName,donorName])
%plot figure)
figure(index)
plot(Xnormahunderzwanzig,Ynormahunderzwanzig,'g')
hold on
figure(index)
hold on
saveas(gcf,[donorPathName name ' frompos_' num2str(null) ' topos_' num2str(eins) '.tif'], 'tif')
%save files
[pathstr,name,ext] = fileparts([donorPathName,donorName])
save([donorPathName name ' frompos_' num2str(null) ' topos_' num2str(eins) '.mat'], 'Xnormahunderzwanzig','Ynormahunderzwanzig','null','eins' )
xlssave(:,1)=Xnormahunderzwanzig
xlssave(:,2)=Ynormahunderzwanzig
xlswrite([donorPathName name ' frompos_' num2str(null) ' topos_' num2str(eins) '.xls'], xlssave,'A2:B122');
% next round?
choice=questdlg('one more?','take or not', 'default');
switch choice
case 'Yes'
P=1;
case 'No'
P=0;
case 'cancel'
P=0;
end
end