public class FuzzyCMeansImageClustering extends ImageProcessingTask
Changes
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private float[] |
aPixel |
private float[][] |
clusterCenters |
private double |
epsilon |
private float |
fuzziness |
private boolean |
hasFinished |
private int |
height |
private int[] |
inputData |
private int |
iteration |
private double |
j |
private int |
maxIterations |
private float[][][] |
membership |
private int |
numBands |
private int |
numClusters |
private short[][] |
outputData |
private javax.media.jai.PlanarImage |
pInput |
private long |
position |
private int |
width |
isCancelable, parentTask, virtual
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
FuzzyCMeansImageClustering(javax.media.jai.PlanarImage pInput,
int numClusters,
int maxIterations,
float fuzziness,
double epsilon)
The constructor for the class, which sets the input image, the number of
desired clusters, the maximum number of iterations, the fuzziness ("m"
value) and a value that will be used to decide whether the convergence
has stopped.
|
Modifier and Type | Method and Description |
---|---|
private float |
calcDistance(float[] a1,
float[] a2)
This method calculates the Euclidean distance between two N-dimensional
vectors.
|
private float |
calcSquaredDistance(float[] a1,
float[] a2)
This method calculates the squared distance between two N-dimensional
vectors.
|
private void |
calculateClusterCentersFromMFs()
This method calculates the cluster centers from the membership functions.
|
private void |
calculateMFsFromClusterCenters()
This method calculates the membership functions from the cluster centers.
|
private double |
calculateObjectiveFunction() |
float[][] |
getClusterCenters()
This method returns the cluster centers.
|
double |
getCompactnessAndSeparation()
This method returns the Compactness and Separation measure of cluster
validity (see Fuzzy Algorithms With Applications to Image Processing and
Pattern Recognition, Zheru Chi, Hong Yan, Tuan Pham, World Scientific,
pp.
|
double |
getPartitionCoefficient()
This method returns the Partition Coefficient measure of cluster validity
(see Fuzzy Algorithms With Applications to Image Processing and Pattern
Recognition, Zheru Chi, Hong Yan, Tuan Pham, World Scientific, pp.
|
double |
getPartitionEntropy()
This method returns the Partition Entropy measure of cluster validity
(see Fuzzy Algorithms With Applications to Image Processing and Pattern
Recognition, Zheru Chi, Hong Yan, Tuan Pham, World Scientific, pp.
|
long |
getPosition()
This method returns a measure of the progress of the algorithm.
|
javax.media.jai.TiledImage |
getRankedImage(int rank)
This method will return a rank image, i.e.
|
private int |
getRankedIndex(float[] data,
int rank)
This method returns the ranked index of a cluster from an array
containing the membership functions.
|
private float |
getRankedMF(float[] data,
int rank)
This method returns the ranked membership function of a cluster from an
array containing the membership functions.
|
javax.media.jai.TiledImage |
getRankedMFImage(int rank)
This method will return a membership function image, i.e.
|
long |
getSize()
This method returns the estimated size (steps) for this task.
|
boolean |
isFinished()
This method returns true if the clustering has finished.
|
void |
run()
This method performs the bulk of the processing.
|
addProgressListener, fireProgressChanged, getParentTask, getPcs, getProgressListeners, isCancelable, isCancelled, isVirtual, setCancelable, setParentTask, setPcs, setVirtual
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private javax.media.jai.PlanarImage pInput
private int width
private int height
private int numBands
private int maxIterations
private int numClusters
private float fuzziness
private float[][][] membership
private int iteration
private double j
private double epsilon
private boolean hasFinished
private long position
private float[][] clusterCenters
private int[] inputData
private float[] aPixel
private short[][] outputData
public FuzzyCMeansImageClustering(javax.media.jai.PlanarImage pInput, int numClusters, int maxIterations, float fuzziness, double epsilon)
pInput
- the input planar image.numClusters
- the desired number of clusters.maxIterations
- the maximum number of iterations.fuzziness
- the fuzziness (a.k.a. the "m" value)epsilon
- a small value used to verify if clustering has converged.public void run()
run
in interface Runnable
run
in class ImageProcessingTask
private void calculateClusterCentersFromMFs()
private void calculateMFsFromClusterCenters()
private double calculateObjectiveFunction()
private float calcDistance(float[] a1, float[] a2)
a1
- the first data vector.a2
- the second data vector.public long getSize()
getSize
in class ImageProcessingTask
public long getPosition()
getPosition
in class ImageProcessingTask
public boolean isFinished()
isFinished
in class ImageProcessingTask
public javax.media.jai.TiledImage getRankedImage(int rank)
rank
- the desired rank for the classification.public javax.media.jai.TiledImage getRankedMFImage(int rank)
rank
- the desired rank for the classification.private int getRankedIndex(float[] data, int rank)
data
- the array with the membership functions.rank
- the rank of the cluster we want to get.private float getRankedMF(float[] data, int rank)
data
- the array with the membership functions.rank
- the rank of the cluster we want to get.public double getPartitionCoefficient()
public double getPartitionEntropy()
public double getCompactnessAndSeparation()
private float calcSquaredDistance(float[] a1, float[] a2)
a1
- the first data vector.a2
- the second data vector.public float[][] getClusterCenters()
Copyright © 2009–2016 Helmut Ahammer, Philipp Kainz. All rights reserved.