Commit 2046b1f8 authored by ac32's avatar ac32

changed importExport to use ljsFetch (2019b), added eval1

parent 21b4452c
......@@ -113,14 +113,14 @@ lbep=[];
for i=1:length(tids)
label=tids(i);
cmd=['select min(time),max(time) from tblCells where trackID=' num2str(tids(i))];
q=fetch(conn,cmd);
if isempty(q)
q=ljsFetch(conn,cmd);
if isempty(q) || 0==size(q,1)
continue
end
tBegin=q{1};
tEnd=q{2};
if strcmp(tBegin,'null') || strcmp(tEnd,'null')
if isempty(tBegin) || isempty(tEnd) || strcmp(tBegin,'null') || strcmp(tEnd,'null')
continue
end
% find our parent
......@@ -128,14 +128,14 @@ for i=1:length(tids)
cmd=['select cellID,trackID,time from tblCells inner join tblFamilies on '...
' cellID=cellID_parent where (cellID_child1=' num2str(tids(i)) ...
' or cellID_child2=' num2str(tids(i)) ') and cellID_child2 is not null'];
q=fetch(conn,cmd);
if isempty(q)
q=ljsFetch(conn,cmd);
if isempty(q) || size(q,1)==0
parent=0;
else
parent=q{2};
cmd=['select max(time) from tblCells where trackID=' num2str(parent)];
q=fetch(conn,cmd);
if ~isempty(q)
q=ljsFetch(conn,cmd);
if ~isempty(q) || 0==size(q,1)
if q{1}>tBegin
fprintf(2,'found bad mitosis -- skipping\n');
parent=0;
......@@ -147,8 +147,8 @@ for i=1:length(tids)
cmd=['select cellID,trackID,time from tblCells inner join tblFamilies on '...
' (cellID=cellID_child2 or cellID=cellID_child1) AND cellID_child2 is not null where cellID_parent IN '...
' (select cellID from tblCells where trackID=' num2str(tids(i)) ')'];
q=fetch(conn,cmd);
if isempty(q)
q=ljsFetch(conn,cmd);
if isempty(q) || 0==size(q,1)
childIDs=[0,0];
elseif 2==size(q,1)
childIDs=[q{1,1},q{2,1}];
......@@ -195,7 +195,7 @@ for t=1:CONSTANTS.imageData.NumberOfFrames
% splits via the tblEnsemble) covering up other segmentations
cmd=['select cellID,trackID from tblCells where time=' num2str(t)...
' and trackID IN ' tidString 'order by segCC asc'];
Q=fetch(conn,cmd);
Q=ljsFetch(conn,cmd);
ctID=cell2mat(Q);
im=zeros(szImage);
......@@ -240,7 +240,7 @@ end
for i=1:length(idsMissing)
% get the centroids
cmd=['select time,centroid from tblCells where trackID=' num2str(idsMissing(i))];
q=fetch(conn,cmd);
q=ljsFetch(conn,cmd);
trackTime=cell2mat(q(:,1));
cx=cellfun(@jsondecode,q(:,2),'uniformoutput',false);
idx0=find(trackTime==t-1);
......
function res=ctcEval1(strDB)
gtPath='/g/gRaw/ctc2020/';
evalFolder='/f/ctcEval';
[~,targetName,~]=fileparts(strDB);
thisFile=mfilename('fullpath');
[thisFolder,~,~]=fileparts(thisFile);
path(path,fullfile(thisFolder,'..','ctc/importExport'));
outfolder=fullfile(evalFolder,'eval');
% results file
strResults=fullfile(evalFolder,[targetName '_res.txt']);
if exist(strResults,'file')
res=readtable(strResults,'delimiter',',');
else
res=[];
end
fname=strDB;
fname=strrep(fname,'_training','');
tokens=regexp(targetName,'(.*)_training_(\d\d)','tokens');
dsName=tokens{1}{1};
dsID=tokens{1}{2};
importExport(strDB,outfolder, [])
% copy over the ground truth
gtSource=fullfile(gtPath,['2d_' dsName '_training'],dsName,[dsID '_GT']);
if ~exist(gtSource,'dir')
gtSource=fullfile(gtPath,['3d_' dsName '_training'],dsName,[dsID '_GT']);
end
if ~exist(gtSource,'dir')
fprintf(2,'ground truth not found, skipping : %s\n',gtSource);
end
copyfile(gtSource,fullfile(outfolder,targetName,[dsID '_GT']),'f');
if ispc
TRA='TRAMeaseure.exe';
SEG='SEGMeasure.exe';
DET='DETMeasure.exe';
exePath=fullfile('./','EvaluationSoftware/Win');
else
TRA='TRAMeasure';
SEG='SEGMeasure';
DET='DETMeasure';
exePath=fullfile('./','EvaluationSoftware/Linux');
end
system([fullfile(exePath,TRA) ' ' ...
fullfile(outfolder,targetName) ' ' dsID ' > score.txt']);
system([fullfile(exePath,SEG) ' ' ...
fullfile(outfolder,targetName) ' ' dsID ' >> score.txt']);
system([fullfile(exePath,DET) ' ' ...
fullfile(outfolder,targetName) ' ' dsID ' >> score.txt']);
fid=fopen('score.txt');
scoreTxt=fscanf(fid,'%s');
fclose(fid);
sx=regexp(scoreTxt,'...measure:(\d\.\d+)','tokens');
sx=cellfun(@str2double,sx);
if length(sx)<3 , sx(3)=0; end
fprintf(1,'TRAmeasure:%f, SEGmeasure:%f, DETmeasure:%f\n',sx(1),sx(2),sx(3));
% get the algorithm settings
[conn,CONSTANTS]=openDB(strDB);
segParams=Read.getSegmentationParams(conn);
if isempty(res)
res=table(sx,{jsonencode(segParams)},'VariableNames',{'TRA_SEG_DET','segParams'});
else
res=[res;sx,{jsonencode(segParams)}];
end
close(conn);
writetable(res,strResults);
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