Class AlgorithmHistogram2Dim

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

    public class AlgorithmHistogram2Dim
    extends AlgorithmBase
    This algorithm creates a two dimensional histogram of the data in 2 black and white images or 1 color image. if doLinearRescale is true, the range of data in the second image is rescaled to be the same as the range of data in the first image. That is the second image minimum is rescaled to the first image minimum and the second image maximum is rescaled to the first image maximum. Also, if linear rescaling is used the number of bins in the second image is set equal to the number of bins in the first image. The default number of bins equals the min(256,maximum value - minimum value + 1) if the data is not float or double. If the data is float or double, the default number of bins is 256. ch1 = 0 to ch1 = bin1 - 2 all have a width of (bin1 - 1)/range1, but ch1 = bin1 - 1 has no width, it is a single value at max1. bin ch1 = 0 covers min1 <= ch1 < min1 + (max1 - min1)/(bin1 - 1) bin ch1 = 1 covers min1 + (max1 - min1)/(bin1 - 1) <= ch1 < min1 + 2*(max1 - min1)/(bin1 - 1) bin ch1 = bin1 - 2 covers min1 + (bin1 - 2)*(max - min1)/(bin1 - 1) <= ch1 < max1 bin ch1 = bin1 - 1 covers only max1 The processing for maximum values is specially handled to prevent loss of top bin counts from rounding errors.
    • Field Detail

      • baseImage

        private ModelImage baseImage
        Image for Y-axis of Histogram
      • bin1

        private int bin1
        Number of bins for Image1
      • bin2

        private int bin2
        Number of bins for Image2
      • doLinearRescale

        private boolean doLinearRescale
        Boolean value. If true baseImage (Image2) is rescaled to the range of source image (Image1)
      • doLogResult

        private boolean doLogResult
        Boolean value. If true, the log of the result image is displayed for better visualization
      • useBlue

        private boolean useBlue
        For color images only. If true blue image is used as one of the images to create a 2D Histogram
      • useGreen

        private boolean useGreen
        For color images only. If true green image is used as one of the images to create a 2D Histogram
      • useRed

        private boolean useRed
        For color images only. If true red image is used as one of the images to create a 2D Histogram
    • Constructor Detail

      • AlgorithmHistogram2Dim

        public AlgorithmHistogram2Dim​(ModelImage destImg,
                                      ModelImage srcImg,
                                      ModelImage baseImage,
                                      boolean doLinearRescale,
                                      boolean doLogResult,
                                      int bin1,
                                      int bin2)
        Constructor for images in which 2D histogram is placed in a predetermined destination image. Used for 2 black and white images
        Parameters:
        destImg - image model where result image is to stored
        srcImg - image for x axis of histogram
        baseImage - image for y axis of histogram
        doLinearRescale - If true rescales the Image2 data to the range of Image1 data
        doLogResult - If true, displays the log of the result image for better visualization
        bin1 - Number of bins on x-axis (Image1)
        bin2 - Number of bins in y-axis (Image2)
      • AlgorithmHistogram2Dim

        public AlgorithmHistogram2Dim​(ModelImage destImg,
                                      ModelImage srcImg,
                                      boolean doLinearRescale,
                                      boolean doLogResult,
                                      int bin1,
                                      int bin2,
                                      boolean useRed,
                                      boolean useGreen,
                                      boolean useBlue)
        Constructor for images in which 2D histogram is placed in a predetermined destination image. Used for 1 color image.
        Parameters:
        destImg - image model where result image is to stored
        srcImg - source image model
        doLinearRescale - If true rescales the Image2 data to the range of Image1 data
        doLogResult - If true, displays the log of the result image for better visualization
        bin1 - Number of bins on x-axis (Image1)
        bin2 - Number of bins in y-axis (Image2)
        useRed - For color images only. If true red image is used as one of the images to create a 2D Histogram
        useGreen - For color images only. If true green image is used as one of the images to create a 2D Histogram
        useBlue - For color images only. If true blue image is used as one of the images to create a 2D Histogram
    • Method Detail

      • finalize

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

        private void calcStoreInDest()
        This function produces a 2D histogram image with srcImage values represented across the x axis and baseImage values represented across the y axis.
      • calcStoreInDestColor

        private void calcStoreInDestColor()
        This function produces a 2D histogram image with first color values represented across the x axis and second color values represented across the y axis.