Here is some code to start with:

First a function to be used in the macro

```
function makeLineAngle(x, y, length, angle)
{ // line from x,y to point at length and angle from x,y
// angle in degrees, 12 AM = 0, 3 PM = 90 etc...360
angleRadian = angle * PI / 180;
dX = round(cos(angleRadian) * length); dY = round(sin(angleRadian) * length);
makeLine(x,y,x+dY,y-dX); // startposition = x,y ; endposition = x+dY,y+dX
}
macro "Test [t]" {
//Point your mouse to the center of the circles and get the x,y coordinates
startAngle = 10; endAngle=50;
xSectorInnerArray = newArray(endAngle-startAngle+1); ySectorInnerArray = newArray(endAngle-startAngle+1);
x=500; y=500; // use your own x,y values of center
innerRadius = 50; outerRadius=88;
makeOval(x-innerRadius, y-innerRadius, innerRadius*2, innerRadius*2);
// loop that make a line from center at different angles
for (angle=10;angle<=50;angle++) {
// make line from central point and put in Array
a = 1; // counter for all angles in Array
makeLineAngle(x, y, innerRadius+5, angle); // +5 to make it longer then the radius of circle
run("Interpolate", "interval=1.0"); // interpolate to get more points
getSelectionCoordinates(xRoiLine, yRoiLine); // put points in Array
// first make inner circle
makeOval(x-innerRadius, y-innerRadius, innerRadius*2, innerRadius*2);
// loop
for(i=1;i<xRoiLine.length;i++) {
if (Roi.contains(xRoiLine[i], yRoiLine[i]) != Roi.contains(xRoiLine[i-1], yRoiLine[i-1])){
// get the average of two points on the lineArray that are just inside and outside the innerCircle
xInner=(xRoiLine[i]+xRoiLine[i-1])/2;
yInner=(yRoiLine[i]+yRoiLine[i-1])/2;
i=xRoiLine.length; //the point has been found so exit the loop
xSectorInnerArray[a-1]=xInner; ySectorInnerArray[a-1]=yInner;
print("a,xInner,yInner",a,xInner,yInner);
a=a+1; // next angle
}
}
}
}
```

- extend the macro by also collecting points from the outer circle section in an other array
- reverse only the x and y Arrays for inner circle with this function: Array.reverse(array)
- combine the inner and outer circle array: xSectorArray = Array.concat(xSectorOuterArray,xSectorInnerArray);
- make ROI of sector: makeSelection(“polygon”,xSectorArray ,ySectorArray );
- look for more ImageJ functions at https://imagej.nih.gov/ij/developer/macro/functions.html

Success!

Peter