Skip to content
Snippets Groups Projects
Commit d5c79209 authored by Andrew Cohen's avatar Andrew Cohen
Browse files

added exportSegmentation to batch processing

parent a32472f8
No related branches found
No related tags found
No related merge requests found
......@@ -2,3 +2,4 @@
*.txt
*.mat
*.asv
ctc/importExport/generatedBats/*.bat
% exportAll.m
% ROOT='g:\leverjs\ctc2018_finalResults\';
ROOT='g:\leverjs\ctc2020_final';
ROOT='f:\leverjs\ctc2020_final';
gtPath='\\bioimage32.coe.drexel.edu\g\gRaw\ctc2020\';
outfolder='g:\leverjs\ctc2020_sw';
outfolder='f:\leverjs\ctc2020_sw';
flist=dir(fullfile(ROOT,'*\*challenge*.LEVER'));
for ff=1:length(flist)
......@@ -11,6 +11,7 @@ for ff=1:length(flist)
gtFile=findGT(strDB,gtPath);
fprintf(1,'%s (%s) \n',strDB,gtFile)
importExport(strDB,outfolder);
importExport(strDB,outfolder,gtFile);
exportSegmentation(strDB,outfolder);
end
\ No newline at end of file
......@@ -19,18 +19,24 @@ fprintf(1,'importExport elapsed time=%3.1f :: %s,%s\n',y,filename,outpath);
function export(filename,outpath)
[~,exp,~]=fileparts(filename);
exp=strrep(exp,'_training','');
tokens=regexp(exp,'(.+)_(\d\d)','tokens');
dsName=tokens{1}{1};
dsName=strrep(dsName,'_challenge','');
dsID=tokens{1}{2};
% strip off the _01 or _02 of the exp
if exp(end)=='1'
if strcmp(dsID,'01')
subdir='01_RES';
else
subdir='02_RES';
end
exp=exp(1:end-3);
outpath=fullfile(outpath,exp,'CSB',subdir);
if ~exist(outpath,'dir')
mkdir(outpath);
outpath=fullfile(outpath,dsName,'CSB',subdir);
if exist(outpath,'dir')
rmdir(outpath,'s');
end
mkdir(outpath);
fprintf(1,'exporting CSB data to folder %s\n',outpath);
conn = database(filename, '','', 'org.sqlite.JDBC', 'jdbc:sqlite:');
......
@echo off
REM processCSB
REM generates all segmentation results (not just ground truth subset) from
REM leverjs .LEVER files
REM usage : processBatch leverFile
REM assumes tif images are ../
REM generates lever .h5 images in ./temporaryImages
REM
if not exist %1 (
echo %1 -- lever file does not exist. IMPORTANT -- you must run the tracking benchmark before running the CSB output
exit /b
)
echo.
echo *** exporting CSB results
.\exportSegmentation %1 ..\
echo.
% generate processing table
leverRoot='.\leverData';
flist=dir(fullfile(leverRoot,'*.LEVER'));
leverRoot1='g:\leverjs\ctc2020\';
leverRoot2='f:\leverjs\ctc2020\';
% flist=[dir(fullfile(leverRoot1,'**\*challenge*.LEVER'));dir(fullfile(leverRoot2,'**\*challenge*.LEVER'))];
imageRoot='..\';
gtPath='\\bioimage32.coe.drexel.edu\g\gRaw\ctc2020\';
rgProcess=[];
rgp=[];
batOutFolder='./';
batOutFolder='./generatedBats';
if ~exist(batOutFolder,'dir')
mkdir(batOutFolder);
end
for ff=1:length(flist)
leverFile=fullfile(flist(ff).folder,flist(ff).name);
leverFile=fullfile('./leverData',flist(ff).name);
expname=flist(ff).name(1:end-length('_01.LEVER'));
expname=strrep(expname,'_challenge','');
expnumber=flist(ff).name(end-length('01.LEVER')+1:end-length('.LEVER'));
gtPath='';
imagePath=fullfile(imageRoot,expname,expnumber);
if ~exist(imagePath)
imagePath=fullfile(imageRoot,expname,expname,expnumber);
if ~exist(imagePath)
fprintf(2,'image data not found! imagePath=%s\n',imagePath);
end
end
if exist([imagePath '_GT'],'dir')
gtPath=[imagePath '_GT'];
gtPath=fullfile(gtPath,'TRA','man_track000.tif');
if ~exist(gtPath,'file')
fprintf(2,'ERROR - bad gtPath file does not exist\n');
gtFile=findGT(fullfile(flist(ff).folder,flist(ff).name),gtPath);
rp.leverFile=['"' leverFile '"'];
rp.imagePath=['"' fullfile('..',expname,expnumber) '"'];
if ~isempty(gtFile)
rp.gtPath=['"' fullfile('..',expname,[expnumber '_GT']) '"'];
else
rp.gtPath='';
end
if ~isempty(strfind(expname,'TRIF'))
rp.nProcs='2';
rp.gtPath=['"' fullfile('..',expname,[expnumber '_GT']) '"'];
else
rp.nProcs='';
end
rp.leverFile=leverFile;
rp.imagePath=imagePath;
rp.gtPath=gtPath;
rgProcess=[rgProcess,rp];
rgp=[ rgp; {leverFile,imagePath,gtPath}];
rgp=[ rgp; {rp.leverFile,rp.imagePath,rp.gtPath,rp.nProcs}];
outfile=fullfile(batOutFolder,[expname '_' expnumber '.bat']);
fid=fopen(outfile,'w');
if strcmp(gtPath,'')
fprintf(fid,'processBatch.bat "%s", "%s"\n',imagePath,leverFile);
else
fprintf(fid,'processBatch.bat "%s", "%s", "%s"\n',imagePath,leverFile,gtPath);
end
fprintf(fid,'processBatch.bat %s %s %s %s\n',rp.imagePath,rp.leverFile,rp.gtPath,rp.nProcs);
fclose(fid);
end
\ No newline at end of file
......@@ -82,7 +82,7 @@ if strcmp(dsID,'01')
else
subdir='02_RES';
end
% exp=exp(1:end-3);
outpath=fullfile(outpath,dsName,subdir);
if exist(outpath,'dir')
rmdir(outpath,'s');
......
......@@ -7,6 +7,7 @@ REM assumes tif images are ../
REM generates lever .h5 images in ./temporaryImages
REM
echo.
echo *** IMPORT processing %1 (tiffs), lever file=%2, groundTruth=%3 nProcessors=%4
.\ctcImportExport\importExport.exe %1 .\temporaryImages
echo *** batch segmentation starting
......@@ -15,6 +16,9 @@ echo *** resegAndTrack starting
.\node.exe .\leverjs\leverjs\resegAndTrackDataset.js %2 resegAll 1 "{}"
echo *** exporting results
.\ctcImportExport\importExport.exe %2 .\ %3
echo *** exporting CSB results
.\ctcImportExport\exportSegmentation %2 .\
echo.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment