Class AlgorithmLaplacian

  • All Implemented Interfaces:
    AlgorithmInterface, java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmLaplacian
    extends AlgorithmBase
    implements AlgorithmInterface
    Calculates the Laplacian of the gaussian of an image at a scale defined by the user.
    Version:
    0.1 Feb 11, 1998
    Author:
    Matthew J. McAuliffe, Ph.D. Reference for nonlinear Laplacian operator: "A Nonlinear Laplace Operator as Edge Detector in Noisy Edges" by Lucas J. Van Vliet and Ian T. Young, Computer Vision, Graphics, and Image Processing, Vol. 45, 1989, pp. 167-195.
    • Field Detail

      • amplificationFactor

        private float amplificationFactor
        An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
      • edgeImage

        private boolean edgeImage
        If true an edge map image should be produced.
      • entireImage

        private boolean entireImage
        Flag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas.
      • nonLinear

        private boolean nonLinear
      • kernelSize

        private int kernelSize
      • GxxData

        private float[] GxxData
        Storage location of the second derivative of the Gaussian in the X direction.
      • GyyData

        private float[] GyyData
        Storage location of the second derivative of the Gaussian in the Y direction.
      • GzzData

        private float[] GzzData
        Storage location of the second derivative of the Gaussian in the Z direction.
      • kExtents

        private int[] kExtents
        Dimensionality of the kernel.
      • loThres

        private float loThres
        Lower and upper threshold values used in the generation of the edge map.
      • hiThres

        private float hiThres
        Lower and upper threshold values used in the generation of the edge map.
      • sigmas

        private float[] sigmas
        Standard deviations of the gaussian used to calculate the kernels.
      • zXMask

        private ModelImage zXMask
        Mask(unsigned byte) of the zero-crossings of the Laplacian of the gaussian. Non-zero value indicates edge. Zero in the mask image is background.
      • outputBufferX

        private float[] outputBufferX
      • outputBufferY

        private float[] outputBufferY
      • outputBufferZ

        private float[] outputBufferZ
      • operationType

        private int operationType
    • Constructor Detail

      • AlgorithmLaplacian

        public AlgorithmLaplacian​(ModelImage srcImg,
                                  float[] sigmas,
                                  boolean[] objectBuffer,
                                  boolean img25D,
                                  float ampFactor)
        Constructs a Laplacian algorithm object.
        Parameters:
        srcImg - source image model
        sigmas - Gaussian's standard deviations in the each dimension
        objectBuffer - array with true for object, false for background
        img25D - Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
        ampFactor - An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
      • AlgorithmLaplacian

        public AlgorithmLaplacian​(ModelImage srcImg,
                                  float[] sigmas,
                                  boolean maskFlag,
                                  boolean img25D,
                                  float ampFactor)
        Constructs a Laplacian algorithm object.
        Parameters:
        srcImg - source image model
        sigmas - Gaussian's standard deviations in the each dimension
        maskFlag - Flag that indicates that the Laplacian will be calculated for the whole image if equal to true
        img25D - Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
        ampFactor - An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
      • AlgorithmLaplacian

        public AlgorithmLaplacian​(ModelImage srcImg,
                                  boolean nonLinear,
                                  int kernelSize,
                                  float[] sigmas,
                                  boolean maskFlag,
                                  boolean img25D,
                                  float ampFactor)
        Constructs a Laplacian algorithm object.
        Parameters:
        srcImg - source image model
        nonLinear - If true, use nonlinear Laplacian
        kernelSize - Used only with nonlinear Laplacian
        sigmas - Gaussian's standard deviations in the each dimension
        maskFlag - Flag that indicates that the Laplacian will be calculated for the whole image if equal to true
        img25D - Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
        ampFactor - An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
      • AlgorithmLaplacian

        public AlgorithmLaplacian​(ModelImage destImg,
                                  ModelImage srcImg,
                                  boolean nonLinear,
                                  int kernelSize,
                                  float[] sigmas,
                                  boolean maskFlag,
                                  boolean img25D,
                                  float ampFactor)
        Constructs a Laplacian algorithm object.
        Parameters:
        destImg - image model where result image is to stored
        srcImg - source image model
        nonLinear - If true, use nonlinear Laplacian
        kernelSize - Used only with nonlinear Laplacian
        sigmas - Gaussian's standard deviations in the each dimension
        maskFlag - Flag that indicates that the Laplacian will be calculated for the whole image if equal to true
        img25D - Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
        ampFactor - An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
    • Method Detail

      • genLevelMask

        public static void genLevelMask​(int xDim,
                                        int yDim,
                                        float[] buffer,
                                        java.util.BitSet edgeImage,
                                        float level)
        Generates a zero crossing mask for a 2D function sets a Bitset object to 1 is a zero crossing is detected.
        Parameters:
        xDim - X dimension length
        yDim - Y dimension length
        buffer - array of data in which to find level crossing
        edgeImage - edge map of level crossings
        level - level of crossings to find (e.g. zero crossing of the Laplacian)
      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • getZeroXMask

        public ModelImage getZeroXMask()
        Accessor to return mask indicating zero crossings.
        Returns:
        ModelImage of zero crossings ( 2D function 1 = indicates zero crossing
      • runNonLinear

        private void runNonLinear()
      • setEdgeOptions

        public void setEdgeOptions​(float loThres,
                                   float hiThres)
        Call from dialog if you wish to produce edge image.
        Parameters:
        loThres - DOCUMENT ME!
        hiThres - DOCUMENT ME!
      • calcInPlace2D

        private void calcInPlace2D​(int nImages)
        Calculates the Laplacian image and replaces the source image with the new image.
        Parameters:
        nImages - number of images to be blurred. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.
      • calcInPlace3D

        private void calcInPlace3D()
        Calculates the Laplacian and replaces the source image with the new image.
      • calcStoreInDest2D

        private void calcStoreInDest2D​(int nImages)
        This function produces the Laplacian of input image.
        Parameters:
        nImages - number of images to be blurred. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.
      • calcStoreInDest3D

        private void calcStoreInDest3D()
        This function produces the Laplacian of input image.
      • genZeroXMask

        private void genZeroXMask​(float[] buffer)
        Generates a zero crossing mask for a 2D function sets a ModelImage to 1 if a zero crossing is detected.
        Parameters:
        buffer - array in which to find zero crossing
      • makeKernels2D

        private void makeKernels2D()
        Creates Gaussian derivative kernels.
      • makeKernels3D

        private void makeKernels3D()
        Creates Gaussian derivative kernels.
      • algorithmPerformed

        public void algorithmPerformed​(AlgorithmBase algorithm)
        Description copied from interface: AlgorithmInterface
        Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.
        Specified by:
        algorithmPerformed in interface AlgorithmInterface
        Parameters:
        algorithm - the algorithm which has just completed