Unsharp mask: add "imagej" mode

Pierre Paleo requested to merge unsharp_imagej into 2022.3


This MR adds a new unsharp mask mode, compatible with the one of ImageJ.

To do

  • Add mode="imagej" for UnsharpMask
  • Add mode="imagej" for CudaUnsharpMask
  • Add mode="imagej" for OpenclUnsharpMask
  • 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


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

Merge request reports