-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotSkelLengthDist.m
41 lines (36 loc) · 1.31 KB
/
plotSkelLengthDist.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
function [ ] = plotSkelLengthDist(skelData,pixelsize,minSkelLength,maxSkelLength,filename)
skelLengthFig = figure;
skelLengths = sum(sqrt(sum((diff(skelData,1,2)*pixelsize).^2)));
histogram(skelLengths,'Normalization','pdf','EdgeColor','none')
hold on
plot(minSkelLength*[1 1],[0 0.02],'r--')
plot(maxSkelLength*[1 1],[0 0.02],'r--')
xlabel('skeleton length (\mu m)'), ylabel('P')
figName = strrep(filename,'_',' ');
title(figName,'Fontweight','normal')
% plot filtered skeletons on top
axpos = get(gca,'Position');
rejected = skelLengths<minSkelLength;
newpos = axpos;
newpos(3) = 0.33*axpos(3); % third width
if any(rejected)
overlayRejected = axes('Position',newpos,'Visible','off');
plotSkeletons(skelData(:,:,rejected),min(9,nnz(rejected)),'r');
end
accepted = skelLengths>minSkelLength;
if any(accepted)
newpos(1) = axpos(1) + 0.67*axpos(3); % start at 2/3 width
overlayAccepted = axes('Position',newpos,'Visible','off');
plotSkeletons(skelData(:,:,skelLengths>minSkelLength),min(9,nnz(accepted)),'k');
else
1;
end
% figure export
if ~isempty(filename)
figFileName = ['figures/diagnostics/' strrep(strrep(figName,' ','_'),'s.hdf5','') 'lengths.eps'];
exportfig(skelLengthFig,figFileName,'Color','rgb')
system(['epstopdf ' figFileName]);
system(['rm ' figFileName]);
end
close(skelLengthFig)
end