Slow Extracting of Series from Large LIF Files
Posted: Tue Apr 11, 2017 10:33 pm
Hi All,
I have some large LIF files (100gb and up) that contain 100-1000 series in them of 100MB each or so. I have a bit of code written for ImageJ that extracts each in turn and saves it. The only issue is it is very very slow. It takes about 2 minutes to open and save each series. The main delay seems to be BioFormats analysing the LIF file each time (i assume building the index of the series in it) before it can open one to save it. Is there a away around this?
Thanks
The code is here
I have some large LIF files (100gb and up) that contain 100-1000 series in them of 100MB each or so. I have a bit of code written for ImageJ that extracts each in turn and saves it. The only issue is it is very very slow. It takes about 2 minutes to open and save each series. The main delay seems to be BioFormats analysing the LIF file each time (i assume building the index of the series in it) before it can open one to save it. Is there a away around this?
Thanks
The code is here
- Code: Select all
setBatchMode(true);
fs=File.separator;
pathFile=File.openDialog("Select LIF File to Process");
savePath=getDirectory("Select/Create Output Directory");
run("Bio-Formats Macro Extensions");
Ext.setId(pathFile);
Ext.getSeriesCount(seriesCount);
for(l=43;l<seriesCount;l++){
Ext.setSeries(l);
run("Bio-Formats Importer", "open=["+pathFile+"] autoscale color_mode=Default view=Hyperstack stack_order=XYCZT series_"+(l));
nameStore=getTitle();
getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second, msec);
print(hour+":"+minute+":"+second+" - Processing Series "+l+" of "+seriesCount);
//imageName=getInfo("image.filename");
currentCount=l;
currentCount=d2s(currentCount,0);
currentLength=lengthOf(currentCount);
if(currentLength==1){
saveName="000"+currentCount;
}
if(currentLength==2){
saveName="00"+currentCount;
}
if(currentLength==3){
saveName="0"+currentCount;
}
if(currentLength==4){
saveName=currentCount;
}
saveAs("Tiff", savePath+saveName+".tif");
run("Close All");
wait(500);
call("java.lang.System.gc");
wait(500);
}
print("DONE!");