Skip to content
Snippets Groups Projects
Commit cd3bbbf9 authored by actb's avatar actb
Browse files

ensembleseg : use mean, new cell efficiency

parent 11e59f4d
Branches
No related tags found
No related merge requests found
% score the cells in nest
time=1
iNest=71
q=fetch(conn,['select * from tblEnsemble where time=' num2str(time) ' and iNest='...
num2str(iNest)]);
[im]=DenoiseCache.readImages(time,CONSTANTS,segParams,[]);
cx=[];
for i=1:length(q.time)
nc=Ensemble.makeEnsembleCell(q(i,:));
cx=[cx,nc];
end
cx=Ensemble.setCellEfficiency(cx,im,segParams);
% find rp
cx=Read.setCellsIdxPts(cx,CONSTANTS);
for i=1:length(cx)
L=0*im;
L(cx(i).idxPts)=1;
rp=regionprops(L,'area','convexarea','circularity');
cx(i).area=rp.Area;
cx(i).ConvexArea=rp.ConvexArea;
cx(i).convDef=rp.Area/rp.ConvexArea;
cx(i).circularity=rp.Circularity;
end
...@@ -155,17 +155,18 @@ for j=1:length(nestedCells{ic}) ...@@ -155,17 +155,18 @@ for j=1:length(nestedCells{ic})
% question of combining function -- min,max,mean,etc. relates to % question of combining function -- min,max,mean,etc. relates to
% cluster structure function. empirically chose min. % cluster structure function. empirically chose min.
% and on Dec 13 2019 tried max and mean as well. chose mean for now..:) % and on Dec 13 2019 tried max and mean as well. chose mean for now..:)
scoreJ(j)=max([nestedCells{ic}(cellsJ{j}).score]); % scoreJ(j)=max([nestedCells{ic}(cellsJ{j}).score]);
scoreJ(j)=mean([nestedCells{ic}(cellsJ{j}).score]);
nestedCells{ic}(j).nest.score=scoreJ(j); nestedCells{ic}(j).nest.score=scoreJ(j);
end end
% ensemble vote on k -- score+=#k/total# % ensemble vote on k -- score+=#k/total#
nx=[nestedCells{ic}.nest]; % nx=[nestedCells{ic}.nest];
lx=cellfun(@length,{nx.segList}); % lx=cellfun(@length,{nx.segList});
for j=1:length(scoreJ) % for j=1:length(scoreJ)
k=length(nestedCells{ic}(j).nest.segList); % k=length(nestedCells{ic}(j).nest.segList);
pk=length(find(lx==k))/length(lx); % pk=length(find(lx==k))/length(lx);
scoreJ(j)=scoreJ(j)+pk; % scoreJ(j)=scoreJ(j)+pk;
end % end
% now pick the best of the combi nations % now pick the best of the combi nations
[mm,idx]=max(scoreJ); [mm,idx]=max(scoreJ);
newCells=nestedCells{ic}(cellsJ{idx}); newCells=nestedCells{ic}(cellsJ{idx});
......
...@@ -48,7 +48,7 @@ for i=1:length(Cells) ...@@ -48,7 +48,7 @@ for i=1:length(Cells)
imBackgroundEff=1; imBackgroundEff=1;
else else
% high number means cell pixels are brighter than background % high number means cell pixels are brighter than background
imBackgroundEff=mean(im(idxPts)-T(idxPts)); imBackgroundEff=mean(im(idxPts)-T(idxPts))/mean(im(bw)-T(bw));
end end
% how dark on average the surface neighborhood is (1 is good) % how dark on average the surface neighborhood is (1 is good)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment