2

After I few hours of intensive search, I need to ask you.

So, I few days ago I was provided with macro that effectively creates ROIs based on radius and function (Maximum). Link

My starting point is the following image:

https://dl.dropboxusercontent.com/u/65873264/Image.jpg

The problem is: I need to have ROIs sorted by sequence; (from left to right on an image). So I could easily rename them with macro and assign appropriate year. As you can see on provided image with link; scanning while creating ROIs goes from up to down, therefore the tallest ROI gets number 1.

So I would like to rename each ROI based on X coordinate (ROI Manager, List). I really can’t figure out how to call x coordinate… And here I need your help. Later I will sort ROIs and rename them again (years by sequence).

Alternatively, could I modify Analyze particle function in order to change the scanning direction?

I am beginner in programming, very motivated, but I need help from experienced fellas. Thank you.

Community
  • 1
  • 1
JerryTheForester
  • 456
  • 1
  • 9
  • 26

1 Answers1

3

So, here is the solution of problem described in my question:

run("Set Measurements...", "  centroid redirect=None decimal=9");
for (i=0 ; i<roiManager("count"); i++) {
    roiManager("select", i);
    roiManager("Measure");
    x = getResult("X",0);
    roiManager("Rename", x);
    run("Clear Results");
}

roiManager("Sort");
selectWindow("Results");
run("Close");
NelsonGon
  • 13,015
  • 7
  • 27
  • 57
JerryTheForester
  • 456
  • 1
  • 9
  • 26