-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersistencelength_full.m
91 lines (72 loc) · 2.16 KB
/
Persistencelength_full.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
%% script to transform data and calculate the Persistance Length of filaments from Amira 6.0.1
% Data needed: Export from Amira 6.0.1 - attribute file in .xml
% open in Excel and save as .xlsx
% Felix JB Baeuerlein
% Baeuerlein et al. Cell 2017
%% script body
% Load data
clear all
clc
[filename, pathname] = uigetfile({'*.xlsx'},'File Selector');
disp(['----- Processing Tomogram: ' filename ' -----'])
% Transform dataformat from Amira 6.0.1 in 5.4.5 format
tic
disp('1) Starting Amira Data transformation ...')
Amira_lineset_conversion
toc
disp('Data transformed and saved!')
% copy files into folder
f = regexp(filename, '.xlsx', 'split');
fname = f{1,1};
mkdir(fname);
movefile(filename,fname);
movefile(([filename '_Points.csv']),fname);
cd(fname);
disp('Data moved to Folder!')
% calculate motion direction
tic
disp('2) Starting PCA for general motion direction ...')
filaments=Points;
fil_motion_direction_m2;
% movefile([filename '_with_motion_direction.csv'],fname);
toc
disp('Motion Direction calculated!')
% interpolate equidistant points on each filament
tic
disp('3) Starting equidistant interpolation ...')
searchdist = 50;
fil_analysis_nofigs_m2;
toc
disp('Equidistant interpolation done!')
% calculate the persistance length
tic
disp('4) Starting Persistence Length calculation ...')
Persistencelength_160712
toc
disp('Persistance Length calculated!')
% save final coordinate file
save([fname '_final_Points.mat'],'filaments');
disp('Final points list saved!')
% check Algorithm funcionality
check=filaments(2:end,1)-filaments(1:end-1,1)-1;
disp(['Number of lost points: -- ' num2str(sum(check)) ' -- from total ' num2str(max(filaments(:,1))) ' points.'])
% visualizes the first 50 filaments
% figure(99);
% for ff=0:50
% ind = find(Points(:,5) == ff);
% plot3(Points(ind,2), Points(ind,3), Points(ind,4), '*-');
% axis equal
% view([-35.5 14]);
% box('on');
% grid('on');
% xlabel('x');
% ylabel('y');
% zlabel('z');
% % legend(ind, '# Filament')
% pause(0.2)
% hold on
% ind = find(filaments(:,5) == ff);
% plot3(filaments(ind,2), filaments(ind,3), filaments(ind,4), 'or');
% pause(0.5)
% hold off
% end