Package gov.nih.mipav.model.algorithms
Class DBSCANClusteringSegment
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.DBSCANClusteringSegment
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
% Copyright (c) 2013 Peter Kovesi
% www.peterkovesi.com/matlabfns/
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% The Software is provided "as is", without warranty of any kind.
The image must be a color image
First the slic.m software performs a SLIC Simple Linear Iterative Clustering SuperPixels.
SLIC is followed by SPDBSCAN.m to perform a DBSCAN clustering of superpixels. This results in
a simple and fast segmentation of an image.
Ported MATLAB files:
slic.m Implementation of Achanta, Shaji, Smith, Lucchi, Fua and Susstrunk's SLIC Superpixels.
spdbscan.m Implements DBSCAN clustering of superpixels.
mcleanupregions.m Morphological version of cleanupregions.m The output is not quite as nice but the execution is much faster.
finddisconnected.m Finds groupings of disconnected labeled regions. Used by mcleanupregions.m to reduce execution time.
makeregionsdistinct.m Ensures labeled regions are distinct.
renumberregions.m Ensures all regions in labeled image have a unique label and that the label numbering forms a contiguous sequence.
regionadjacency.m Computes adjacency matrix for an image of labeled segmented regions.
References:
R. Achanta, A. Shaji, K. Smith, A. Lucchi, P. Fua and S. Susstrunk. "SLIC Superpixels Compared
to State-of-the-Art Superpixel Methods" PAMI. Vol 34 No 11. November 2012. pp 2274-2281.
Martin Ester, Hans-Peter Kriegel, Jorg Sander, Xiaowei Xu (1996). "A density-based algorithm
for discovering clusters in large spatial databases with noise". Proceedings of the Second International
Conference on Knowledge Discovery and Data Mining (KDD-96). AAAI Press. pp. 226-231.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) class(package private) classNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate doubleprivate intprivate doubleprivate final intprivate final intprivate intprivate intprivate intprivate doubleFields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionDBSCANClusteringSegment(ModelImage destImg, ModelImage srcImg, int k, double m, double seRadius, int center, int mw1, int mw2, int nItr, double Ec) -
Method Summary
Modifier and TypeMethodDescriptionprivate intbwlabel4(int[][] bl) private double[][]dist(double[] C, double[][][] im, int r1, int c1, double S, double m) finddisconnected(int[][] l) private intmakeregionsdistinct(int[][] seg, int connectivity) private DBSCANClusteringSegment.AmAlmcleanupregions(int[][] seg, double seRadius) private DBSCANClusteringSegment.AmAlregionadjacency(int[][] L, int connectivity) regionQueryM(DBSCANClusteringSegment.SP Sp, DBSCANClusteringSegment.AmAl amal, int n, double Ec) private DBSCANClusteringSegment.Renumrenumberregions(int[][] L) voidActually runs the algorithm.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, 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
-
MEAN_CENTER
private final int MEAN_CENTER- See Also:
-
MEDIAN_CENTER
private final int MEDIAN_CENTER- See Also:
-
k
private int k -
m
private double m -
seRadius
private double seRadius -
center
private int center -
mw1
private int mw1 -
mw2
private int mw2 -
nItr
private int nItr -
Ec
private double Ec
-
-
Constructor Details
-
DBSCANClusteringSegment
public DBSCANClusteringSegment(ModelImage destImg, ModelImage srcImg, int k, double m, double seRadius, int center, int mw1, int mw2, int nItr, double Ec)
-
-
Method Details
-
runAlgorithm
public void runAlgorithm()Description copied from class:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin classAlgorithmBase
-
regionQueryM
private Vector<Integer> regionQueryM(DBSCANClusteringSegment.SP Sp, DBSCANClusteringSegment.AmAl amal, int n, double Ec) -
mcleanupregions
-
renumberregions
-
finddisconnected
-
regionadjacency
-
makeregionsdistinct
private int makeregionsdistinct(int[][] seg, int connectivity) -
bwlabel4
private int bwlabel4(int[][] bl) -
dist
private double[][] dist(double[] C, double[][][] im, int r1, int c1, double S, double m)
-