-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsbxflatseries.m
36 lines (33 loc) · 1.35 KB
/
sbxflatseries.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
function dbinfo = sbxflatseries( sbxdata )
%SBXFLATSERIES Fetches a complete listing of all patients and series.
% 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'];
dbinfo = webread(url, sbxdata.weboptions);
dbinfofile = fullfile(sbxdata.cachepath, 'dbinfo');
fprintf('saving %s', 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