Skip to content
Snippets Groups Projects
Commit 8dc539c1 authored by preischig's avatar preischig
Browse files

gtConvertRawImages2Blobs: added basic help and formatted


Signed-off-by: default avatarpreischig <preischig@gmail.com>
parent 1e26739a
No related branches found
No related tags found
No related merge requests found
function gtConvertRawImages2Blobs(first, last, workingdirectory, varargin)
% GTCONVERTRAWIMAGES2BLOBS Loads diff blobs from database and saves them as
% hdf5 files.
%
% gtConvertRawImages2Blobs(first, last, workingdirectory, varargin)
%
% To speed up, run it in parallel using OAR (OAR_make).
if (isdeployed)
global GT_DB
global GT_MATLAB_HOME
load('workspaceGlobal.mat')
end
if (isdeployed)
global GT_DB
global GT_MATLAB_HOME
load('workspaceGlobal.mat')
end
cd(workingdirectory);
gtDBConnect();
parameters = [];
load('parameters.mat');
cd(workingdirectory);
gtDBConnect();
parameters = [];
load('parameters.mat');
if (~exist('first', 'var') || isempty(first))
first = 1;
end
difblob_num = mym(['select count(*) from ' parameters.acq.name 'difblob']);
if (~exist('last', 'var') || isempty(last))
last = difblob_num;
end
if (~exist('first', 'var') || isempty(first))
first = 1;
end
difblob_num = mym(['select count(*) from ' parameters.acq.name 'difblob']);
if (~exist('last', 'var') || isempty(last))
last = difblob_num;
end
if (isdeployed)
first = str2double(first);
last = str2double(last);
end
if (isdeployed)
first = str2double(first);
last = str2double(last);
end
conf = struct('list', first:last, 'dilate', 5);
conf = parse_pv_pairs(conf, varargin);
info = edf_info(fullfile('1_preprocessing', 'full', 'full0000.edf'));
totproj = parameters.acq.nproj *2;
stats = GtTasksStatistics();
stats.add_task('load_blob', 'Time to load from DB');
stats.add_task('load_mask', 'Time to load mask');
stats.add_task('save_blob', 'Time to save to HDF5');
stats.add_task('convert_blob', 'Time for converting from DB to HDF5')
fprintf('Progress: ')
c = tic();
for ii = conf.list
num_chars = fprintf('%06d/%06d (%s)', ii, numel(conf.list), ...
stats.get_formatted_total('convert_blob'));
stats.tic('convert_blob')
stats.tic('load_mask')
[mask, bb] = get_mask('2_difspot', ii, parameters, conf);
mask(mask < 0) = 0;
stats.toc('load_mask')
stats.tic('load_blob')
blob = get_blob(bb, info, totproj);
blob(blob < 0) = 0;
stats.toc('load_blob')
stats.tic('save_blob')
gtWriteBlobToHDF5('2_difblob', ii, blob, bb, mask);
stats.toc('save_blob')
stats.toc('convert_blob')
fprintf(repmat('\b', [1 num_chars]))
end
fprintf('%06d Done in %f seconds.\n', numel(conf.list), toc(c));
stats.printStats()
conf = struct('list', first:last, 'dilate', 5);
conf = parse_pv_pairs(conf, varargin);
info = edf_info(fullfile('1_preprocessing', 'full', 'full0000.edf'));
totproj = parameters.acq.nproj *2;
stats = GtTasksStatistics();
stats.add_task('load_blob', 'Time to load from DB');
stats.add_task('load_mask', 'Time to load mask');
stats.add_task('save_blob', 'Time to save to HDF5');
stats.add_task('convert_blob', 'Time for converting from DB to HDF5')
fprintf('Progress: ')
c = tic();
for ii = conf.list
num_chars = fprintf('%06d/%06d (%s)', ii, numel(conf.list), ...
stats.get_formatted_total('convert_blob'));
stats.tic('convert_blob')
stats.tic('load_mask')
[mask, bb] = get_mask('2_difspot', ii, parameters, conf);
mask(mask < 0) = 0;
stats.toc('load_mask')
stats.tic('load_blob')
blob = get_blob(bb, info, totproj);
blob(blob < 0) = 0;
stats.toc('load_blob')
stats.tic('save_blob')
gtWriteBlobToHDF5('2_difblob', ii, blob, bb, mask);
stats.toc('save_blob')
stats.toc('convert_blob')
fprintf(repmat('\b', [1 num_chars]))
end
fprintf('%06d Done in %f seconds.\n', numel(conf.list), toc(c));
stats.printStats()
end
function blob = get_blob(bb, info, totproj)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment