Package gov.nih.mipav.model.algorithms
Class SIFTImageSimilarity
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.SIFTImageSimilarity
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class SIFTImageSimilarity extends AlgorithmBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
SIFTImageSimilarity.DMatch
private class
SIFTImageSimilarity.DMatchComparator
private class
SIFTImageSimilarity.KeyPoint
private class
SIFTImageSimilarity.KeypointComparator
-
Field Summary
Fields Modifier and Type Field Description private double
assumed_blur
private double
DBL_EPSILON
private java.util.Vector<java.util.Vector<java.lang.Double>>
descriptors1
private java.util.Vector<java.util.Vector<java.lang.Double>>
descriptors2
private int
image_border_width
private ModelImage
image1
private ModelImage
image2
private java.util.Vector<SIFTImageSimilarity.KeyPoint>
keypoints1
private java.util.Vector<SIFTImageSimilarity.KeyPoint>
keypoints2
private java.lang.String
logFile
(package private) java.util.logging.Logger
logger
private int
NORM_L2
private int
num_intervals
private double
sigma
private double
tolerance
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description SIFTImageSimilarity()
SIFTImageSimilarity(ModelImage image1, ModelImage image2, double sigma, int num_intervals, double assumed_blur, int image_border_width, java.lang.String logFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
batchDistance(java.util.Vector<java.util.Vector<java.lang.Double>> src1, java.util.Vector<java.util.Vector<java.lang.Double>> src2, double[][] dist, int[][] nidx, int normType, int K, java.util.Vector<java.lang.Double> mask, int update, boolean crosscheck)
private void
BatchDistInvoker(java.util.Vector<java.util.Vector<java.lang.Double>> src1, java.util.Vector<java.util.Vector<java.lang.Double>> src2, double[][] dist, int[][] nidx, int K, java.util.Vector<java.lang.Double> mask, int update)
private double[]
computeGradientAtCenterPixel(double[][][] pixel_array)
private double[][]
computeHessianAtCenterPixel(double[][][] pixel_array)
void
computeKeypointsAndDescriptors(ModelImage image, boolean doimage1)
private java.util.Vector<SIFTImageSimilarity.KeyPoint>
computeKeypointsWithOrientations(SIFTImageSimilarity.KeyPoint keypoint, int octave_index, ModelImage gaussian_image, double radius_factor, int num_bins, double peak_ratio, double scale_factor)
private int
computeNumberOfOctaves(int[] image_shape)
private java.util.Vector<SIFTImageSimilarity.KeyPoint>
convertKeypointsToInputImageSize(java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints)
private java.util.Vector<SIFTImageSimilarity.KeyPoint>
findScaleSpaceExtrema(ModelImage[][] gaussian_images, ModelImage[][] dog_images, int num_intervals, double sigma, int image_border_width, double contrast_threshold)
private ModelImage
generateBaseImage(ModelImage image, double sigma, double assumed_blur)
private java.util.Vector<java.util.Vector<java.lang.Double>>
generateDescriptors(java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints, ModelImage[][] gaussian_images, int window_width, int num_bins, double scale_multiplier, double descriptor_max_value)
private ModelImage[][]
generateDoGImages(ModelImage[][] gaussian_images)
private ModelImage[][]
generateGaussianImages(ModelImage image, int num_octaves, double[] gaussian_kernels)
private double[]
generateGaussianKernels(double sigma, int num_intervals)
private boolean
isPixelAnExtremum(double[][][] subimages, double threshold)
private SIFTImageSimilarity.KeyPoint
localizeExtremumViaQuadraticFit(int[] localized_image_index, int i, int j, int image_index, int octave_index, int num_intervals, ModelImage[] dog_images_in_octave, double sigma, double contrast_threshold, int image_border_width, double eigenvalue_ratio, int num_attempts_until_convergence)
private java.util.Vector<SIFTImageSimilarity.KeyPoint>
removeDuplicateKeypoints(java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints)
void
runAlgorithm()
Actually runs the algorithm.private void
unpackOctave(int[] octave, int[] layer, double[] scale, SIFTImageSimilarity.KeyPoint keypoint)
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, 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, windowOpened
-
Methods 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, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
image1
private ModelImage image1
-
image2
private ModelImage image2
-
sigma
private double sigma
-
num_intervals
private int num_intervals
-
assumed_blur
private double assumed_blur
-
image_border_width
private int image_border_width
-
tolerance
private double tolerance
-
logFile
private java.lang.String logFile
-
logger
java.util.logging.Logger logger
-
DBL_EPSILON
private final double DBL_EPSILON
- See Also:
- Constant Field Values
-
keypoints1
private java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints1
-
descriptors1
private java.util.Vector<java.util.Vector<java.lang.Double>> descriptors1
-
keypoints2
private java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints2
-
descriptors2
private java.util.Vector<java.util.Vector<java.lang.Double>> descriptors2
-
NORM_L2
private final int NORM_L2
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SIFTImageSimilarity
public SIFTImageSimilarity()
-
SIFTImageSimilarity
public SIFTImageSimilarity(ModelImage image1, ModelImage image2, double sigma, int num_intervals, double assumed_blur, int image_border_width, java.lang.String logFile)
-
-
Method Detail
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
batchDistance
private void batchDistance(java.util.Vector<java.util.Vector<java.lang.Double>> src1, java.util.Vector<java.util.Vector<java.lang.Double>> src2, double[][] dist, int[][] nidx, int normType, int K, java.util.Vector<java.lang.Double> mask, int update, boolean crosscheck)
-
BatchDistInvoker
private void BatchDistInvoker(java.util.Vector<java.util.Vector<java.lang.Double>> src1, java.util.Vector<java.util.Vector<java.lang.Double>> src2, double[][] dist, int[][] nidx, int K, java.util.Vector<java.lang.Double> mask, int update)
-
computeKeypointsAndDescriptors
public void computeKeypointsAndDescriptors(ModelImage image, boolean doimage1)
-
generateBaseImage
private ModelImage generateBaseImage(ModelImage image, double sigma, double assumed_blur)
-
computeNumberOfOctaves
private int computeNumberOfOctaves(int[] image_shape)
-
generateGaussianKernels
private double[] generateGaussianKernels(double sigma, int num_intervals)
-
generateGaussianImages
private ModelImage[][] generateGaussianImages(ModelImage image, int num_octaves, double[] gaussian_kernels)
-
generateDoGImages
private ModelImage[][] generateDoGImages(ModelImage[][] gaussian_images)
-
findScaleSpaceExtrema
private java.util.Vector<SIFTImageSimilarity.KeyPoint> findScaleSpaceExtrema(ModelImage[][] gaussian_images, ModelImage[][] dog_images, int num_intervals, double sigma, int image_border_width, double contrast_threshold)
-
isPixelAnExtremum
private boolean isPixelAnExtremum(double[][][] subimages, double threshold)
-
localizeExtremumViaQuadraticFit
private SIFTImageSimilarity.KeyPoint localizeExtremumViaQuadraticFit(int[] localized_image_index, int i, int j, int image_index, int octave_index, int num_intervals, ModelImage[] dog_images_in_octave, double sigma, double contrast_threshold, int image_border_width, double eigenvalue_ratio, int num_attempts_until_convergence)
-
computeGradientAtCenterPixel
private double[] computeGradientAtCenterPixel(double[][][] pixel_array)
-
computeHessianAtCenterPixel
private double[][] computeHessianAtCenterPixel(double[][][] pixel_array)
-
computeKeypointsWithOrientations
private java.util.Vector<SIFTImageSimilarity.KeyPoint> computeKeypointsWithOrientations(SIFTImageSimilarity.KeyPoint keypoint, int octave_index, ModelImage gaussian_image, double radius_factor, int num_bins, double peak_ratio, double scale_factor)
-
removeDuplicateKeypoints
private java.util.Vector<SIFTImageSimilarity.KeyPoint> removeDuplicateKeypoints(java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints)
-
convertKeypointsToInputImageSize
private java.util.Vector<SIFTImageSimilarity.KeyPoint> convertKeypointsToInputImageSize(java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints)
-
unpackOctave
private void unpackOctave(int[] octave, int[] layer, double[] scale, SIFTImageSimilarity.KeyPoint keypoint)
-
generateDescriptors
private java.util.Vector<java.util.Vector<java.lang.Double>> generateDescriptors(java.util.Vector<SIFTImageSimilarity.KeyPoint> keypoints, ModelImage[][] gaussian_images, int window_width, int num_bins, double scale_multiplier, double descriptor_max_value)
-
-