Package gov.nih.mipav.model.algorithms
Class AlgorithmPrincipalComponents
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmPrincipalComponents
- All Implemented Interfaces:
ActionListener,FocusListener,WindowListener,Runnable,EventListener
public class AlgorithmPrincipalComponents
extends AlgorithmBase
implements ActionListener, 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ModelImage[]DOCUMENT ME!private booleanDOCUMENT ME!private booleanif true create an image averaging together the slices in the filtered version.private booleanif true create a filtered version of the original image.private booleanprivate booleanDOCUMENT ME!private ModelImageIf 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.private intnumber of image planes present.private intnumber of principal components displayed 10 or less than 10 if fewer exist.private JButtonDOCUMENT ME!private intnumber of principal components to be retained.private JDialogDOCUMENT ME!private booleanDOCUMENT ME!private booleanprivate ModelImageDOCUMENT ME!private JTextFieldDOCUMENT ME!Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmPrincipalComponents(ModelImage[] destImg, ModelImage srcImg, boolean doFilter, boolean doAveraging, boolean displayAndAsk, int pNumber) Creates a new AlgorithmPrincipalComponents object.AlgorithmPrincipalComponents(ModelImage[] destImg, ModelImage srcImg, int pNumber) Creates a new AlgorithmPrincipalComponents object.AlgorithmPrincipalComponents(ModelImage[] destImg, ModelImage srcImg, ModelImage matchImage, boolean doFilter, boolean doAveraging, boolean displayAndAsk, int pNumber, boolean doMahalanobisDistance) Creates a new AlgorithmPrincipalComponents object. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Calls various methods depending on the action.private voidDOCUMENT ME!voidfinalize()Prepares this class for destruction.voidfocusGained(FocusEvent event) Do nothing.voidfocusLost(FocusEvent event) Do nothing.private voidDOCUMENT ME!voidStart algorithm.voidupdateFileInfo(ModelImage image, ModelImage resultImage) Copy important file information to resultant image structure.Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
destImage
DOCUMENT ME! -
displayAndAsk
private boolean displayAndAskDOCUMENT ME! -
doAveraging
private boolean doAveragingif true create an image averaging together the slices in the filtered version. -
doFilter
private boolean doFilterif true create a filtered version of the original image. -
haveColor
private boolean haveColorDOCUMENT ME! -
principalComponentsOnly
private boolean principalComponentsOnly -
nPlanes
private int nPlanesnumber of image planes present. -
nPresent
private int nPresentnumber of principal components displayed 10 or less than 10 if fewer exist. -
OKButton
DOCUMENT ME! -
pNumber
private int pNumbernumber of principal components to be retained. -
pNumberDialog
DOCUMENT ME! -
pressedOK
private boolean pressedOKDOCUMENT ME! -
srcImage
DOCUMENT ME! -
textNumber
DOCUMENT ME! -
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 Details
-
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 storedsrcImg- source image modelmatchImage- match image match this image to the closest slice and/or color in the source imagedoFilter- if true create a filtered version of the original imagedoAveraging- if true create an image averaging together the slices in the filtered versiondisplayAndAsk- if true display principal component images and ask how many to retainpNumber- if displayAndAsk if false pNumber is the number of principal component images to retaindoMahalanobisDistance- 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 storedsrcImg- source image modeldoFilter- if true create a filtered version of the original imagedoAveraging- if true create an image averaging together the slices in the filtered versiondisplayAndAsk- if true display principal component images and ask how many to retainpNumber- if displayAndAsk if false pNumber is the number of principal component images to retain
-
AlgorithmPrincipalComponents
Creates a new AlgorithmPrincipalComponents object. Option only returns principal components- Parameters:
destImg- image model where result image is to storedsrcImg- source image modelpNumber- if displayAndAsk if false pNumber is the number of principal component images to retaindoFilter- if true create a filtered version of the original imagedoAveraging- if true create an image averaging together the slices in the filtered versiondisplayAndAsk- if true display principal component images and ask how many to retain
-
-
Method Details
-
actionPerformed
Calls various methods depending on the action.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin classAlgorithmBase- Parameters:
event- event that triggered function
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
focusGained
Do nothing.- Specified by:
focusGainedin interfaceFocusListener- Parameters:
event- Focus event
-
focusLost
Do nothing.- Specified by:
focusLostin interfaceFocusListener- Parameters:
event- Focus event
-
runAlgorithm
public void runAlgorithm()Start algorithm.- Specified by:
runAlgorithmin classAlgorithmBase
-
updateFileInfo
Copy important file information to resultant image structure.- Parameters:
image- Source image.resultImage- Resultant image.
-
createPNumberDialog
DOCUMENT ME!- Parameters:
al- DOCUMENT ME!
-
pComponent
private void pComponent()DOCUMENT ME!
-