0

All,

I am new to scripting with imageJ and have run into a problem I cannot get past. I have multiple files open at once and would like the code to cycle though them, do an analysis, create a new filtered image, save that image and close it along with the file the filtered image cam from. The script below does everything except selecting the window of the original image and then closing it. I keep getting unidentified identifier errors. Any help would be appreciated.

imgs = getList("image.titles");
j=nImages();
for (i = 0; i < j; i++) {
    string=getTitle();
    run("Bandpass Filter...", "filter_large=5000 filter_small=3 suppress=Vertical tolerance=5 autoscale saturate");
    makeRectangle(150, 200, 700, 900);
    run("Copy");
    newImage("Untitled", "RGB ramp", 600, 600, 1);
    run("Paste");
    run("Bandpass Filter...", "filter_large=5000 filter_small=2 suppress=Vertical tolerance=5 autoscale");
    saveAs("Jpeg", "C:/DATA/"+imgs[i]+".jpg");
    selectWindow("Untitled");
    close();
    //SelectWindow(\string\);//
    //SelectWindow("\string\"");//
    //SelectWindow("\string"\");//
    //SelectWindow(string);//
    //SelectWindow(imgs[i]);//
    close();
}
Rich Hamm
  • 11
  • 4
  • You should use selectImage(string); and it is recommended to use j=imgs.length; but be careful if you close images in the loop, because then the number of images decreases! – Herbie Jul 08 '23 at 00:41

0 Answers0