Commit 9864ff4b authored by Andrew Cohen's avatar Andrew Cohen

ensemble/goSmooth

parent b660343f
strDB='f:/leverjs/ctc2020/2d/Fluo-N2DL-HeLa_training_01.LEVER';
[conn,CONSTANTS,segParams]=openDB(strDB)
cmd=['select cellID,iNest,trackID,time from tblCells where trackID in ' ...
' (select trackID from (select count(trackID) as nTrack,trackID from '...
' tblCells group by TrackID) where nTrack<5)'];
cmd='select * from (select count(trackID) as nTrack,trackID from tblCells group by TrackID) where nTrack<5';
q=fetch(conn,cmd);
targets=table();
for i=1:length(q.trackID)
cmd=['select cellID,trackID,iNest,time from tblCells where trackID=' ...
num2str(q.trackID(i))];
qi=fetch(conn,cmd);
cmd=['select cellID,trackID,iNest,time from tblCells where iNest= ' ...
' (select iNest from tblCells where trackID=' num2str(q.trackID(i)) ...
' ) and time=(select time from tblCells where trackID=' ...
num2str(q.trackID(i)) ')'];
qMerge=fetch(conn,cmd);
if length(qMerge.cellID)<2
continue
end
idTarget=setdiff(qMerge.trackID,q.trackID);
if length(idTarget)~=1
% need 1 valid merge target!
continue
end
if isempty(targets)
targets.destTrackID=idTarget;
targets.destCellID=qMerge.cellID(qMerge.trackID==idTarget);
targets.srcTrackID=q.trackID(i);
targets.srcCellID=qMerge.cellID(qMerge.trackID==q.trackID(i));
else
targets=[targets;{idTarget,qMerge.cellID(qMerge.trackID==idTarget),...
q.trackID(i),qMerge.cellID(qMerge.trackID==q.trackID(i))}];
end
end
targetCIDs=unique(targets.destCellID);
for i=1:length(targetCIDs)
idx=find(targets.destCellID==targetCIDs(i));
mergeList=[targetCIDs(i);targets.srcCellID(idx)];
[cMerge,pctOverlap]=Ensemble.ensembleCheckMerge(conn,mergeList,CONSTANTS);
pctOverlap
cMerge.trackID=targets.destTrackID(idx(1));
if pctOverlap>0.9
Ensemble.writeMergedCell(conn,mergeList,cMerge,CONSTANTS);
end
end
\ No newline at end of file
......@@ -14,5 +14,5 @@ Write.ReplaceCell(conn,cx,cellIDs(1));
time=cx.time;
% update the distances to the new cells
exec(conn,['delete from tblDistCC where cellID_src IN (' deleteCells ')']);
exec(conn,['delete from tblDistCC where cellID_dst IN (' deleteCells ')'])
exec(conn,['delete from tblDistCC where cellID_dst IN (' deleteCells ')']);
Distance.cellDistance(conn,CONSTANTS,time,[time-2:time+2],cellIDs(1));
\ No newline at end of file
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