Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RSF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
RSF
Commits
0b794ec9
Commit
0b794ec9
authored
2 months ago
by
ac
Browse files
Options
Downloads
Patches
Plain Diff
quantize all positive images to full 8 bits
parent
924c0ea7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/MATLAB/+RSF/quantizeImX.m
+4
-2
4 additions, 2 deletions
src/MATLAB/+RSF/quantizeImX.m
src/MATLAB/clusterExamples/goLR.m
+27
-52
27 additions, 52 deletions
src/MATLAB/clusterExamples/goLR.m
with
31 additions
and
54 deletions
src/MATLAB/+RSF/quantizeImX.m
+
4
−
2
View file @
0b794ec9
...
@@ -9,9 +9,9 @@ for i = 1 : length(imf)
...
@@ -9,9 +9,9 @@ for i = 1 : length(imf)
end
end
end
end
if
~
exist
(
"clipRange"
,
'var'
)
if
~
exist
(
"clipRange"
,
'var'
)
%
clipRange = [2.5,97.5];
clipRange
=
[
2.5
,
97.5
];
% % clipRange = [0.5,99.5];
% % clipRange = [0.5,99.5];
clipRange
=
[
0
,
100
];
%
clipRange = [0,100];
end
end
for
c
=
1
:
size
(
imf
{
1
},
4
)
for
c
=
1
:
size
(
imf
{
1
},
4
)
...
@@ -37,6 +37,8 @@ for i = 1:length(imf)
...
@@ -37,6 +37,8 @@ for i = 1:length(imf)
imq_neg
=
SSF
.
quantize8
(
imn
,
clip_neg
(
c
,:));
imq_neg
=
SSF
.
quantize8
(
imn
,
clip_neg
(
c
,:));
if
all
(
0
==
imq_pos
)
if
all
(
0
==
imq_pos
)
imf
{
i
}(:,:,:,
c
)
=
imq_neg
;
imf
{
i
}(:,:,:,
c
)
=
imq_neg
;
elseif
all
(
0
==
imq_neg
)
imf
{
i
}(:,:,:,
c
)
=
imq_pos
;
else
else
% [0,127] for imq_neg, [128,255] imq_pos
% [0,127] for imq_neg, [128,255] imq_pos
imq_pos
=
(
0.5
.*
imq_pos
)
+
uint8
(
128
.*
(
imq_pos
>
0
));
imq_pos
=
(
0.5
.*
imq_pos
)
+
uint8
(
128
.*
(
imq_pos
>
0
));
...
...
This diff is collapsed.
Click to expand it.
src/MATLAB/clusterExamples/goLR.m
+
27
−
52
View file @
0b794ec9
tic
tic
ROOT
=
'/g/leverjs/Schuman_OCT/OCT/qualified'
;
ROOT
=
'/g/leverjs/Schuman_OCT/OCT/qualified
Yes
'
;
% ROOT = '/g/leverjs/Schuman_OCT/OCT/qualified';
% ROOT = '/g/leverjs/Schuman_OCT/OCT/qualified';
% PID = 'P10010';
% PID = 'P10010';
...
@@ -10,7 +10,7 @@ tblMeta = struct2table(vertcat(mx{:}));
...
@@ -10,7 +10,7 @@ tblMeta = struct2table(vertcat(mx{:}));
tblMeta
.
PID
=
str2double
(
tblMeta
.
PID
);
tblMeta
.
PID
=
str2double
(
tblMeta
.
PID
);
tblMeta
.
folder
=
{
flist
.
folder
}
'
;
tblMeta
.
folder
=
{
flist
.
folder
}
'
;
tblMeta
.
filename
=
{
flist
.
name
}
'
;
tblMeta
.
filename
=
{
flist
.
name
}
'
;
% database query
tblMeta
=
tblMeta
(
contains
(
tblMeta
.
scanType
,
'Optic'
),:);
tblMeta
=
tblMeta
(
contains
(
tblMeta
.
scanType
,
'Optic'
),:);
% tblMeta = tblMeta(contains(tblMeta.scanType,'Macula'),:);
% tblMeta = tblMeta(contains(tblMeta.scanType,'Macula'),:);
% tblMeta = tblMeta(contains(tblMeta.eye,'OD'),:);
% tblMeta = tblMeta(contains(tblMeta.eye,'OD'),:);
...
@@ -23,11 +23,12 @@ p = ljsStartParallel(96);
...
@@ -23,11 +23,12 @@ p = ljsStartParallel(96);
radii
=
{[
8
]}
% dark tubes
radii
=
{[
8
]}
% dark tubes
% radii = {[0.5,8,8],[5,5,5],[8]}; % plate,blob, dark tube
% radii = {[0.5,8,8],[5,5,5],[8]}; % plate,blob, dark tube
% radii = {[5,5,5],[8]}; % plate,blob, dark tube
radii
radii
imf
=
RSF
.
getImf
(
tblMeta
,
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
=
[];
d
=
[];
parfor
i
=
1
:
length
(
imf
)
parfor
i
=
1
:
length
(
imf
)
dj
=
[];
dj
=
[];
...
@@ -38,58 +39,25 @@ parfor i = 1:length(imf)
...
@@ -38,58 +39,25 @@ parfor i = 1:length(imf)
end
end
A
=
Cluster
.
Regularize
(
d
);
A
=
Cluster
.
Regularize
(
d
);
[
~
,
Y
]
=
Cluster
.
SpectralCluster
(
A
,
3
);
[
~
,
Y
]
=
Cluster
.
SpectralCluster
(
A
,
2
);
toc
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'
));
figure
(
1
)
% compute time for scatter plot 3rd axis
tblMeta
.
dx
=
datetime
(
tblMeta
.
date
,
'InputFormat'
,
'MM-dd-yyyy'
);
tblMeta
.
dx
=
datetime
(
tblMeta
.
date
,
'InputFormat'
,
'MM-dd-yyyy'
);
tblMeta
.
dx
=
calmonths
(
between
(
min
(
tblMeta
.
dx
),
tblMeta
.
dx
));
tblMeta
.
dx
=
calmonths
(
between
(
min
(
tblMeta
.
dx
),
tblMeta
.
dx
));
% draw scatter plot
figure
(
1
)
clf
;
hold
on
clf
;
hold
on
plot3
(
Y
(
idxOD
,
1
),
Y
(
idxOD
,
2
),
tblMeta
.
dx
(
idxOD
),
'r*'
)
plot3
(
Y
(
idxOD
,
1
),
Y
(
idxOD
,
2
),
tblMeta
.
dx
(
idxOD
),
'r*'
)
plot3
(
Y
(
idxOS
,
1
),
Y
(
idxOS
,
2
),
tblMeta
.
dx
(
idxOS
),
'og'
)
plot3
(
Y
(
idxOS
,
1
),
Y
(
idxOS
,
2
),
tblMeta
.
dx
(
idxOS
),
'og'
)
zlabel
(
'
NCD3
'
)
zlabel
(
'
time
'
)
legend
({
'OD'
,
'OS'
})
legend
({
'OD'
,
'OS'
})
xlabel
(
'NC
D
1'
)
xlabel
(
'NC
V
1'
)
ylabel
(
'NC
D
2'
)
ylabel
(
'NC
V
2'
)
zlabel
(
'time (months)'
)
zlabel
(
'time (months)'
)
%
title
([
'PID = '
PID
' :: normalized compression vectors (radii = '
jsonencode
(
radii
)
')'
])
% plot3(t3.Y(:,1),t3.Y(:,2),t3.Y(:,3),'mx')
% compute CSF
% plot3(t4.Y(:,1),t4.Y(:,2),t4.Y(:,3),'cs')
% legend({'ONH','macula'})
toc
%
figure
(
2
)
csf_mean
=
[];
csf_std
=
[];
csf_mean
=
[];
csf_std
=
[];
for
k
=
1
:
10
for
k
=
1
:
10
[
idx
,
Y
]
=
Cluster
.
SpectralCluster
(
A
,
k
);
[
idx
,
Y
]
=
Cluster
.
SpectralCluster
(
A
,
k
);
...
@@ -97,4 +65,11 @@ csf = CSF.csf_spatial(Y,idx);
...
@@ -97,4 +65,11 @@ csf = CSF.csf_spatial(Y,idx);
csf_mean
(
k
)
=
mean
(
csf
);
csf_mean
(
k
)
=
mean
(
csf
);
csf_std
(
k
)
=
std
(
csf
);
csf_std
(
k
)
=
std
(
csf
);
end
end
% plot CSF
figure
(
2
)
clf
;
errorbar
(
csf_mean
,
csf_std
);
xlim
([
0
,
10
])
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
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment