Commit f01bdc3f authored by Andrew Cohen's avatar Andrew Cohen

matlabPollDB for new mitosis.findfamily -- image caching!!

parent 524ac662
......@@ -100,23 +100,27 @@ end
mitosisNode.sibAreaRatio=max([d1.area,d2.area])/min([d1.area,d2.area]);
if isempty(imCache)
imCache=getImageCache(conn,CONSTANTS,time,segParams,min_radius_pixels);
imCache=getImageCache(conn,CONSTANTS,time);
end
d1br=brightShape(d1,im);
d2br=brightShape(d2,im);
if isempty(imCache)
return;
end
d1br=brightShape(d1,imCache.im);
d2br=brightShape(d2,imCache.im);
d1t1=getNextDaughter(conn,d1);
if ~isempty(d1t1)
d1br=max([d1br,brightShape(d1t1,im2)]);
d1br=max([d1br,brightShape(d1t1,imCache.imP1)]);
end
d2t1=getNextDaughter(conn,d2);
if ~isempty(d2t1)
d2br=max([d2br,brightShape(d2t1,im2)]);
d2br=max([d2br,brightShape(d2t1,imCache.imP1)]);
end
pbr=getParentBR(conn,CONSTANTS,p,imCache);
mitosisNode.brightRatio=[d1br,d2br,pbr];
eccParent=getEcc(size(im),p);
eccParent=getEcc(size(imCache.im),p);
mitosisNode.eccParent=eccParent;
4;
......@@ -141,12 +145,12 @@ for i=1:size(parentCandidates,1)
% midpoint of line between daughters -- this is where we'd like to see
% the parent
pmid=(d2Centroid+d1Centroid)/2;
pmid=(d2Centroid+d1.centroid)/2;
nc=[];
nc.parentDaughterCID=[parentCandidates(i,1),d2CellID,];
nc.parentToDaughterMidpoint=norm(pCentroid-pmid);
nc.dParentD1=Mitosis.cellDistance(conn,d1CellID,parentCandidates(i,1));
nc.dParentD1=Mitosis.cellDistance(conn,d1.cellID,parentCandidates(i,1));
nc.dParentD2=Mitosis.cellDistance(conn,d2CellID,parentCandidates(i,1));
nc.parentDaughterTID=[parentCandidates(i,2),d2TrackID];
nc.ratioD1D2=nc.dParentD1/nc.dParentD2;
......@@ -155,8 +159,11 @@ end
% don't reread the images every time!!! we denoise on the image read!
function imCache=getImageCache(conn,CONSTANTS,time)
imCache=[];
imCache=[];
if time<2
return
end
algorithms=Read.getAlgorithms(conn,'segment');
if length(algorithms)>1
algorithms=algorithms(1);
......@@ -173,10 +180,16 @@ min_radius_pixels = segParams.minimumRadius_um ./ resolution_um;
imCache.im =Segment.getImages(CONSTANTS,time, segParams.channels(1),min_radius_pixels,segParams.denoise);
imCache.imM1=Segment.getImages(CONSTANTS,time-1,segParams.channels(1),min_radius_pixels,segParams.denoise);
imCache.imM2=Segment.getImages(CONSTANTS,time-2,segParams.channels(1),min_radius_pixels,segParams.denoise);
imCache.imP1=Segment.getImages(CONSTANTS,time+1,segParams.channels(1),min_radius_pixels,segParams.denoise);
imCache.imP2=Segment.getImages(CONSTANTS,time+2,segParams.channels(1),min_radius_pixels,segParams.denoise);
if time>2
imCache.imM2=Segment.getImages(CONSTANTS,time-2,segParams.channels(1),min_radius_pixels,segParams.denoise);
else
imCache.imM2=[];
end
if time<CONSTANTS.imageData.NumberOfFrames
imCache.imP1=Segment.getImages(CONSTANTS,time+1,segParams.channels(1),min_radius_pixels,segParams.denoise);
else
imCache.imP1=[];
end
function pbr=getParentBR(conn,CONSTANTS,p,imCache)
% parent needs to be in frame t-1
......@@ -205,6 +218,10 @@ d=Read.getCell(conn,nextID);
% mse between distance transform and intensity profile
function br=brightShape(cell,im)
if isempty(im)
br=0;
return;
end
imx=0*im;
if (size(im,3))>1
idx=sub2ind(size(im),cell.pts(:,2),cell.pts(:,1),cell.pts(:,3));
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment