Skip to content
Snippets Groups Projects
Commit b19cac08 authored by Andrew King's avatar Andrew King
Browse files

A speed up when subtracting median background from files. Activate with a...

A speed up when subtracting median background from files.  Activate with a flag in parameters for backwards compatibility.

Signed-off-by: default avatarAndrew King <andrew.king@esrf.fr>
parent 4736fde6
No related branches found
No related tags found
No related merge requests found
......@@ -78,12 +78,20 @@ function [img, med_value, info] = gtReadAndThreshold(ndx, parameters, thr_single
%taken from gtFullStatCondor - thanks Peter!
nullbb = NaN(seg.bbox(4), seg.bbox(3));
imn = gtPlaceSubImage2(nullbb, im_full, seg.bbox(1), seg.bbox(2));
imn = imn(~isnan(imn(:)));
% can use a sub set of pixel to calculate the median, it's faster
if isfield(seg, 'background_subtract_accelerate') && seg.background_subtract_accelerate == true
out.fprintf('/// andy speed up by calculating median on subset of pixels ///\n');
imn = imn(1:127:end);
else
% the original routine
out.fprintf('subtracting median background value\n');
end
imn = imn(~isnan(imn));
med_value = median(imn);
im_full = im_full - med_value;
out.fprintf('subtracting median background value\n');
else
med_value = NaN;
end
......
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