Hello,

I am working on a java plugin that returns a series of ROI lines parallel to a manually drawn line and should return the mean and mode pixel values for each of those lines. Right now I can generate the lines and add the lines to the ROI manager. I could either click measure and copy the results table, or get each pixel value along the line and calculate the average in the code, but it would be nice if there was an existing function to do this.

to show some code: I manually draw one line parallel to a feature of interest and then programmatically draw two guidelines perpendicular to this initial line, one at each end (guide1 and guide2). I then make these lines into polygons and use the points in the polygon guidelines as the endpoints for the new lines that I currently add to the ROI manager. The distance along one of the guidelines is reported in nm:

```
Roi guide1 = new PolygonRoi(guide1_iniX, guide1_iniY, 3, Roi.POLYGON);
Roi guide2 = new PolygonRoi(guide2_iniX, guide2_iniY, 3, Roi.POLYGON);
FloatPolygon guide1_f = guide1.getInterpolatedPolygon();
FloatPolygon guide2_f = guide2.getInterpolatedPolygon();
Point[] guide1_p = new Point[guide1_f.npoints];
Point[] guide2_p = new Point[guide2_f.npoints];
if (guide1_p.length == guide2_p.length) {
for (int i=0; i<guide1_f.npoints; i++) {
guide1_p[i] = new Point((int)Math.round(guide1_f.xpoints[i]), (int)Math.round(guide1_f.ypoints[i]));
guide2_p[i] = new Point((int)Math.round(guide2_f.xpoints[i]), (int)Math.round(guide2_f.ypoints[i]));
}
for (int i=0; i<guide1_f.npoints; i++) {
int delX = guide1_p[i].x - guide1_p[0].x;
int delY = guide1_p[i].y - guide1_p[0].y;
double distancePxls = Math.sqrt(Math.pow(delX,2)+Math.pow(delY,2));
double distance_nm = distancePxls/scaling;
Roi tempLine = new Line(guide1_p[i].x, guide1_p[i].y, guide2_p[i].x, guide2_p[i].y);
manager.addRoi(tempLine);
IJ.log(String.valueOf(distance_nm));
}
}
else {
IJ.showMessage("number of guideline points did not match");
}
```

is there a function I could call after making tempLine to get the pixel value mean and mode?

Itâ€™s my first time trying to write a plugin and I have almost no experience with java, so any general corrections or suggestions for code posted above are also appreciated!