Commit 8f42be07 authored by Andrew Cohen's avatar Andrew Cohen

Merge branch 'master' of git-bioimage.coe.drexel.edu:bioimage/leverjs

parents 5152e805 ef47bf36
......@@ -222,7 +222,8 @@ function getImage(req,res)
}
else {
// else try the override
var fnameOverride=path.join(req.ROOT,'lever.json');
var folderOverride=path.dirname(req.leverFile);
fnameOverride=path.join(folderOverride,'lever.json');
if (fs.existsSync(fnameOverride)) {
var override=fs.readFileSync(fnameOverride);
override=JSON.parse(override);
......
% batch segmentation
tic
strDB='\path\to\file.LEVER';
conn = database(strDB, '','', 'org.sqlite.JDBC', 'jdbc:sqlite:');
CONSTANTS=Read.getConstants(conn);
algs=Read.getAlgorithms(conn,'segment');
params=algs.params;
Cells=[];
% p=parpool(16);
p=gcp();
for idp=0:ceil(CONSTANTS.imageData.NumberOfFrames/p.NumWorkers)-1
nc=Composite();
strTmin=num2str(idp*p.NumWorkers);
strTmax=num2str((idp+1)*p.NumWorkers);
cmd=['select time from tblCells where time>=' strTmin ' and time<=' strTmax ...
' group by time'];
q=fetch(conn,cmd);
tSeg=cell2mat(q);
spmd
t=idp*numlabs+labindex;
if isempty(intersect(t,tSeg)) && t<=CONSTANTS.imageData.NumberOfFrames
nc=Segment.FrameSegment_texture('',t,CONSTANTS,params);
else
if ~isempty(intersect(t,tSeg))
fprintf(1,' found existing seg, t=%d\n',t);
end
nc=[];
end
end
fprintf(1,'completed IDP=%d\n',idp);
Cells=[nc{:}];
Write.CreateCells_3D(conn,Cells);
end
for t=1:CONSTANTS.imageData.NumberOfFrames
Segment.CellDistance(conn,CONSTANTS,t,[t-2:t-1]);
end
tElapsed=toc;
fprintf(1,'batch segmentation -- elapsed time = %.1f seconds\n',tElapsed);
close(conn);
\ No newline at end of file
......@@ -33,9 +33,11 @@ insertCells.close();
% now, query back the trackIDs -1 from that time point
cmdSql=['select cellID from tblCells WHERE trackID=-1;'];
Q=fetch(conn,cmdSql);
cellIDs = [Q{:,1}];
if isempty(Q) && isfield(Cells,'trackID')
trackIDs=[Cells.trackID];
else
trackIDs = [Q{:,1}];
end
cmdSql='SELECT COUNT(ROWID) FROM tblColors';
Q=fetch(conn,cmdSql);
nColors=Q{1};
......@@ -47,19 +49,19 @@ insertTracks = conn.handle.prepareStatement(cmd);
% make new track structs for our new cells
% just colors for now
% match database generated hull ids back to our cells we're insertings
for i=1:length(cellIDs)
for i=1:length(trackIDs)
idxColor = 1+round((nColors-1)*rand());
cellID = int32(cellIDs(i));
tid = int32(trackIDs(i));
% note -- new tracks get the cells id to start
% every cell initially solo on its track
insertTracks.setInt(1,cellID);
insertTracks.setInt(1,tid);
insertTracks.setInt(2,idxColor);
Write.tryUpdateDB(insertTracks);
end
commit(conn);
insertTracks.close();
conn.autoCommit='on';
trackIDs=cellIDs;
% finally update the trackIDs in the table to match cell ids for new cells
cmdSql=['UPDATE tblCells SET trackID=cellID WHERE trackID=-1;'];
......
......@@ -40,8 +40,11 @@ insertCells.close();
% now, query back the trackIDs -1 from that time point
cmdSql=['select cellID from tblCells WHERE trackID=-1;'];
Q=fetch(conn,cmdSql);
cellIDs = [Q{:,1}];
if isempty(Q) && isfield(Cells(1),'trackID')
cellIDs=[Cells.trackID];
else
cellIDs = [Q{:,1}];
end
% return value
trackIDs=cellIDs;
......
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