Class AlgorithmGrayScaleMorphology25D

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

    public class AlgorithmGrayScaleMorphology25D
    extends AlgorithmBase
    2.5D mathematical morphology class applied to Gray scale images. (2D morphology on 3D volumes). Kernels of 3x3 (4 or 8 connected) and 5x5 (12 connected) are available or user defined kernels can be supplied.

    Supported methods include:

    • Bottom hat
    • close
    • dilate
    • erode
    • Morphological gradient
    • Morphological laplacian
    • open
    • Top hat

    Adapted from AlgoritmMorphology2D by Matthew J. McAuliffe, Ph.D.

    Version:
    1.0 June 8, 2004
    Author:
    Evan McCreedy
    • Field Detail

      • PARTICLE_ANALYSIS

        public static final int PARTICLE_ANALYSIS
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • PARTICLE_ANALYSIS_NEW

        public static final int PARTICLE_ANALYSIS_NEW
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • MORPHOLOGICAL_LAPLACIAN

        public static final int MORPHOLOGICAL_LAPLACIAN
        See Also:
        Constant Field Values
      • MORPHOLOGICAL_RECONSTRUCTION_BY_DILATION

        public static final int MORPHOLOGICAL_RECONSTRUCTION_BY_DILATION
        See Also:
        Constant Field Values
      • MORPHOLOGICAL_RECONSTRUCTION_BY_EROSION

        public static final int MORPHOLOGICAL_RECONSTRUCTION_BY_EROSION
        See Also:
        Constant Field Values
      • OPENING_BY_RECONSTRUCTION

        public static final int OPENING_BY_RECONSTRUCTION
        See Also:
        Constant Field Values
      • CLOSING_BY_RECONSTRUCTION

        public static final int CLOSING_BY_RECONSTRUCTION
        See Also:
        Constant Field Values
      • algorithm

        private int algorithm
        DOCUMENT ME!
      • circleDiameter

        private float circleDiameter
        DOCUMENT ME!
      • entireImage

        private boolean entireImage
        DOCUMENT ME!
      • imgBuffer

        private double[] imgBuffer
        DOCUMENT ME!
      • imgBuffer2

        private double[] imgBuffer2
      • maskBuffer

        private double[] maskBuffer
      • imgLength

        private int imgLength
        DOCUMENT ME!
      • iterationsD

        private int iterationsD
        DOCUMENT ME!
      • iterationsE

        private int iterationsE
        DOCUMENT ME!
      • kDim

        private int kDim
        DOCUMENT ME!
      • kernel

        private java.util.BitSet kernel
        DOCUMENT ME!
      • kernelType

        private int kernelType
      • numPruningPixels

        private int numPruningPixels
        Number pixels to prune.
      • processBuffer

        private double[] processBuffer
        DOCUMENT ME!
      • sliceLength

        private int sliceLength
        DOCUMENT ME!
      • maskImage

        private ModelImage maskImage
        Used in geodesic dilation, geodesic erosion, morphological reconstruction by dilation, and morphological reconstruction by erosion Not used in opening by reconstruction and closing by reconstruction
      • geodesicSize

        private int geodesicSize
        Size of geodesic erosions and dilations
    • Constructor Detail

      • AlgorithmGrayScaleMorphology25D

        public AlgorithmGrayScaleMorphology25D​(ModelImage srcImg,
                                               int kernelType,
                                               float circleDiameter,
                                               int method,
                                               int iterD,
                                               int iterE,
                                               int pruningPix,
                                               int edType,
                                               boolean entireImage)
        Creates a new AlgorithmMorphology25D object.
        Parameters:
        srcImg - source image model
        kernelType - kernel size (i.e. connectedness)
        circleDiameter - only valid if kernelType == SIZED_CIRCLE and represents the width of a circle in the resolution of the image
        method - setup the algorithm method (i.e. erode, dilate)
        iterD - number of times to dilate
        iterE - number of times to erode
        pruningPix - the number of pixels to prune
        edType - the type of edging to perform (inner or outer)
        entireImage - if true, indicates that the VOIs should NOT be used and that entire image should be processed
      • AlgorithmGrayScaleMorphology25D

        public AlgorithmGrayScaleMorphology25D​(ModelImage srcImg,
                                               ModelImage maskImage,
                                               int kernelType,
                                               float circleDiameter,
                                               int method,
                                               int geodesicSize,
                                               int iterD,
                                               int iterE,
                                               boolean entireImage)
        Creates a new AlgorithmGrayScaleMorphology25D object.
        Parameters:
        srcImg - source image model
        kernelType - dilation kernel size (i.e. connectedness)
        circleDiameter - dilation only valid if kernelType == SIZED_CIRCLE and represents the width of a circle in the resolution of the image
        method - setup the algorithm method (i.e. erode, dilate)
        geodesicSize -
        iterD - number of times to dilate
        iterE - number of times to erode
        entireImage - if true, indicates that the VOIs should NOT be used and that entire image should be processed
    • Method Detail

      • finalize

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

        public void setAlgorithm​(int method)
        Sets the algorithm type (i.e. erode, dilate)
        Parameters:
        method - algorithm type
      • setImage

        public void setImage​(ModelImage img)
        Sets the algorithm to new image of boolean type.
        Parameters:
        img - image model of boolean type
      • setIterations

        public void setIterations​(int itersD,
                                  int itersE)
        Sets number of iterations for closing or opening.
        Parameters:
        itersD - number of dilations
        itersE - number of erosions
      • setKernel

        public void setKernel​(java.util.BitSet kernel,
                              int dim)
        Sets user defined square kernels.
        Parameters:
        kernel - user defined kernel
        dim - length of one dimension (kernel should be square)
      • showKernel

        public void showKernel()
        display kernel as 1 or 0 in the debug window.
      • dilate

        private void dilate​(boolean returnFlag,
                            int iters)
        Dilates an image using the indicated kernel and the indicated number of executions. The grayscale dilation is the maximum value over the reflected kernel region. For symmetric kernels the reflected kernel is the same as the kernel.
        Parameters:
        returnFlag - if true then this operation is a step in the morph process (i.e. close)
        iters - number of dilations
      • geodesicDilation

        private void geodesicDilation​(boolean returnFlag,
                                      int geodesicSize)
        geodesic dilation of a boolean, unsigned byte or unsigned short image using the indicated kernel and the indicated number of executions.
        Parameters:
        returnFlag - if true then this operation is a step in the morph process (i.e. close)
        geodesicSize -
      • dilate2D

        private void dilate2D​(int indexZ,
                              int iters)
        Dilates an image slice using the indicated kernel and the indicated number of executions. The grayscale dilation is the maximum value over the reflected kernel region. For symmetric kernels the reflected kernel is the same as the kernel.
        Parameters:
        indexZ -
        iters - number of dilations
      • geodesicErosion

        private void geodesicErosion​(boolean returnFlag,
                                     int geodesicSize)
        geodesic erosion of a boolean, unsigned byte or unsigned short image using the indicated kernel and the indicated number of executions.
        Parameters:
        returnFlag - if true then this operation is a step in the morph process (i.e. close)
        geodesicSize -
      • erode2D

        private void erode2D​(int indexZ,
                             int iters)
        Erodes an image slice using the indicated kernel and the indicated number of executions. The grayscale erosion is the minimum value over the kernel region.
        Parameters:
        indexZ -
        iters - number of erosion iterations.
      • erode

        private void erode​(boolean returnFlag,
                           int iters)
        Erodes an image using the indicated kernel and the indicated number of executions. The grayscale erosion is the minimum value over the kernel region.
        Parameters:
        returnFlag - if true then this operation is a step in the morph process (i.e. open)
        iters - number of erosion iterations.
      • makeCircularKernel

        private void makeCircularKernel​(float circDiameter)
        Generates a circular kernel of a specific diameter.
        Parameters:
        circDiameter - represents the width of a circle in the resolution of the image
      • makeKernel

        private void makeKernel​(int kernelType)
        Generates a kernel of the indicated type.
        Parameters:
        kernelType - type of kernel to be generated.