I need to accomplish two things for a bunch of images, using a macro:
- Determining the average CIELAB value for each individual particle, detected with the “Analyze Particle” tool
- Determine the average CIELAB value for surrounding area (i.e. the whole image except the are inside the ROIs determined)
While the second task should be fairly simple, the first requires a bit of knowledge on the scripting language, which I’m unfortunately missing.
Determining the average colour manually is very simple via the Average Color-Plugin (Image → Color → Average Color). Is there any way to get this value within a macro? The macro recorder only shows
run("Average Color", "cielab");
Regarding the colour of each individual ROI:
I assume I would need to iterate through all the ROIs (similar to here: ROI Iterator Demo https://imagej.nih.gov/ij/plugins/roi-iterator/index.html) and ideally getting the average CIELAB-value of each ROI by the above mentioned Average Color-Plugin.
If this is the way to go, then I would try to put a macro together and maybe ask for correction/suggestions to get it finally running.
For the surrounding area I would make a selection from all ROIs using
roiManager("Show All with labels"); and
roiManager("Combine");, subsequently inverting it with
run("Make Inverse"); and then determine the average color from the selection.
Thanks already for all suggestions!