Login  Register

Saving threshold values using macro

Posted by jpdustin on Jun 22, 2017; 5:54pm
URL: http://imagej.273.s1.nabble.com/Saving-threshold-values-using-macro-tp5018951.html

I have a macro for analyzing images and would like to add something to save threshold values for each image. Is this possible and does anyone know how to do it? Below is the entire macro I use:

imageTitle=getTitle()
dir=getInfo("image.directory");

run("RGB Split");

selectWindow(imageTitle+" (green)")
if (isOpen(imageTitle+" (red)"   )  ) {
     close(imageTitle+" (red)" );
     }

if (isOpen(imageTitle+" (blue)"   )  ) {
     close(imageTitle+" (blue)");
     }

if (isOpen(imageTitle+" (green)"   )  ) {
     run("Select All");
     run("Copy");
     newImage(imageTitle+" Threshold", "8-bit black", 1360, 1024, 1);
     run("Paste");
     run("Subtract Background...", "rolling=5");
     }

//run("Threshold...");
setThreshold(51,255);

waitForUser("Confirm Threshold Value and Select Apply");

run("Watershed");
run("Analyze Particles...", "size=12-100 show=Outlines display clear summarize add");
roiManager("Show None");
roiManager("Show None");

selectWindow(imageTitle+" Threshold");
close();

saveAs("Results", dir+ imageTitle+"_Counts.csv");


Thanks,
JP

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html