-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSANPostStarDistAPP.m
50 lines (30 loc) · 1.14 KB
/
SANPostStarDistAPP.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
function mdata=SANPostStarDistAPP(cellStack,FrameLabels,prepData)
% This function uses the simpletrack algorithm to create the fake tracks
nFrames=size(cellStack,1);
StatsgCampfromSD=cell(nFrames,1);
for i=1:nFrames
G=cellStack{i};
S=regionprops3(FrameLabels{i},G,'Volume','MeanIntensity','VoxelValues');
tf=isnan(S.MeanIntensity);
S(tf,:)=[];
S.NormIntensity=normalize(S.MeanIntensity);
StatsgCampfromSD{i}=S;
end
for i=1:nFrames
T=StatsgCampfromSD{i};
TT=table(prepData{i,1},'VariableNames',{'Centroid'});
n=size(T,1);
TTT=table(repmat(i,n,1), 'VariableNames',{'FrameID'});
T=[T TT TTT]; %if using simpletracker
StatsgCampfromSD{i}=T;
end
%%% using simptracker %%%%%%%%%%%%%%%%%%%%%
[~, adjtracks]=simpletracker(prepData(:,1),'MaxLinkingDistance',3,'MaxGapClosing',nFrames,'Method','NearestNeighbor');
StatsCat=vertcat(StatsgCampfromSD{:});
Centori=table(vertcat(prepData{:,2}),'VariableNames',{'OrigCentroid'});
StatsCat=[StatsCat Centori];
nf=cellfun(@numel,adjtracks);
tf=nf<nFrames/3;
adjtracks(tf)=[];
Data=cellfun(@(adj) StatsCat(adj,:),adjtracks,'UniformOutput',false);
mdata=mergeTracks(Data);