|
Hi guys. I have a ROI which I want to fit as an ellipse and then, from the parameters of this ellipse, I want to create another identical ellipse. Let's assume that I can't just duplicate the ROI at this point. My macro goes like this:
roiManager("Select",0);
run("Fit Ellipse");
roiManager("Measure");
run("Set Measurements...", " centroid perimeter fit shape redirect=None decimal=3");
run("Measure");
xcm = getResult("X",0);
ycm = getResult("Y",0);
mjx = getResult("Major",0);
mnx = getResult("Minor",0);
alp = getResult("Angle",0);
x1 = xcm - 0.5*mjx*sin(alp);
x2 = xcm + 0.5*mjx*sin(alp);
y1 = ycm + 0.5*mjx*cos(alp);
y2 = ycm - 0.5*mjx*cos(alp);
makeEllipse(x1,y1,x2,y2,mnx/mjx);
The problem is that not always the new ellipse is identical to the first one. They look to be rotated by 90 degs.
Do you guys have any clue?
Thanks,
|