|
Dear all I'm trying to write a macro that open all the movies (*.dv) inside a file and then substract the background of two channels. This is the code that I have till now but it seems that the command save does not work and also does not make any substraction, just open the movies and split the channels:
dir1 = getDirectory("C:\Users\p250572\Desktop\Santi\training");
list = getFileList(dir1);
dir2 = dir1+"analysed"+File.separator;
File.makeDirectory(dir2);
for (i=0; i<list.length; i++)
{
if (File.isDirectory(dir1+list[i])){}
else{
path = dir1+list[i];
if (endsWith(path, ".db")){}
else{
open(path);
if (bitDepth!=24){}
else {
setBatchMode(true);
title = File.nameWithoutExtension ;
run("Split Channels");
close();
selectWindow(title);
run("Subtract Background...", "rolling=50");
saveAs("Tiff", dir2+title+"d0.tif");
saveAs("Tiff", dir2+title+"d1.tif");
close();
saveAs("Tiff", dir2+title+"d2.tif");
close();
setBatchMode(false);
}
}
}
}
Any piece of advice will be appreciate!
Best wishes;
|