Skip to content
Snippets Groups Projects
Commit 59a69d41 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

RawImages->Blobs converter: added support for expansion in W

parent cb916e44
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,7 @@ end
cd(workingdirectory);
gtDBConnect();
parameters = [];
load('parameters.mat');
parameters = gtLoadParameters();
if (~exist('first', 'var') || isempty(first))
first = 1;
......@@ -31,11 +30,11 @@ if (isdeployed)
last = str2double(last);
end
conf = struct('list', first:last, 'dilate', 5);
conf = struct('list', first:last, 'dilate', [5 5 0]);
conf = parse_pv_pairs(conf, varargin);
info = edf_info(fullfile('1_preprocessing', 'full', 'full0000.edf'));
totproj = parameters.acq.nproj *2;
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');
......@@ -108,12 +107,12 @@ function [mask, bb] = get_mask(spot_dir, blob_id, parameters, conf)
mask = mask(:, :, ones(1, bb(6)));
end
if (conf.dilate > 0)
if (any(conf.dilate > 0))
img_size = [parameters.acq.xdet parameters.acq.ydet];
% What about enlarging it? Let's do a fixed 3-5 pixels?
num_pixels = conf.dilate;
new_blob_bb = bb + [-1 -1 0 2 2 0] .* num_pixels;
new_blob_bb = bb + [-1 -1 -1 2 2 2] .* repmat(num_pixels, 1, 2);
new_limits = [new_blob_bb(1:3), new_blob_bb(1:3)+new_blob_bb(4:6)-1];
......@@ -124,12 +123,16 @@ function [mask, bb] = get_mask(spot_dir, blob_id, parameters, conf)
chopped_bb = [chopped_limits(1:3), ...
chopped_limits(4:6)-chopped_limits(1:3)+1 ];
shifts = [(num_pixels - (chopped_bb(1:2) - new_blob_bb(1:2))), 0];
shifts = [(num_pixels(1:2) - (chopped_bb(1:2) - new_blob_bb(1:2))), 0];
new_blob_mask = gtPlaceSubVolume( ...
zeros([chopped_bb(5), chopped_bb(4), chopped_bb(6)], 'uint8'), ...
uint8(mask), shifts);
new_blob_mask = imdilate(new_blob_mask, strel('disk', num_pixels));
if (num_pixels(3))
new_blob_mask = imdilate(new_blob_mask, strel('ball', num_pixels(1), num_pixels(3)));
else
new_blob_mask = imdilate(new_blob_mask, strel('disk', num_pixels));
end
bb = chopped_bb;
mask = logical(new_blob_mask);
......
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