To start off with, I'm a biochemist with pretty much no experience with any kind of coding so this is probably why struggling. I have recently been trying to automate my image analysis process on FIJI/ImageJ and I've hit a wall. My current code is as below:
waitForUser("Are you ready to start?")
open("C:/Users/laure/OneDrive/Documents/MSc Molecular Biology & Biotechnology/Masters Project - Dombrowski Lab/Project Data/LD005 CX5/CellHealthProfiling.V4_03-06-20_09;46;02/CEM-133432_200229080001/CEM-133432_200229080001_B02f00d0.C01");
rename("CEM-133432_200229080001_B02f00d0.C01 - Well B02, Field #00") //for automation I kept the same image name
// define variables for each window
x="CEM-133432_200229080001_B02f00d0.C01 - Well B02, Field #00" //picture name
y="c:1/3 - Well B02, Field #00" //DAPI
a="c:2/3 - Well B02, Field #00" //Olig2
b="c:3/3 - Well B02, Field #00" //MBP
c="Result of c:1/3 - Well B02, Field #00" //DAPI, Olig2 overlap
d="Result of Result of c:1/3 - Well B02, Field #00" //DAPI, Olig2, MBP
e="Drawing of c:1/3 - Well B02, Field #00" // draws all counted cells with numbers (excludes too big/small particles)
f="Drawing of c:2/3 - Well B02, Field #00" // same for Olig2
g="Drawing of c:3/3 - Well B02, Field #00" //same for MBP
h="Drawing of Result of c:1/3 - Well B02, Field #00" // same for DAPI, Olig2
i="Drawing of Result of Result of c:1/3 - Well B02, Field #00" // same for DAPI, Olig2, MBP
//DAPI
selectWindow(x);
run("Stack to Images");
selectWindow(y);
run("8-bit");
setThreshold(45, 255); //was 45 in windows
run("Convert to Mask"); //converts everything between 45 and 255 to a mask for further analysis
//--> binary image: each pixel can only have one of two values to to indicate whether it is inside the threshold or not!
//--> black: inside threshold, white: outside threshold
//analyze particles feature
run("Analyze Particles...", "size=30-350 show=Outlines clear summarize add");
//OLIG2
selectWindow(a);
run("8-bit");
setThreshold(25, 255); //was 80 in windows
run("Convert to Mask");
//analyze particles feature
run("Analyze Particles...", "size=30-250 show=Outlines clear summarize add");
//MBP
selectWindow(b);
run("8-bit");
setThreshold(52, 255); //was 150 in Windows
run("Convert to Mask");
//analyze particles feature
run("Analyze Particles...", "size=30.00-250.0 show=Outlines clear summarize add");
//measure overlay DAPI + Olig2
imageCalculator("AND create", y, a); //overlay DAPI and Olig2
//(other options are: "add","subtract","multiply","divide", "and", "or", "xor", "min", "max", "average", "difference" or "copy")
selectWindow(c);
run("Analyze Particles...", "size=30-250 show=Outlines clear summarize add");
//measure overlay DAPI + Olig2 + MBP
imageCalculator("AND create", c, b); //overlay DAPI, Olig2 and MBP
selectWindow(d);
run("Analyze Particles...", "size=30-250 show=Outlines clear summarize add");
close(y);
close(a);
close(b);
close(c);
close(d);
close(e);
close(f);
close(g);
close(h);
close(i);
This macro works but it will only analyse one stack (three images individually analysed and then layered as a composite to quantify any overlap of each of the signals at each wavelength), whereas I'm trying to loop it to do ten "stacks" at a time and feed me back the information but when I try to do this, the macro gets stuck on the file name e.g. CEM-133432_200229080001_B02f00d0.C01, which is one of three , the other two being CEM-133432_200229080001_B02f00d1.C01, CEM-133432_200229080001_B02f00d2.C01 . The next stack in the series would then be CEM-133432_200229080001_B02f01d0.C01,CEM-133432_200229080001_B02f01d1.C01 & CEM-133432_200229080001_B02f01d2.C01 and so on.
For reference the images are from a 96 well plate, the CX5 microscope takes 25 stacks of images per well, I'm aiming to analyse ten stacks to then average out the double and triple positive signals per well. When I try looping it just says it doesn't recognise the file name.
Any solutions or suggestions would be greatly appreciated