Commit c3caeaa0 authored by Andrew Cohen's avatar Andrew Cohen

fetch->ljsFetch for matlab20178b compatibility

parent 571ba78a
......@@ -7,7 +7,7 @@ params.color="#00ffff";
params=Segment.getParams(params,args);
cmd=['select cellID from tblCells where time=' num2str(t)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
cellIDs=cell2mat(q);
im = MicroscopeData.Reader('imageData',CONSTANTS.imageData, 'chanList',...
......
......@@ -14,7 +14,7 @@ channelErk=1;
for t=1:CONSTANTS.imageData.NumberOfFrames
cmd=['select cellID from tblCells where time=' num2str(t)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
cellIDs=cell2mat(q);
imErk = MicroscopeData.Reader('imageData',CONSTANTS.imageData, 'chanList',...
channelErk,'timeRange',[t t], 'outType','single','prompt',false);
......
......@@ -7,7 +7,7 @@ params.color="#ff0000";
params=Segment.getParams(params,args);
cmd=['select cellID from tblCells where time=' num2str(t)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
cellIDs=cell2mat(q);
im = MicroscopeData.Reader('imageData',CONSTANTS.imageData, 'chanList',...
......
......@@ -6,7 +6,7 @@ if isempty(algorithms)
end
% reset table and constants?
q=fetch(conn,'pragma table_info(tblCellFeatures)');
q=ljsFetch(conn,'pragma table_info(tblCellFeatures)');
if size(q,1)<2
CONSTANTS=CellFeatures.resetFeatures(conn,CONSTANTS,algorithms);
else
......
......@@ -7,7 +7,7 @@ end
cmdQ = ['SELECT ROWID,* FROM tblCommands'];
Q = fetch(conn,cmdQ);
Q = ljsFetch(conn,cmdQ);
Cmd.PrintCmd(Q,1);
......
......@@ -12,7 +12,7 @@ cmdQ = ['SELECT ROWID,* FROM tblCommands WHERE commandHost==''matlab'' and ' ...
'bComplete==0;'];
while(1)
Q = fetch(conn,cmdQ);
Q = ljsFetch(conn,cmdQ);
% one at a time...
if isempty(Q)
......
......@@ -2,7 +2,7 @@
function cmdSegment(conn,Q,CONSTANTS)
cmd = 'SELECT jsAlgorithmInfo FROM tblAlgorithms WHERE type="segment"';
qAlgorithms=fetch(conn,cmd);
qAlgorithms=ljsFetch(conn,cmd);
tStart = Q{5};
tStart = max(1,tStart);
......@@ -54,7 +54,7 @@ if isfield(algorithmInfo.params,'channels')
end
cmd=[cmd num2str(channels(length(channels))) ')'];
end
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if Q{1}>0
bExists=true;
return;
......
time=8
cmd=['SELECT time,centroid,u16pixels,maxRadius,channel,area,surface,iRadius,score FROM tblEnsemble WHERE time='...
num2str(time)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
im = MicroscopeData.Reader('imageData',CONSTANTS.imageData, 'chanList',1,'timeRange',[time time], 'outType','single','prompt',false);
figure;imagesc(im);colormap(gray);brighten(0.5);hold on
......
......@@ -15,7 +15,7 @@ function bDeadEnd=checkDeadEnd(conn,p)
') group by A.cellID_src,B.cellID_dst) '...
' inner join tblCells on cellID_src=cellID where costRank=0 and trackID<>'...
num2str(p.trackID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
bDeadEnd=false;
else
......
......@@ -10,14 +10,14 @@ bOcclusionEdge=false;
cmd=['select time,cellID,trackID,cost from tblDistCC inner join tblCells on '...
' cellID=cellID_src where cellID_dst=' num2str(c1.cellID) ' and time='...
num2str(c1.time-2) ' order by cost asc limit 1'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
% check that min cost occlusion edge belongs to a terminal track -- a track
% that ends in frame t-2
cmd=['select max(time) from tblCells where trackID=' num2str(q{1,3})];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if q{1}==c1.time-2
% last frame for this cell was two frames ago
bOcclusionEdge=true;
......
......@@ -13,7 +13,7 @@ mitosisNode.sibAreaRatio=0;
mitosisNode.eccParent=2;
cmd=['select time,centroid from tblCells where cellID=' num2str(d1CellID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
......@@ -24,7 +24,7 @@ d1Centroid=jsondecode(q{2})';
%
% make sure daughter 1 stays alive for at least 5
cmd=['select max(time) from tblCells where trackID=' num2str(d1CellID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
t1=q{1};
if (t1-time)<5
return
......@@ -33,7 +33,7 @@ end
% make sure d1 is not already in family tree
cmd=['select cellID_parent from tblFamilies where cellID_child1=' num2str(d1CellID)...
' or cellID_child2=' num2str(d1CellID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if ~isempty(q)
return
end
......@@ -41,7 +41,7 @@ end
% get parents
cmd=['select cellID,trackID,centroid from tblDistCC inner join tblCells on cellID_src=cellID where cellID_dst='...
num2str(d1CellID) ' and time=' num2str(time-1)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
% no parent
return
......@@ -69,14 +69,14 @@ mitosisNode.ratioD1D2=costs(idx).ratioD1D2;
% select min cost when two are in conflict
cmd=['select cellID_parent from tblFamilies where cellID_child1=' num2str(costs(idx).parentDaughterCID(2))...
' or cellID_child2=' num2str(costs(idx).parentDaughterCID(2))];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if ~isempty(q)
return;
end
% make sure sibling stays alive for min_frames
cmd=['select max(time) from tblCells where trackID IN(' num2str(costs(idx).parentDaughterTID(2)), ',' num2str(costs(idx).parentDaughterCID(2)) ') '];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
t1=q{1};
if (t1-time)<5
return
......@@ -92,7 +92,7 @@ p=Read.getCell(conn,mitosisNode.parentCellID);
% for parent area, select max over last 3 frames
cmd=['select area from tblCells where trackID=' num2str(mitosisNode.parentDaughterTID(1))...
' and time<' num2str(d1.time) ' and time>=' num2str(p.time-3)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
aparent=cell2mat(q);
ar1=(d1.area+d2.area)/max(aparent);
......@@ -212,7 +212,7 @@ function pbr=getParentBR(conn,CONSTANTS,p,imCache)
pbr=brightShape(p,imCache.imM1);
cmd=['select cellID from tblCells where time=' num2str(p.time-1) ' and '...
' trackID= ' num2str(p.trackID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
......@@ -223,7 +223,7 @@ pbr=max([pbr,pbr1]);
function d=getNextDaughter(conn,cell)
cmd=['select cellID from tblCells where trackID=' num2str(cell.trackID) ' and time=' num2str(cell.time)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
d=[];
return;
......@@ -280,7 +280,7 @@ itid=parentCandidate(2); % trackID for parent/daughter 2
% try to use parent trackID in time t-1 to find daughter in time t
cmd=['select cellID,centroid from tblCells where trackID=' num2str(itid) ' AND time='...
num2str(time)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if size(q,1)>1
fprintf(2,'rut roh! duplicate track entries\n');
end
......@@ -294,7 +294,7 @@ else
cmd=['select cellID,trackID,centroid from tblDistCC inner join tblCells on cellID_dst=cellID '...
'where cellID_src=' num2str(parentCandidate(1)) ' and cellID=trackID' ...
' and cellID <> ' num2str(d1.cellID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return;
end
......
......@@ -4,5 +4,5 @@ function q=getCellOutEdges(conn,cellID)
cmd=['select *,sum(A.cost<B.cost) from tblDistCC as A inner join tblDistCC as B on A.cellID_src=B.cellID_src '...
' where A.cellID_src=' num2str(cellID) ' group by B.cellID_dst order by B.cost asc'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
......@@ -2,7 +2,7 @@
function tCells=getCellsT(conn,t)
cmd=['select cellID,trackID,centroid from tblCells where time=' num2str(t)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
centroids=cellfun(@jsondecode,q(:,3),'uniformoutput',false);
centroids=reshape(cell2mat(centroids),3,[])';
......
......@@ -5,7 +5,7 @@
function newTracks=getNewTracks(conn,minTrackLength)
cmd='select trackID,count(cellID),min(time),centroid from tblCells group by trackID';
Qlife=fetch(conn,cmd);
Qlife=ljsFetch(conn,cmd);
centroids=cellfun(@jsondecode,Qlife(:,4),'uniformoutput',false);
centroids=reshape(cell2mat(centroids),3,[])';
......
......@@ -4,7 +4,7 @@ mParams.eccentricityThreshold=0.9;
mParams.brightThreshold=0;
mParams.parentDaughterAreaRatio=1.05;
cmd = 'SELECT jsAlgorithmInfo FROM tblAlgorithms WHERE type="mitosis"';
qAlgorithms=fetch(conn,cmd);
qAlgorithms=ljsFetch(conn,cmd);
if ~isempty(qAlgorithms)
qAlgorithms=jsondecode(qAlgorithms{1});
mParams=Segment.getParams(mParams,qAlgorithms.params);
......@@ -15,12 +15,12 @@ if 1==t
end
% find all new tracks at time t
cmd=['select cellID from tblCells where cellID=trackID and time=' num2str(t)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
newCells=cell2mat(q);
q=fetch(conn,'select * from tblFamilies where cellID_child2 is not null');
q=ljsFetch(conn,'select * from tblFamilies where cellID_child2 is not null');
if ~isempty(q)
lineageNodes=[q{:}];
else
......
......@@ -18,7 +18,7 @@ function resegPatch(conn,tReseg,CONSTANTS)
cmd=['select * from (select max(time) as t1,cellID,trackID from tblCells group by trackID) where (t1='...
num2str(tReseg-1) ' or t1=' num2str(tReseg-2)...
') and cellID not in (select cellID_src from tblManualEdits)'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
......@@ -27,7 +27,7 @@ srcTracks=cell2mat(q);
cmd=['select cellID,time from tblCells where cellID=trackID and time>='...
num2str(tReseg-5) ' and time<=' num2str(tReseg+1) ...
' and cellID not in (select cellID_dst from tblManualEdits)'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
......@@ -90,14 +90,14 @@ tidDst=[];
time=-1;
cmd=['select cellID_src,cellID_dst,min(cost) from tblDistCC where cellID_src='...
num2str(srcID)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q) || isnan(q{2})
return
end
cidDst=q{2};
cmd=['select time,trackID from tblCells where cellID=' num2str(cidDst)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
cidDst=[];
return;
......@@ -115,7 +115,7 @@ cmd=['select * from (select B.cellID_src,B.cost,B.cellID_dst,sum(A.cost<B.cost)
' as inOrder from tblDistCC as A inner join tblDistCC as B on '...
' A.cellID_dst=B.cellID_dst where B.cellID_dst = ' num2str(cellID) ...
' group by B.cellID_src) where inOrder<=1 order by cost DESC'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if size(q,1)<2
return
end
......@@ -123,7 +123,7 @@ cid2=q{1,1};
cid1=q{2,1};
cmd=['select cellID,time from tblCells where cellID in (' num2str(cid1) ','...
num2str(cid2) ')'];
qt=fetch(conn,cmd);
qt=ljsFetch(conn,cmd);
tid=cell2mat(qt);
t1=tid(find(tid(:,1)==cid1),2);
t2=tid(find(tid(:,1)==cid2),2);
......
......@@ -5,19 +5,19 @@ STUB=3;
szStub=num2str(STUB);
cmd=['select min(time),max(time) from tblCells where trackID=' num2str(tid)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
tmin=q{1};
tmax=q{2};
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
cmd=['select cellID,time from tblCells where trackID=' num2str(tid) ' order by time desc LIMIT ' szStub];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
iTerm=cell2mat(q);
% term(1) is last cell, term(2) is 2nd to last ...
for j=1:size(iTerm,1)
% get outgoing edges
cmd=['select trackID,cost,time from tblDistCC inner join tblCells on cellID_dst=cellID where cellID_src=' num2str(iTerm(j,1)) ' order by cost asc limit 2'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
continue
end
......@@ -35,7 +35,7 @@ for j=1:size(iTerm,1)
end
% see if we're near the beginning of target track
cmd=['select min(time),max(time) from tblCells where trackID=' num2str(q{idx,1})];
qt0=fetch(conn,cmd);
qt0=ljsFetch(conn,cmd);
if q{idx,3}-qt0{1}>STUB
continue
end
......
......@@ -2,11 +2,11 @@
function connectTracks(conn,tid1,tid2)
cmd=['select cellID,time from tblCells where trackID=' num2str(tid1)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
rg1=cell2mat(q);
tjoin=max(rg1(:,2))+1;
cmd=['select cellID,time from tblCells where trackID=' num2str(tid2)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
rg2=cell2mat(q);
idxReset=find(rg2(:,2)<tjoin);
......
......@@ -4,12 +4,12 @@ cmd=['select A.cellID_src,B.CellID_dst,sum(A.cost<B.cost) from tblDistCC as A '.
' inner join tblDistCC as B on A.cellID_src=B.cellID_src where ' ...
' A.cellID_src=' num2str(cid1) ' and B.cellID_dst=' num2str(cid2)...
' group by B.cellID_dst order by B.cost asc '];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
outOrder=q{3};
cmd=['select B.cellID_src,B.cellID_dst,sum(A.cost<B.cost) from tblDistCC as A '...
' inner join tblDistCC as B on A.cellID_dst=B.cellID_dst where '...
' A.cellID_dst=' num2str(cid2) ' and B.cellID_src=' num2str(cid1)...
' group by B.cellID_src order by B.cost asc']
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
outOrder=q{3};
function [parentTrackIDs,childTrackIDs]=getParentChildTrackIDs(conn)
cmd='select trackID from tblCells inner join tblFamilies on tblFamilies.cellID_parent=cellID';
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
parentTrackIDs=cell2mat(q);
cmd='select trackID from tblCells inner join tblFamilies on tblFamilies.cellID_child1=cellID or tblFamilies.cellID_child2=cellID';
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
childTrackIDs=cell2mat(q);
function [termCells,tGraph]=getTermGraph(conn,CONSTANTS)
q=fetch(conn,'select max(trackID) from tblCells');
q=ljsFetch(conn,'select max(trackID) from tblCells');
tGraph=sparse(q{1},q{1});
% end tracks
cmd='select trackID,count(cellID),max(time),min(time) from tblCells group by trackID';
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
termCells=cell2mat(q);
termCells(CONSTANTS.imageData.NumberOfFrames==termCells(:,3),:)=[];
termCells(:,5)=termCells(:,3)-termCells(:,4)+1;
......
......@@ -13,7 +13,7 @@ else
cmd=['select trackID,min(time) from tblCells where trackID in (' strtids...
') group by trackID'];
end
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if isempty(q)
return
end
......
function algorithms=getAlgorithms(conn,strType)
cmd = ['SELECT jsAlgorithmInfo FROM tblAlgorithms WHERE type="' strType '"'];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if isempty(Q)
algorithms=[];
return
......
......@@ -4,7 +4,7 @@ Cell=[];
try
cmd=['SELECT cellID,time,trackID,centroid,u16pixels,maxRadius,channel,area,surface FROM tblCells WHERE cellID=' num2str(cellID)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
catch
Cell=Read.getCell3D(conn,cellID);
return
......
......@@ -3,7 +3,7 @@ function Cell=getCell3D(conn,cellID)
Cell=[];
cmd=['SELECT time,trackID,centroid,channel,area,maxRadius,verts,faces,edges,normals,u16pixels FROM tblCells WHERE cellID=' num2str(cellID)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
% cellid time trackID centroid channel area, maxRadius,
% verts,edges,normals,faces,u16pixels
if isempty(Q)
......
function [CONSTANTS status]=getConstants(conn)
cmdQ = ['SELECT * FROM tblConstants'];
Q = fetch(conn,cmdQ);
Q = ljsFetch(conn,cmdQ);
CONSTANTS=jsondecode(Q{1});
if length(Q)>=2
......
function tidExtFamilies=getExtFamilies(conn)
tidExtFamilies=[];
cmd='select trackID from uiExtFamilies';
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if isempty(Q)
return
end
......@@ -10,7 +10,7 @@ cmdLineage=['SELECT parent.trackID AS trackID,c1.trackID as tchild1, c2.trackID
' FROM tblFamilies INNER JOIN tblCells as parent ON parent.cellID = tblFamilies.cellID_parent' ...
' INNER JOIN tblCells as c1 ON c1.cellID = tblFamilies.cellID_child1 INNER JOIN tblCells as c2' ...
' ON c2.cellID = tblFamilies.cellID_child2'];
Qlineage=fetch(conn,cmdLineage);
Qlineage=ljsFetch(conn,cmdLineage);
familyList=cell2mat(Qlineage);
idIntersect=intersect(tidExtFamilies,familyList);
......
function ccc=getTrackColor(conn,trackID)
cmd=['SELECT * FROM tblTracks WHERE trackID=' num2str(trackID)];
cQ=fetch(conn,cmd);
cQ=ljsFetch(conn,cmd);
cQ=jsondecode(cQ{2});
ccc=cQ.color.background;
ccc=[hex2dec(ccc(2:3)),hex2dec(ccc(4:5)),hex2dec(ccc(6:7))]./255;
\ No newline at end of file
......@@ -34,7 +34,7 @@ for i=1:size(familyList,1)
end
cmd='select trackID from uiExtFamilies';
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
tidExtFamilies=cell2mat(q);
tidAddToExtFamilies=[];
......@@ -53,7 +53,7 @@ end
cmd=['select trackID from (select trackID,count(trackID) as nFrames from tblCells '...
' group by trackID) where nFrames>=' num2str(extParams.nFrames)];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
tidN=cell2mat(q);
tidN=setdiff(tidN,tidExtFamilies);
tidN=setdiff(tidN,familyList(:));
......
......@@ -5,7 +5,7 @@ bComplete=1;
% check for extFamily changes
cmd = 'SELECT jsAlgorithmInfo FROM tblAlgorithms WHERE lower(type)="extfamily"';
qAlgorithms=fetch(conn,cmd);
qAlgorithms=ljsFetch(conn,cmd);
if ~isempty(qAlgorithms)
qAlgorithms=jsondecode(qAlgorithms{1});
Reseg.extFamily(conn,qAlgorithms.params,t);
......@@ -17,7 +17,7 @@ resegParams.mitosisDetection=false;
resegParams.patch=false;
% run classifiers first
cmd = 'SELECT jsAlgorithmInfo FROM tblAlgorithms WHERE type="reseg"';
qAlgorithms=fetch(conn,cmd);
qAlgorithms=ljsFetch(conn,cmd);
if ~isempty(qAlgorithms)
qAlgorithms=jsondecode(qAlgorithms{1});
resegParams=Segment.getParams(resegParams,qAlgorithms.params);
......
......@@ -11,7 +11,7 @@ function reSegmentComplete(conn,t,CONSTANTS)
% ACK ACK note this also selects previous reseg edits...
cmd=['SELECT * from tblEditList WHERE userID=0 AND imageFrame=' num2str(t)];
editQ=fetch(conn,cmd);
editQ=ljsFetch(conn,cmd);
if ~isempty(editQ)
idxUndo = cellfun(@(x) strcmp(x,'undo'),editQ(:,5));
......@@ -36,14 +36,14 @@ if ~isempty(editQ)
% then we can't undo the split
cmd=['SELECT cellID,trackID FROM tblCells where cellID IN ('...
cellIDs(2:end-1) ') AND cellID=trackID'];
mergeQ=fetch(conn,cmd);
mergeQ=ljsFetch(conn,cmd);
if ~isempty(mergeQ)
% we have untracked cells in the split (cellID==trackID)
% before undoing, check for any of the split cells are in a mitosis
idSplitStr=['(' cellIDs(2:end-1) ')'];
cmd=['select * from tblFamilies where cellID_parent in ' idSplitStr...
' or cellID_child1 in ' idSplitStr ' or cellID_child2 in ' idSplitStr];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
if ~isempty(q)
% can't undo this split -- one of the splittees is a child
continue
......@@ -65,7 +65,7 @@ activeTracks=Segment.getKeepAliveTracks(conn,t);
% now, tracks in the current frame
cmd = ['SELECT cellID,trackID FROM tblCells WHERE time=' num2str(t)];
Qt=fetch(conn,cmd);
Qt=ljsFetch(conn,cmd);
if isempty(Qt)
return;
end
......@@ -94,7 +94,7 @@ for i=1:length(missingTrackIDs)
cmd = ['SELECT time, trackID, cellID_src,cellID_dst,cost FROM tblCells JOIN tblDistCC ' ...
'WHERE cellID=cellID_dst AND time=' num2str(t) ' and cellID_src=' num2str(cellIDMissing)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if isempty(Q)
continue
end
......@@ -105,7 +105,7 @@ for i=1:length(missingTrackIDs)
continue;
end
cmd=['SELECT time,cellID FROM tblCells WHERE trackID=' num2str(targetTrackID) ' AND time<' num2str(t)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if size(Q,1)>5
continue
end
......@@ -121,4 +121,4 @@ function Q=getCellFromDB(conn,trackID,time)
cmd = ['SELECT cellID from tblCells WHERE trackID=' num2str(trackID) ...
' AND time=' num2str(time)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
function resegCheckMerges(conn,t,CONSTANTS)
cmd = 'SELECT editID,arguments FROM tblEditList WHERE operation="merge"';
Qmerge=fetch(conn,cmd);
Qmerge=ljsFetch(conn,cmd);
if isempty(Qmerge)
return
end
cmd = ['SELECT cellID,trackID,segCC FROM tblCells WHERE time=' num2str(t)];
Qt=fetch(conn,cmd);
Qt=ljsFetch(conn,cmd);
if isempty(Qt)
return
end
......@@ -19,7 +19,7 @@ mergeList=[];
for i=1:size(Qmerge,1)
cmd = ['SELECT editID FROM tblEditList WHERE operation="undo" AND arguments='...
num2str(Qmerge{i,1})];
Qundo=fetch(conn,cmd);
Qundo=ljsFetch(conn,cmd);
if ~isempty(Qundo)
continue
end
......@@ -30,7 +30,7 @@ for i=1:size(Qmerge,1)
end
cmd = ['SELECT cellID,trackID,segCC FROM tblCells WHERE time=' num2str(t-1)];
Qt1=fetch(conn,cmd);
Qt1=ljsFetch(conn,cmd);
t1Cells=cell2mat(Qt1);
% find each cell that is in mergeList(:,2) -- it was merge source
......
......@@ -9,7 +9,7 @@ end
% now, tracks in the current frame
cmd = ['SELECT cellID,trackID FROM tblCells WHERE time=' num2str(t)];
Qt=fetch(conn,cmd);
Qt=ljsFetch(conn,cmd);
if isempty(Qt)
return
end
......@@ -37,7 +37,7 @@ for i=1:length(missingTrackIDs)
% edge
cmd = ['SELECT time, cellID_src,cellID_dst,cost FROM tblCells JOIN tblCosts ' ...
'WHERE cellID=cellID_dst AND time=' num2str(t) ' and cellID_src=' num2str(celIDMissing)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if isempty(Q)
% need to add
else
......@@ -89,7 +89,7 @@ function Q=getCellFromDB(conn,trackID,time)
cmd = ['SELECT cellID from tblCells WHERE trackID=' num2str(trackID) ...
' AND time=' num2str(time)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
% mahal is not symmetric. in ccDistance, we make it symmetric. here we use
% the non-symmetric to let each cell pick its best match
......
......@@ -20,7 +20,7 @@ for nChannel=1:numberOfChannels
cmd=['SELECT cellID,centroid,u16pixels,maxRadius FROM tblCells WHERE time=' num2str(t0) ' AND channel = '...
num2str(nChannel)];
Q0=fetch(conn,cmd);
Q0=ljsFetch(conn,cmd);
if isempty(Q0)
continue
end
......@@ -31,7 +31,7 @@ for nChannel=1:numberOfChannels
t1Str=t1Str(2:end-1);
cmd=['SELECT cellID,centroid,u16pixels,maxRadius,time FROM tblCells WHERE time IN (' t1Str ') AND channel = '...
num2str(nChannel)];
Q1=fetch(conn,cmd);
Q1=ljsFetch(conn,cmd);
if isempty(Q1)
continue
end
......
......@@ -75,7 +75,7 @@ cmd = ['INSERT INTO tblEditList(dateTime,imageFrame,userID,operation,arguments)'
'VALUES(datetime("now","localtime"),' num2str(time),', ' num2str(userID) ',"merge","' args '")'];
exec(conn,cmd);
cmd='SELECT last_insert_rowid()';
rowid=fetch(conn,cmd);
rowid=ljsFetch(conn,cmd);
rowid=rowid{1};
% copy the old cells to the zombie table
newIDs=jsonencode(cellIDs);
......
......@@ -9,7 +9,7 @@ end
tstr=tstr(2:end-1);
cmd=['select cellID,trackID,time,segCC from tblCells where time>=' num2str(time)...
' and trackID in (' tstr ')'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
rgMerge=cell2mat(q);
tMerge=rgMerge(:,3);
......
......@@ -26,7 +26,7 @@ cmd = ['INSERT INTO tblEditList(dateTime,imageFrame,userID,operation)'...
'VALUES(datetime("now","localtime"),' num2str(time),', ' num2str(userID) ',"split")'];
exec(conn,cmd);
cmd='SELECT last_insert_rowid()';
rowid=fetch(conn,cmd);
rowid=ljsFetch(conn,cmd);
rowid=rowid{1};
% copy the old cell to the zombie table
cmd=['INSERT INTO tblZombies SELECT last_insert_rowid(),* FROM tblCells where cellID='...
......@@ -57,7 +57,7 @@ function Cells=getSplitCells(conn,cellID,K,CONSTANTS,checkValue)
Cells=[];
cmd=['SELECT cellID,time,u16Pixels,area,channel,segCC FROM tblCells WHERE cellID=' num2str(cellID)];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
if isempty(Q)
fprintf(1,'SplitCell ERROR: no matching cellID=%d\n',cellID);
......
......@@ -17,7 +17,7 @@ for idp=0:ceil(CONSTANTS.imageData.NumberOfFrames/p.NumWorkers)-1
strTmax=num2str((idp+1)*p.NumWorkers);
cmd=['select time from tblCells where time>=' strTmin ' and time<=' strTmax ...
' group by time'];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
tSeg=cell2mat(q);
spmd
......