Hi,
Post by Juan FranciscoI try to get a plot along a circular profile over an image, however I
just can do a plot when a line or rectangular selection is performe with
ImageJ Pls, anyone knows how to get a circular profile with ImahgeJ
If you happen to have Fiji installed, just open the script editor with
File>New>Script, select Beanshell as language from the Language menu, and
paste and run this code:
-- snip --
import ij.IJ;
import ij.ImagePlus;
import ij.WindowManager;
import ij.gui.PolygonRoi;
import ij.gui.Roi;
import java.awt.Rectangle;
ImagePlus image = IJ.getImage();
if (image != null) {
Rectangle rect = image.getRoi().getBounds();
float r1 = rect.width / 2.0f;
float r2 = rect.height / 2.0f;
float x = rect.x + r1;
float y = rect.y + r2;
int nPoints = (int)(Math.PI * (r1 + r2) / 2);
int[] xPoints = new int[nPoints], yPoints = new int[nPoints];
for (int i = 0; i < nPoints; i++) {
xPoints[i] = (int)Math.round(x + r1 * Math.cos(i * 2 * Math.PI / nPoints));
yPoints[i] = (int)Math.round(y + r2 * Math.sin(i * 2 * Math.PI / nPoints));
}
image.setRoi(new PolygonRoi(xPoints, yPoints, nPoints, PolygonRoi.POLYLINE));
image.updateAndDraw();
}
-- snap --
After that, the oval selection is a segmented line selection, and you can
run the line profile on it.
Note: this is not super-precise, as it will round the coordinates to the
next integral numbers.
Note also that the oval ROIs do not respect the line width from
Edit>Options>Line Width..., but the segmented line does.
Ciao,
Johannes