|
Hello List,
I have used ImageJ for many simple tasks before, but I am not familiar with writing macros. I have recently been working on a project that involves measuring fluorescence intensities over the area of the nucleus. I was doing this by opening the DAPI image, using the Nucleus Counter plugin to define the nuclei as ROIs, then opening the corresponding (red) fluorescence image and using the ROI manager to measure the intensities based on the ROIs derived from the DAPI. I would then copy and paste the results into an excel file. This works fine, however it is extremely time-consuming. I am now trying to write a macro that would allow me to automate this process. I currently have the following:
run("Nucleus Counter", "smallest=10000 largest=400000 threshold=Current smooth=[Mean 3x3] subtract add");
selectWindow("Threshold");
selectWindow("Analysis");
roiManager("Measure");
dir = getDirectory("image");
name = getTitle;
index = lastIndexOf(name, ".");
if (index!=-1) name = substring(name, 0, index);
name = name + ".csv";
saveAs("Measurements", dir+name);
print(dir+name);
I have run this using the multiple image processor, and it somewhat works. The first problem is that I get error messages every time it tries to select Threshold or Analysis, but if I delete those lines, it appears to be measuring the binary image instead. Second, this macro uses the ROIs from an image on itself, meaning that the red channel ROIs are defined by the red channel and not the DAPI. Third, I would really like for all the results to be saved to a single file, not a separate file for each image.
I would greatly appreciate any help. Thank you very much!
|