|
Hello,
I have been trying to manipulate my ROI in order to sort particles (aligned vs non-aligned) and only work with the aligned ones. I have written a Macro but I have not been able to complete it to make it work. I would really appreciate if someone could give me some help with this!
Below is my Macro code explaining what I want to do with the image.
//Open image
open("...");
//To measure particle number
run("8-bit");
run("Convert to Mask");
run("Watershed");
run("Create Selection");
setAutoThreshold("Default");
//run("Threshold...");
setAutoThreshold("Default");
//setThreshold(129, 255);
run("Convert to Mask");
setThreshold(255, 255);
run("Set Measurements...", "area mean fit integrated redirect=None decimal=3");
run("Analyze Particles...", " show=Outlines exclude clear summarize");
//To select only aligned particles
for (i=0; i<nResults; i++)
{
major = getResult("Major",i);
minor = getResult("Minor",i);
angle = getResult("Angle",i);
area = getResult("Area",i);
if (major > minor*1.5 && (angle<30||angle>150))
{
print ((i+1)+": area="+area+", angle="+angle); //Displays which ones are aligned
}
}
--------
At this point I just have a list of the particles I want to work with (aligned ones). How can I modify the Macro to make the particles in the list only to be my new ROI?
e.g.
If I have 20 particles total but only 7 are aligned, how can I select only those 7 particles for further manipulation (edit>selection>enlarge: x) and then measure those 7 particles only?
I am new with this software and I would really appreciate some help!
Thanks!
|