Skip to content
Snippets Groups Projects
Commit fb6d807f authored by ac 20's avatar ac 20
Browse files

clipTracks based on surface/vertex instead of centroid

parent 9e9f93f2
Branches
No related tags found
No related merge requests found
......@@ -8,26 +8,44 @@ tids=exportGetExtFamilies(conn,CONSTANTS,gtFile);
if isempty(tids)
return;
end
xyClip=FOI(CONSTANTS.imageData.DatasetName)/2;
xyClip=FOI(CONSTANTS.imageData.DatasetName);
xySize=CONSTANTS.imageData.Dimensions;
if xyClip>0
qFamilies=fetch(conn,'select * from tblFamilies where cellID_child2 is not null');
cidFamilies=table2cell(qFamilies);
cidFamilies=[cidFamilies{:}];
for i=1:length(tids)
q=fetch(conn,['select cellID,trackID,time,centroid from tblCells where trackID='...
if is3D(CONSTANTS)
q=fetch(conn,['select cellID,trackID,time,verts from tblCells where trackID='...
num2str(tids(i)) ' and channel=1']);
if ~isempty(q)
surf=cellfun(@(x) typecast(x,'single'),q.verts,'UniformOutput',false);
surf=cellfun(@(x) reshape(x,3,[])',surf,'UniformOutput',false);
end
else
q=fetch(conn,['select cellID,trackID,time,surface from tblCells where trackID='...
num2str(tids(i)) ' and channel=1']);
if ~isempty(q)
surf=cellfun(@(x) jsondecode(x),q.surface,'UniformOutput',false);
end
end
if isempty(q)
cmd=['delete from uiExtFamily where trackID=' num2str(tids(i))];
exec(conn,cmd);
continue;
end
centroids=cell2mat(cellfun(@jsondecode,q.centroid,'UniformOutput',false));
centroids=reshape(centroids,3,[])';
surfMin=cellfun(@(x) [min(x(:,1:2))],surf,'UniformOutput',false);
surfMin=cell2mat(surfMin);
surfMax=cellfun(@(x) [max(x(:,1:2))],surf,'UniformOutput',false);
surfMax=cell2mat(surfMax);
idxClip=find(centroids(:,1)<xyClip | centroids(:,2)<xyClip | ...
xySize(1)-centroids(:,1)<xyClip | xySize(2)-centroids(:,2)<xyClip);
idxClip=find(surfMax(:,1)<xyClip | surfMax(:,2)<xyClip | ...
xySize(1)-surfMin(:,1)<xyClip | xySize(2)-surfMin(:,2)<xyClip);
if isempty(idxClip)
continue
end
cidClip=q.cellID(idxClip);
strClip=jsonencode(cidClip);
if length(idxClip)>1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment