Unsharp mask: add "imagej" mode
About
This MR adds a new unsharp mask mode, compatible with the one of ImageJ.
To do
-
Add mode="imagej"
forUnsharpMask
-
Add mode="imagej"
forCudaUnsharpMask
-
Add mode="imagej"
forOpenclUnsharpMask
-
Unit tests -
Integrate in pipeline -
(Bonus) Fix app.reconstruct entry point -
(Bonus) Fix NXProcessWriter with histogram: don't make histogram the default view -
End-to-end reconstruction test
Notes
Imagej Unsharp Mask plugin is available here:
/** Unsharp Mask filtering of a float image. 'fp' must have a valid snapshot. */
public void sharpenFloat(FloatProcessor fp, double sigma, float weight) {
if (gb == null) gb = new GaussianBlur();
gb.blurGaussian(fp, sigma, sigma, 0.01);
if (Thread.currentThread().isInterrupted()) return;
float[] pixels = (float[])fp.getPixels();
float[] snapshotPixels = (float[])fp.getSnapshotPixels();
int width = fp.getWidth();
Rectangle roi = fp.getRoi();
for (int y=roi.y; y<roi.y+roi.height; y++)
for (int x=roi.x, p=width*y+x; x<roi.x+roi.width; x++,p++)
pixels[p] = (snapshotPixels[p] - weight*pixels[p])/(1f - weight);
}
Edited by Pierre Paleo