Class LocalNormalization

java.lang.Object
qupath.opencv.tools.LocalNormalization

public class LocalNormalization extends Object
Methods to normalize the local image intensity within an image, to have (approximately) zero mean and unit variance. Calculations are made using Gaussian filters to give a smooth result.
Author:
Pete Bankhead
  • Constructor Details

    • LocalNormalization

      public LocalNormalization()
  • Method Details

    • gaussianNormalize

      public static void gaussianNormalize(List<Mat> stack, LocalNormalization.LocalNormalizationType type, PixelCalibration cal, int border)
      Apply local normalization to a stack of Mats representing a z-stack.
      Parameters:
      stack -
      type -
      cal -
      border -
    • gaussianNormalize2D

      public static void gaussianNormalize2D(Mat mat, double sigma, double sigmaVariance, int border)
      Apply local normalization to a 2D Mat.
      Parameters:
      mat -
      sigma -
      sigmaVariance -
      border -
    • gaussianNormalize3D

      public static void gaussianNormalize3D(List<Mat> stack, double sigmaX, double sigmaY, double sigmaZ, double varianceSigmaX, double varianceSigmaY, double varianceSigmaZ, int border)
      Apply 3D normalization.

      The algorithm works as follows:

      1. A Gaussian filter is applied to a duplicate of the image
      2. The filtered image is subtracted from the original
      3. A local weighted variance estimate image is generated from the original image (by squaring, Gaussian filtering, subtracting the square of the smoothed image previously generated)
      4. The square root of the weighted variance image is taken to give a normalization image, approximating a local standard deviation)
      5. The subtracted image is divided by the value of the normalization image
      The resulting image can be thought of as having a local mean of approximately zero and unit variance, although this is not exactly true; in practice there can be substantial differences. However, the approach aims to be simple, efficient and yield an image that does not introduce sharp discontinuities by is reliance on Gaussian filters.
      Parameters:
      stack - image z-stack, in which each element is a 2D (x,y) slice
      sigmaX - horizontal Gaussian filter sigma
      sigmaY - vertical Gaussian filter sigma
      sigmaZ - z-dimension Gaussian filter sigma
      varianceSigmaX - horizontal Gaussian filter sigma for variance estimation
      varianceSigmaY - vertical Gaussian filter sigma for variance estimation
      varianceSigmaZ - z-dimension Gaussian filter sigma for variance estimation
      border - border padding method to use (see OpenCV for definitions)