|
Hi - I'm new to writing macros so any help would be appreciated. I'm aiming to firstly correct the background and uneven illumination in fluorescent images. I then want to identify cells and measure the red and green fluorescence intensity of each cell. I've got this working well for an individual image, but I'd like to automatically process all ~20 images in each folder (named 1.tif-n.tif). This is my current macro - the same fluorescent and dark images are used to correct all interest images. Thanks in advance.
//open fluorescent images
waitForUser("Open green fluorescent image.");
run("32-bit");
run("Duplicate...", "duplicate range=1");
rename("GreenF.tif");
selectImage("Green.tif");
run("Close");
waitForUser("Open red fluorescent image.");
run("32-bit");
run("Duplicate...", "duplicate range=2");
rename("RedF.tif");
selectImage("Red.tif");
run("Close");
//open dark images
waitForUser("Open closed shutter image.");
run("32-bit");
run("Duplicate...", "duplicate range=1");
rename("GreenD.tif");
run("Duplicate...", "duplicate range=2");
rename("RedD.tif");
selectImage("Blank.tif");
run("Close");
//open first image for correction
waitForUser("Open first image.");
run("32-bit");
run("Duplicate...", "duplicate range=1");
rename("1-G.tif");
selectWindow("1.tif");
run("Duplicate...", "duplicate range=2");
rename("1-R.tif");
selectWindow("1.tif");
close();
//run correction image 1
imageCalculator("Subtract create", "1-G.tif","GreenD.tif");
selectWindow("Result of 1-G.tif");
rename("1G-GD");
imageCalculator("Subtract create", "GreenF.tif","GreenD.tif");
rename("1F-GD");
imageCalculator("Subtract create", "1-R.tif","RedD.tif");
rename("1R-RD");
imageCalculator("Subtract create", "RedF.tif","RedD.tif");
rename("1F-RD");
imageCalculator("Divide create", "1G-GD","GF-GD");
rename("1GreenCor");
imageCalculator("Divide create", "1R-RD","RF-RD");
rename("1RedCor");
selectImage("1-G.tif")
run("Close")
selectImage("1-R.tif")
run("Close")
selectImage("GreenD.tif")
run("Close")
selectImage("GreenF.tif")
run("Close")
selectImage("1G-GD")
run("Close")
selectImage("GF-GD")
run("Close")
selectImage("RedD.tif")
run("Close")
selectImage("RedF.tif")
run("Close")
selectImage("1R-RD")
run("Close")
selectImage("RF-RD")
run("Close")
//identify cells image 1
run("Duplicate...", "title=1GreenCor-1");
run("Make Binary");
//run("Threshold...");
setAutoThreshold("Default dark");
run("Convert to Mask");
run("Create Mask");
run("Watershed");
waitForUser("Press OK to continue");
//Draw to separate cells
run("Analyze Particles...", "size=100-2500 circularity=0.00-1.00 show=Nothing clear add");
roiManager("Show All with labels");
roiManager("Show All");
//Measure cell intensity
selectImage("1GreenCor");
roiManager("Measure");
selectImage("1RedCor");
roiManager("Measure");
waitForUser("Save results file")
|