Dear @kephale thank your for your script, it helped me to continue with mine.
However, I couldn't solve the problem by the moment.
Below you will find my script.
I define the Feret Angle as a varible (alpha).
Then, I rotate the image, being: angle = alpha. However, it doesn't recognise the Feret Angle value of the object, and it rotates for a different angle value.
Thank you very much!
run("Convert to Mask");
run("Analyze Particles...", "display");
var alpha = getResult("FeretAngle");
run("Rotate... ", "rotate angle = alpha grid=1 interpolation=None fill enlarge");