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

Replace imreconstruct to go faster


Signed-off-by: default avatarAndrew King <andrew.king@esrf.fr>
parent 0708a7b5
No related branches found
No related tags found
No related merge requests found
......@@ -39,15 +39,15 @@ function gtSegmentDiffractionBlobs2D(first, last, workingdirectory)
% Segmented diffraction blobs in the databse.
%
%
if 0
OAR_make('gtSegmentDiffractionBlobs2D', 0, totproj-1, 30, parameters.acq.dir, true,...
'walltime',OAR_parameters.walltime);
end
% test1=zeros(768, 960);
% test2=test1;
if isdeployed
global GT_DB
global GT_MATLAB_HOME
load('workspaceGlobal.mat');
% first=str2double(first);
% last=str2double(last);
% don't show all the messages - as this makes the .out file very large
out = GtConditionalOutput(false);
disp('running compiled, so will show minimal messages only')
......@@ -105,6 +105,7 @@ for imagez=first:last
% label (2D only)
marker_im=bwlabel(marker_im);
mask_im=bwlabel(mask_im);
L=max(marker_im(:))
for j=1:L
......@@ -116,12 +117,21 @@ for imagez=first:last
continue
end
spot=imreconstruct(marker, mask_im);
%spot=imreconstruct(marker, mask_im);
mask_id = unique(mask_im(find(marker)));
spot = mask_im==mask_id;
% test size
bb=regionprops(double(spot), 'BoundingBox');
bb=bb.BoundingBox;
bb=ceil(bb);
%bb=regionprops(double(spot), 'BoundingBox');
%bb=bb.BoundingBox;
%bb=ceil(bb);
indicies=find(spot);
[yy,xx]=ind2sub(size(spot), indicies);
bb(3) = max(xx)-min(xx)+1;
bb(4) = max(yy)-min(yy)+1;
if all(bb(3:4)>MinBlobSize(1:2)) && all(bb(3:4)<MaxBlobSize(1:2)) % size test
% update marker and mask to avoid duplicating spots
......@@ -167,12 +177,12 @@ indicies=find(greyspot>0);
vals=greyspot(indicies);
% from original gtSegmentDiffractionBlobs
mym(dbInsert(table_difblob,{'difblobID'},0))
mym(gtDBInsert(table_difblob,{'difblobID'},0))
difblobID=mym('select last_insert_id()');
disp('***DB WRITE A BLOB *** ')
dbInsertMultiple(table_difblobdetails,...
gtDBInsertMultiple(table_difblobdetails,...
'difblobID',repmat(difblobID,1,length(xx)),...
'xIndex',xx,...
'yIndex',yy,...
......
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