Class AlgorithmPrincipalComponents

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

    public class AlgorithmPrincipalComponents
    extends AlgorithmBase
    implements java.awt.event.ActionListener, java.awt.event.FocusListener
    This algorithm operates on 3D black and white images and on 2D and 3D color images. The user can select 1 or both of 2 output images: The first image is a filtered 3D image containing only the first n principal components, where n is selected by the user after viewing images of the first 10 (or the number that exist if less than 10) principal components. The second image is a 2D image created by averaging together the images in the 3D image. Note that red, green, and blue are treated as separate 2D planes. This implementation assumes that the noise variance is equal in every slice and that the noise is uncorrelated between slices. Principal components maximizes data variance in components; it concentrates the information content of the data in as small a number of components as possible. This algorithm is based on: 1.) Digital Image Processing, Third Edition by Rafael C. Gonzalez and Richard E. Woods, Section 11.4 Use of Principal Components for Description, pp. 842 - 852, 2008 by Pearson Education, Inc. Information about using a matchImage: Eigenfaces for Recognition by Matthew Turk and Alex Pentland Vision and Modeling Group The Media Laboratory Massachusetts Institute of Technology 2.) Gabor Feature Based Classification Using the Enhanced Linear Discriminant Model for Face Recognition by Chengjun Liu and Harry Wechsler states "For the Eigenfaces method, the Mahalanobis distance measure performs better than the L1 distance measure, followed in order by the L2 distance measure and the cosine similarity measure as shown in Fig. 6. The Mahalanobis distance measure performs better than the other similarity measures because the Mahalanobis distance measure counteracts the fact that the L1 and L2 distance measures in PCA space weight preferentially for low frequencies, and this is consistent with results reported by Moghaddam and Pentland and Sung and Poggio. As the L2 measure weights more the low frequencies than L1 does, the L1 distance measure should perform better than the L2 distance measure, a conjecture validated by our experiments as shown in Figure 6. The cosine similarity measure does not compensate the low frequency preference, and it performs worst among all the measures." 3.) "The statistical properties of three noise removal procedures for multichannel remotely sensed data" by M. Berman, CSIRO Division of Mathemetics and Statistics P.O. Box 218, Lindfield, N.S.W., 2070 Consulting Report NSW/85/31/MB9 Note that this algorithm has 4 different names: Hotelling, eigenvector, principal component, and Karhunen-Loeve transform. Also note that when the noise variance is the same in all bands and the noise is uncorrelated between bands the principal component transformation is equivalent to the maximum noise fraction transformation. In the more general case, the MNF transform is equivalent to a transformation of the data to a coordinate system in which the noise covariance matrix is the identity matrix, followed by a principal components transformation. The transform in this form is the noise-adjusted principal components transform. In forward order MNF maximizes the noise content in successive components that are uncorrelated over the dataset or equivalently in reverse order MNF maximizes the signal to noise ratio of each component. Information about the signal to noise ratio improvement is found in "Information Extraction, SNR Improvement, and Data Compression in MultiSpectral Imagery", Patrick J. Ready and Paul A. Wintz, IEEE Transactions on Communications, Vol. COM-21, No. 10, October, 1973, pp. 1123-1130.
    • Field Detail

      • destImage

        private ModelImage[] destImage
        DOCUMENT ME!
      • displayAndAsk

        private boolean displayAndAsk
        DOCUMENT ME!
      • doAveraging

        private boolean doAveraging
        if true create an image averaging together the slices in the filtered version.
      • doFilter

        private boolean doFilter
        if true create a filtered version of the original image.
      • haveColor

        private boolean haveColor
        DOCUMENT ME!
      • nPlanes

        private int nPlanes
        number of image planes present.
      • nPresent

        private int nPresent
        number of principal components displayed 10 or less than 10 if fewer exist.
      • OKButton

        private javax.swing.JButton OKButton
        DOCUMENT ME!
      • pNumber

        private int pNumber
        number of principal components to be retained.
      • pNumberDialog

        private javax.swing.JDialog pNumberDialog
        DOCUMENT ME!
      • pressedOK

        private boolean pressedOK
        DOCUMENT ME!
      • srcImage

        private ModelImage srcImage
        DOCUMENT ME!
      • textNumber

        private javax.swing.JTextField textNumber
        DOCUMENT ME!
      • matchImage

        private ModelImage matchImage
        If this 2D black and white image is present, it is matched to the closest slice and/or color in the source image model by looking for the closest match of the weights of the principal components.
      • doMahalanobisDistance

        private boolean doMahalanobisDistance
    • Constructor Detail

      • AlgorithmPrincipalComponents

        public AlgorithmPrincipalComponents​(ModelImage[] destImg,
                                            ModelImage srcImg,
                                            ModelImage matchImage,
                                            boolean doFilter,
                                            boolean doAveraging,
                                            boolean displayAndAsk,
                                            int pNumber,
                                            boolean doMahalanobisDistance)
        Creates a new AlgorithmPrincipalComponents object.
        Parameters:
        destImg - image model where result image is to stored
        srcImg - source image model
        matchImage - match image match this image to the closest slice and/or color in the source image
        doFilter - if true create a filtered version of the original image
        doAveraging - if true create an image averaging together the slices in the filtered version
        displayAndAsk - if true display principal component images and ask how many to retain
        pNumber - if displayAndAsk if false pNumber is the number of principal component images to retain
        doMahalanobisDistance - Select Euclidean or Mahalanobis distance for matching
      • AlgorithmPrincipalComponents

        public AlgorithmPrincipalComponents​(ModelImage[] destImg,
                                            ModelImage srcImg,
                                            boolean doFilter,
                                            boolean doAveraging,
                                            boolean displayAndAsk,
                                            int pNumber)
        Creates a new AlgorithmPrincipalComponents object.
        Parameters:
        destImg - image model where result image is to stored
        srcImg - source image model
        doFilter - if true create a filtered version of the original image
        doAveraging - if true create an image averaging together the slices in the filtered version
        displayAndAsk - if true display principal component images and ask how many to retain
        pNumber - if displayAndAsk if false pNumber is the number of principal component images to retain
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Calls various methods depending on the action.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Overrides:
        actionPerformed in class AlgorithmBase
        Parameters:
        event - event that triggered function
      • finalize

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

        public void focusGained​(java.awt.event.FocusEvent event)
        Do nothing.
        Specified by:
        focusGained in interface java.awt.event.FocusListener
        Parameters:
        event - Focus event
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent event)
        Do nothing.
        Specified by:
        focusLost in interface java.awt.event.FocusListener
        Parameters:
        event - Focus event
      • updateFileInfo

        public void updateFileInfo​(ModelImage image,
                                   ModelImage resultImage)
        Copy important file information to resultant image structure.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
      • createPNumberDialog

        private void createPNumberDialog​(java.awt.event.ActionListener al)
        DOCUMENT ME!
        Parameters:
        al - DOCUMENT ME!
      • pComponent

        private void pComponent()
        DOCUMENT ME!