Package qupath.opencv.tools
Class LocalNormalization
java.lang.Object
qupath.opencv.tools.LocalNormalization
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Helper class to store local normalization parameters.static enum
Local normalization type.static class
2D or 3D Gaussian scale. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
gaussianNormalize
(List<Mat> stack, LocalNormalization.LocalNormalizationType type, PixelCalibration cal, int border) Apply local normalization to a stack of Mats representing a z-stack.static void
gaussianNormalize2D
(Mat mat, double sigma, double sigmaVariance, int border) Apply local normalization to a 2D Mat.static void
gaussianNormalize3D
(List<Mat> stack, double sigmaX, double sigmaY, double sigmaZ, double varianceSigmaX, double varianceSigmaY, double varianceSigmaZ, int border) Apply 3D normalization.
-
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
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:
- A Gaussian filter is applied to a duplicate of the image
- The filtered image is subtracted from the original
- 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)
- The square root of the weighted variance image is taken to give a normalization image, approximating a local standard deviation)
- The subtracted image is divided by the value of the normalization image
- Parameters:
stack
- image z-stack, in which each element is a 2D (x,y) slicesigmaX
- horizontal Gaussian filter sigmasigmaY
- vertical Gaussian filter sigmasigmaZ
- z-dimension Gaussian filter sigmavarianceSigmaX
- horizontal Gaussian filter sigma for variance estimationvarianceSigmaY
- vertical Gaussian filter sigma for variance estimationvarianceSigmaZ
- z-dimension Gaussian filter sigma for variance estimationborder
- border padding method to use (see OpenCV for definitions)
-