Skip to content
Snippets Groups Projects
Commit 4986f9d3 authored by ac's avatar ac
Browse files

quantize all positive images to full 8 bits

parent af35cfaf
Branches
No related tags found
No related merge requests found
......@@ -9,9 +9,9 @@ for i = 1 : length(imf)
end
end
if ~exist("clipRange",'var')
% clipRange = [2.5,97.5];
clipRange = [2.5,97.5];
% % clipRange = [0.5,99.5];
clipRange = [0,100];
% clipRange = [0,100];
end
for c = 1:size(imf{1},4)
......@@ -37,6 +37,8 @@ for i = 1:length(imf)
imq_neg = SSF.quantize8(imn,clip_neg(c,:));
if all(0==imq_pos)
imf{i}(:,:,:,c) = imq_neg;
elseif all(0==imq_neg)
imf{i}(:,:,:,c) = imq_pos;
else
% [0,127] for imq_neg, [128,255] imq_pos
imq_pos = (0.5 .* imq_pos) + uint8(128 .* (imq_pos>0));
......
tic
ROOT = '/g/leverjs/Schuman_OCT/OCT/qualified';
ROOT = '/g/leverjs/Schuman_OCT/OCT/qualifiedYes';
% ROOT = '/g/leverjs/Schuman_OCT/OCT/qualified';
% PID = 'P10010';
......@@ -10,7 +10,7 @@ tblMeta = struct2table(vertcat(mx{:}));
tblMeta.PID = str2double(tblMeta.PID);
tblMeta.folder = {flist.folder}';
tblMeta.filename = {flist.name}';
% database query
tblMeta = tblMeta(contains(tblMeta.scanType,'Optic'),:);
% tblMeta = tblMeta(contains(tblMeta.scanType,'Macula'),:);
% tblMeta = tblMeta(contains(tblMeta.eye,'OD'),:);
......@@ -23,11 +23,12 @@ p = ljsStartParallel(96);
radii = {[8]} % dark tubes
% radii = {[0.5,8,8],[5,5,5],[8]}; % plate,blob, dark tube
% radii = {[5,5,5],[8]}; % plate,blob, dark tube
radii
imf = RSF.getImf(tblMeta,radii);
imf = RSF.quantizeImX(imf,[0,100]);
% imf = RSF.quantizeImX(imf,[0,100]);
imf = RSF.quantizeImX(imf,[2.5,97.5]);
d = [];
parfor i = 1:length(imf)
dj = [];
......@@ -38,58 +39,25 @@ parfor i = 1:length(imf)
end
A = Cluster.Regularize(d);
[~,Y] = Cluster.SpectralCluster(A,3);
tblMeta.Y = Y;
tS = tblMeta(strcmp(tblMeta.eye,'OD'),:);
tD = tblMeta(strcmp(tblMeta.eye,'OS'),:);
t1 = tS;
t2 = tD;
% tO = tblMeta(contains(tblMeta.scanType,'Optic'),:);
% tM = tblMeta(contains(tblMeta.scanType,'Macular'),:);
% t3 = tO;
% t4 = tM;
% idxOD = find(strcmp(tblMeta.eye,'OD'));
% idxOS = find(strcmp(tblMeta.eye,'OS'));
% clf;hold on
% if size(Y,2) > 2
% plot3(Y(idxOD,1),Y(idxOD,2),Y(idxOD,3),'r*')
% plot3(Y(idxOS,1),Y(idxOS,2),Y(idxOS,3),'og')
% zlabel('NCD3')
% else
% plot(Y(idxOD,1),Y(idxOD,2),'r*')
% plot(Y(idxOS,1),Y(idxOS,2),'og')
%
% end
% legend({'OD','OS'})
% xlabel('NCD1')
% ylabel('NCD2')
idxOD = find(strcmp(tblMeta.eye,'OD'));
idxOS = find(strcmp(tblMeta.eye,'OS'));
[~,Y] = Cluster.SpectralCluster(A,2);
toc
figure(1)
% compute time for scatter plot 3rd axis
tblMeta.dx = datetime(tblMeta.date,'InputFormat','MM-dd-yyyy');
tblMeta.dx = calmonths(between(min(tblMeta.dx),tblMeta.dx));
% draw scatter plot
figure(1)
clf;hold on
plot3(Y(idxOD,1),Y(idxOD,2),tblMeta.dx(idxOD),'r*')
plot3(Y(idxOS,1),Y(idxOS,2),tblMeta.dx(idxOS),'og')
zlabel('NCD3')
zlabel('time')
legend({'OD','OS'})
xlabel('NCD1')
ylabel('NCD2')
xlabel('NCV1')
ylabel('NCV2')
zlabel('time (months)')
%
% plot3(t3.Y(:,1),t3.Y(:,2),t3.Y(:,3),'mx')
% plot3(t4.Y(:,1),t4.Y(:,2),t4.Y(:,3),'cs')
% legend({'ONH','macula'})
toc
%
figure(2)
title(['PID = ' PID ' :: normalized compression vectors (radii = ' jsonencode(radii) ')'])
% compute CSF
csf_mean = []; csf_std = [];
for k = 1:10
[idx,Y] = Cluster.SpectralCluster(A,k);
......@@ -97,4 +65,11 @@ csf = CSF.csf_spatial(Y,idx);
csf_mean(k) = mean(csf);
csf_std(k) = std(csf);
end
% plot CSF
figure(2)
clf;errorbar(csf_mean,csf_std);xlim([0,10])
xlabel('number of clusters (K)')
ylabel('optimality deficiency')
title(['PID = ' PID ' :: CSF(radii = ' jsonencode(radii) ')'])
4;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment