问题
I am measuring vessel area in different annual rings (trees; dendrochronology). I captured high quality pictures with approximatelly 20 annual rings. Each annual ring is my ROI.
I croped my image into 20 smaller images, each annual ring is one image. I open each image, I treshold it and use function: analyze particles.
However, it would be much less time consuming, if I could use my original image with 20 rings; I would separate each annual ring by defining ROI and I would label each ROI by 2012, 2011, 2010... After I would treshold the image and use function analyze particles. In my result table I would get area of vessel lumen for each vessel, separately for each annual ring.
The question is: is it possible to use ROI Manager and to set more ROIs and to analyze particles in them.
Thank you very much for your time.
Jernej
回答1:
Use the ROI Manager to store your ROIs. Then use the ImageJ macro language and its built-in roiManager functions to loop over all ROIs. Record your analysis via Plugins > Macros > Record... to get the relevant macro commands.
Here's an example:
id = getImageID();
setAutoThreshold("Default");
for (i=0 ; i<roiManager("count"); i++) {
selectImage(id);
roiManager("select", i);
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks clear");
}
To answer the additional questions you posted in another answer:
You get the name of the current ROI using
Roi.getName()
that you can use to name the results file:current = Roi.getName(); saveAs("Results", "/path/to/results/Results_" + current + ".txt");
Alternatively, you can include the current ROI name in each line of your results by checking Display label in the Analyze > Set Measurements... dialog, resulting in a macro command similar to this:
run("Set Measurements...", "area display redirect=None decimal=3");
Please see the macro language documentation and the ImageJ mailing list archives before posting any new questions related to ImageJ macros.
来源:https://stackoverflow.com/questions/21292384/imagej-analyze-particles-in-different-roi-at-the-same-time