-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsbxgetflatseries.m
38 lines (35 loc) · 1.43 KB
/
sbxgetflatseries.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
function dbinfo = sbxgetflatseries( sbxdata )
%SBXFLATSERIES Fetches a complete listing of all patients and series.
%
% dbinfo = SBXFLATSERIES(sbxinfo) Fetches a complete listing of all
% patients and series associated with them. The datastructure is
% flattened and does not contain the information required to select
% individual frames. This is structure is mainly used to populate the
% patient list of the GUI.
try
url = [sbxdata.url, '/api/metadata/flatseries?count=1000000'];
dbinfo = webread(url, sbxdata.weboptions);
dbinfofile = fullfile(sbxdata.cachepath, 'dbinfo');
%fprintf('saving %s\n', dbinfofile);
save(dbinfofile,'dbinfo');
catch ME
switch ME.identifier
case 'MATLAB:webservices:CopyContentToDataStreamError'
try
dbinfo = readinfofile(seriesid, sbxdata);
catch
ME2 = MException('SBXImageinfo:noSuchSeriesInCache','Could not fetch database metadata. Connection could not be established and no cache file present',...
sbxdata.url);
throw(ME2);
end
case 'MATLAB:webservices:HTTP401StatusCodeError'
error('Authorization failed; Incorrect username or password.');
otherwise
rethrow(ME);
end
end
end
function datasets = readinfofile(sbxdata) %#ok<STOUT>
seriesfile = fullfile(sbxdata.cachepath, 'dbinfo');
load(seriesfile,'dbinfo');
end