Trying to clean B&W noise and save histogram list for all images in a directory

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Trying to clean B&W noise and save histogram list for all images in a directory

njespi
Hello,

I have never written a function for imageJ before. I am trying to open each image, clean up some noise and then obtain the histogram values (ideally only for 0 and 255) and save that and the clean image to two separate folders. I have attempted to run the function below and for a while it was letting me know there were errors and I fixed them and now there is nothing happening when I try to run it.

Thanks for the help!

input="path to folder containing images"
output="path to a new folder for the histogram results"
list=getFileList(input);
for (i = 0; i < list.length; i++);
        function hists(input, output, list[i]) {
open(input+list[i]);
name=getTitle();
run("Despeckle");
run("Remove Outliers...", "radius=5 threshold=70 which=Dark");
setOption("BlackBackground", false);
run("Make Binary");
run("Histogram");
newname=name+"_h";
path=dir+"/histograms/"+newname
saveAs("Results", path);
close();
dirb="path to a new image folder"
pathb=dirb+name
saveAs("Jpeg", pathb);
}

setBatchMode (false);