Commit db0ac7d4 authored by Andrew Cohen's avatar Andrew Cohen

serverHelper -- changed image override (lever.json) to same folder as .LEVER,...

serverHelper -- changed image override (lever.json) to same folder as .LEVER, createCells, createCells_3D respect existing trackID
parent 1e2f5fdd
......@@ -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);
......
......@@ -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