Save XY coordinates batch filenames
Posted by Justin Walker-3 on Feb 19, 2008; 9:23pm
URL: http://imagej.273.s1.nabble.com/Save-XY-coordinates-batch-filenames-tp3697141.html
I have a short macro that I want to convert to batch mode, but I'm having a bit of trouble with the "Save XY Coordinates" command - I would like to have it save the results of this command as the same filename and path as the image itself, but replace the image's extension (.tif) with .txt (so that after I run I will have 1 text file for each image containing the XY data for that image.)
Does anyone know how I'd go about doing that? I've attached my macro if it helps you to look at what I'm doing - I've attempted to simply use the getinfo("title") command to get the image's filename and append .txt to it (so you'd get myimage.tif.txt, which is fine as well), but I'm clearly not implementing it correctly.
Your help is greatly appreciated;
Justin Walker, Ph. D. Student
University of Maryland
macro "Pendant Drop Analysis" {
dir = getDirectory("Choose a Directory ");
list = getFileList(dir);
setBatchMode(true);
for (i=0; i<list.length; i++) {
path = dir+list[i];
showProgress(i, list.length);
if (!endsWith(path,"/")) open(path);
if (nImages>=1) {
run("8-bit");
setAutoThreshold();
//run("Threshold...");
setAutoThreshold();
setThreshold(0, 121);
run("Convert to Mask");
run("Fill Holes");
name = getInfo("title");
run("Save XY Coordinates...", "save=dir[name.txt]");
close();
}
}
}