Class AlgorithmCenterOfMass

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

    public class AlgorithmCenterOfMass
    extends AlgorithmBase
    This algorithm calculates the center of mass for 2D and 3D black and white images.
    Version:
    1.0 February 26, 2008
    Author:
    William Gandler
    • Field Detail

      • 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.
      • threshold

        private float[] threshold
        Array of two thresholds. threshold[0] = Minimum threshold, threshold[1] = Maximum threshold.
      • allowDataWindow

        private boolean allowDataWindow
        If true, allow data window output
      • xCOM

        public double xCOM
        x coordinate for center of mass, normalized by image resolution
      • yCOM

        public double yCOM
        y coordinate for center of mass, normalized by image resolution
      • zCOM

        public double zCOM
        z coordinate for center of mass, normalized by image resolution, if srcImage is 2D = 0
    • Constructor Detail

      • AlgorithmCenterOfMass

        public AlgorithmCenterOfMass​(ModelImage srcImg,
                                     float[] threshold,
                                     boolean maskFlag)
        Creates a new AlgorithmCenterOfMass object.
        Parameters:
        srcImg - source image model
        threshold - array of two thresholds
        maskFlag - true indicates that the whole image should be processed
    • Method Detail

      • setAllowDataWindow

        public void setAllowDataWindow​(boolean allowDataWindow)
      • finalize

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

        private void calcInPlace2D()
        Calculate center of mass of 2D black and white image.
      • calcInPlace3D

        private void calcInPlace3D()
        Calculate center of mass of 3D black and white image.
      • getCenterOfMass

        public double[] getCenterOfMass()
        Returns the computed center of mass. If algorithm is not completed: returns null. If 2D: returns {xCenter, yCenter, 0} If 3D: returns {xCenter, yCenter, zCenter}