forked from ukb-aoslo/ConeMapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveValidationCones.m
More file actions
44 lines (32 loc) · 1.44 KB
/
SaveValidationCones.m
File metadata and controls
44 lines (32 loc) · 1.44 KB
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
% Please cite this paper if you use any component of this software:
% D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017.
% Released under a GPL v2 license.
function SaveValidationCones(params)
% function for finding and saving cone locations from the validation data
% set
% Make the folder for saving data
if(~exist(params.Results.SaveDir,'dir'))
mkdir(params.Results.SaveDir);
end
% Set detection parameters based on optimization
load(params.Results.OptimizationPath)
ProbParam.PMsigma = OptParam.MaxSigma;
ProbParam.PMthresh = OptParam.MaxPMthresh;
ProbParam.ExtMaxH = OptParam.MaxExtMaxH;
% load in list of images
ImageList = dir(fullfile( params.ImageDirValidate,['*' params.ImageExt]));
ImageList = {ImageList.name};
numFiles = length(ImageList);
% Loop through all images in validation set
for iFile = 1:numFiles
% Load probability map
[~,BaseName] = fileparts(ImageList{iFile});
ProbPath = fullfile(params.Results.ProbMapDirValidate,[BaseName '.mat']);
load(ProbPath)
% Determine cone locations
[CNNPos] = ProbabilityMap_ConeLocations(Cone_Probability,ProbParam);
% Save Data
imageSize = size(Cone_Probability);
SaveName = [BaseName '.mat'];
save(fullfile(params.Results.SaveDir,SaveName),'CNNPos','imageSize');
end