/
mainPPTprocessFunc.m
62 lines (49 loc) · 2.05 KB
/
mainPPTprocessFunc.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
% Script to pull data from polyParticleTracker
% Brian Williams
% 2012.02.21
function [nParticles, pData, xPos, yPos, radius] = mainPPTprocessFunc(data)
%%%%%%%%%%%% File management
%data=dataPPT; % Rename PPT output to variable name 'data'
%%%%%%%%%%%% Declare Constants
fps = 200; % framerate
dt = 1/fps; % timestep
%dt = .02;
%fps = 1/dt
dx = 162E-9; % Pixel size, set to unity if PPT outputs dimensioned positions
dy = dx;
%%%%%%%%%%%% Number of particles tracked
temp=size(data.tr);
nParticles = temp(2); % This is the number of particles
%%%%%%%%%%%% Put data into cell arrays based on data type. Index of cell
%%%%%%%%%%%% array indicated particle number
for ii = 1:nParticles
pData{ii} = data.tr{ii};
xPos{ii} = pData{ii}(:,1); %%% x coordinate of particle in pixels
yPos{ii} = pData{ii}(:,2); %%% y coordinate of particle in pixels
% frameNum{ii} = pData{ii}(:,3); %%% frame number
% particleNum{ii} = pData{ii}(:,4); %%% particle number (set by PPT)
radius{ii} = pData{ii}(:,5); %%% radius of particle in pixels
% jRogers{ii} = pData{ii}(:,6); %%% See PPT literature
%eccentricity{ii} = pData{ii}(:,7); %%% eccentricity. 1 for circle
% rotation{ii} = pData{ii}(:,8); %%% Angle of particle for ellipsoid
% brightness{ii} = pData{ii}(:,9);
% skewness{ii} = pData{ii}(:,10);
end
%%%%%%%%%%%% Scale xPosition by pixel size:
for ii = 1:nParticles
xPos{ii} = xPos{ii}*dx; %%% x position in meters
yPos{ii} = yPos{ii}*dy; %%% y position in meters
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Calculate other parameters of interest
%for ii = 1:nParticles
% zPos{ii} = 1.*radius{ii}; %%% Kind of. Not really though. Doesn't distinguish between positive/negative, and is not the proper scaling function
%%% Put MSD conversion here
% [MSD{ii},tau{ii}] = MSDcalc(xPos{ii},yPos{ii},dt);
%end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Generate plots
%for ii = 1:nParticles
% figure
% plot3(xPos{ii},yPos{ii},zPos{ii})
%end