Thank you, @anon96376101, for demonstrating the power of the macro language!

Still, I was intrigued by your initial suggestion to use a projection to solve the issue, and I believe you can still do this on the given sample image by:

- projecting along y with a
*Sum* projection, then
- projecting along x with a
*Maximum* projection.

The result should be a single sample value that contains the maximum vertical caliper found at any given position in x (when taking into account that the sum of pixels needs to be divided by 255 to account to the 8-bit nature of binary images in ImageJ).

So I couldn’t resist and wrote this little Groovy script using ImageJ Ops to replicate the analysis of your macro (you can run it from the script editor after choosing *Language > Groovy*):

```
#@ Dataset input
#@ OpService ops
sumOp = ops.op("sum", input)
maxOp = ops.op("max", input)
// Create SUM projection along Y axis
sumProjection = ops.run("img", [input.dimension(0)])
ops.run("project", sumProjection, input, sumOp, 1)
// Add new dimension to allow second projection
sumProjection = ops.run("addDimensionView", sumProjection, 0, 0)
// Create MAX projection along X axis
maxProjection = ops.run("img", [1])
ops.run("project", maxProjection, sumProjection, maxOp, 0)
// Get value (divide by 255 to account for 8-bit binary image)
println maxProjection.firstElement().get() / 255
```

(A nice side effect of this is that you can also calculate the *mean* vertical caliper or its *standard deviation* by changing to a different op for the second projection step.)

**EDIT**: But coming back to the original question: @Matt_RTHA depending on your task, you might also want consider measuring Feret’s (min and max) diameter on your irregular objects, except if you have reasons to have the strictly vertical orientation as a constraint.