-
Notifications
You must be signed in to change notification settings - Fork 0
/
AngleEvaluationClass.m
63 lines (56 loc) · 2.33 KB
/
AngleEvaluationClass.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
classdef AngleEvaluationClass < SpeedEvaluation2Class
properties
end
methods
%constructor
function S=AngleEvaluationClass(varargin)
S@SpeedEvaluation2Class(varargin{:})
end
function Angles=anglesFromTrack(S)
Window = 5;
Angles=cell(length(S.Molecule),1);
for n = 1:length(S.Molecule)
% Distances = Molecule(n).PathData(2:end,1:2) - Molecule(n).PathData(1:end-1,1:2);
Distances = movmean(S.Molecule(n).Results(2:end,3:4) - S.Molecule(n).Results(1:end-1,3:4), Window);
Angles{n} = atan2(-Distances(:, 2), Distances(:,1));
end
Angles=cell2mat(Angles);
end
function S=speedFigure(S,parent,m,n,P,p1,p2)
%plot the first image of the stack
scale=n/2;
subplot0=subplot(m,n,P,'Parent',parent);
S.makeImg(subplot0);
ImageTitle=strrep(S.Config.StackName,'_',' ');
title(ImageTitle,'FontSize',16/scale,'FontName','Arial');
[success,S]=S.evaluateSpeeds;
if success
subplot1 = subplot(m,n,p1,'Parent',parent,'FontSize',10/scale,'FontName','Arial');
%a histogram of the average speeds of the filaments
S.plotSpeedHistogram(subplot1,scale)
% Create speeds vs time subplot
subplot2 = subplot(m,n,p2,'Parent',parent,'FontSize',10/scale,'FontName','Arial');
box(subplot2,'on');
Angles = S.anglesFromTrack();
NBins = length(Angles) / 20;
if NBins > 36
NBins = 36;
end
polarhistogram(Angles,NBins)
set(gca,'FontSize',10/scale)
S.addResultAnnotation(parent,subplot1,scale);
else
subplot1=subplot(m,n,[p1 p2],'Parent',parent,'FontSize',10/scale,'FontName','Arial');
set(gca, 'Visible','off')
boxPos=S.calculateBoxPos(subplot1);
% Create textbox
annotation(parent,'textbox',...
boxPos,...
'String',{'No microtubule tips could be tracked.','Check stack and configuration for errors.'},...
'FontSize',12/scale,'FontName','Arial','Color','k',...
'LineStyle','none','Margin',0,'VerticalAlignment','middle',...
'FitBoxToText','off');
end
end
end
end