forked from alan-p/Cirrus-OCT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessResolutions.m
executable file
·42 lines (37 loc) · 1.21 KB
/
processResolutions.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
42
function [ results ] = processResolutions( data, type, resolutions, debug )
%processResolutions Calculates summary statistics for groups of pixels
%defined by resolutions
% INPUTS
% data - an oct dataset such as that generated by Cirrus_OCT_IRL()
% type - statistic to return (mean or var)
% resolutions - vector of resolutions
% debug - boolean, prints progress if true
% OUTPUTS
% results - cell array of length(resolutions)
% each cell is a vector of summary statistic
% check for valid inputs
type=lower(type);
if ~any(type(1) == ['m' 'v'])
error('processResolutions.m','Invalid type specified');
end
if ~isa(data,'double')
error('processResolutions.m','Invalid data passed');
end
if ~debug
debug=false;
end
results = cell(length(resolutions),1);
for iRes = 1:length(resolutions)
resolution = resolutions(iRes);
if debug
sprintf('Processing resolution: %i - %i of %i', ...
resolution, iRes, length(resolutions))
end
sampleArray = reshapeArray(data,resolution);
if type(1) == 'm'
results{iRes} = nanvar(sampleArray);
else
results{iRes} = nanmean(sampleArray);
end
end
end