I am trying to apply a simple threshold to an image, with one wrinkle. I want the values over the threshold to remain the same, and values under to be 1. In matlab I would simply do the following…
In ops/imglib2 I can do this with a cursor and simple iteration, or a small custom op, and a map, but is there currently any way more concise? What do you think is the most concise way to do the above in ops??
The above use case, got me thinking about java 8 lambdas again. Last year I had written some ops to pass a java 8 lambda to the equation op (calibratedequation)
One of the road blocks was the fact that, at the time, we had not figured out the best way to represent calibrated equations.
I am thinking of re-doing that pull request, eliminate the calibration part, and just create a way to use lambdas in equations.
There could by x,y equations
ops.image().equation(image, (x, y) -> Math.pow(x, 2) + Math.pow(y, 2))
(For higher dimensionality, I don’t think you can use lambdas, as far as I know there is know there is no ternary java 8 operator.)
For intensity based equations… you could have something like…
ops.image().apply(image, i-> i<t?i:0);
Any thoughts?? Anything like this exist or underway already?? Where would be the best place to put the ‘intensity’ based equation,. to differentiate it from a ‘coordinates’ based equation??