Package gov.nih.mipav.model.algorithms
Class AlgorithmSFTA
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmSFTA
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmSFTA extends AlgorithmBase
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
counts
private double[]
D
private int
nt
Copyright (c) 2013, Alceu Costa Copyright (c) 2013, GBDI-ICMC-USP All rights reserved.private int
numBins
private short[]
T
-
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 AlgorithmSFTA(ModelImage srcImg, int nt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private byte[]
findBorders(byte[] I, int xDim, int yDim)
FINDBORDERS Returns an binary image with the regions' boundaries of the input image I.double[]
getD()
private double
hausDim(byte[] I, int xDim, int yDim)
HAUSDIM Returns the Haussdorf fractal dimension of an object represented by a binary image.private int
otsu(int[] counts)
private void
otsurec(short[] I, int ttotal)
OTSUREC Returns a set of thresholds for the input image using the multi-level otsu algorith.private void
otsurec_helper(int lowerBin, int upperBin, int tLower, int tUpper)
void
runAlgorithm()
Actually 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, 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
-
nt
private int nt
Copyright (c) 2013, Alceu Costa Copyright (c) 2013, GBDI-ICMC-USP All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Ported from MATLAB to Java by William Gandler SFTA extracts texture features from the grayscale image I using the SFTA algorithm (Segmentation-based Fractal Texture Analysis). Returns a 1 by 6*nt vector D extracted from the input grayscale image I using the SFTA (Segmentation-based Fractal Texture Analysis) algorithm. The feature vector corresponds to texture information extracted from the input image I. If necessary, the input image is converted to a grayscale image with bit-depth of 8. Reference: Costa, A. F., G. E. Humpire-Mamani, A. J. M. Traina. 2012. "An Efficient Algorithm for Fractal Analysis of Textures." In SIBGRAPI 2012 (XXV Conference on Graphics, Patterns and Images), 39-46, Ouro Preto, Brazil. Author ------ Alceu Ferraz Costa email: alceufc [at] icmc [dot] usp [dot] br
-
numBins
private int numBins
-
T
private short[] T
-
counts
private int[] counts
-
D
private double[] D
-
-
Constructor Detail
-
AlgorithmSFTA
public AlgorithmSFTA(ModelImage srcImg, int nt)
-
-
Method Detail
-
getD
public double[] getD()
- Returns:
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
hausDim
private double hausDim(byte[] I, int xDim, int yDim)
HAUSDIM Returns the Haussdorf fractal dimension of an object represented by a binary image. Returns the Haussdorf fractal dimension D of an object represented by the binary image I. Nonzero pixels belong to an object and 0 pixels constitute the background. Algorithm --------- 1 - Pad the image with background pixels so that its dimensions are a power of 2. 2 - Set the box size 'e' to the size of the image. 3 - Compute N(e), which corresponds to the number of boxes of size 'e' which contains at least one object pixel. 4 - If e > 1 then e = e / 2 and repeat step 3. 5 - Compute the points log(N(e)) x log(1/e) and use the least squares method to fit a line to the points. 6 - The returned Haussdorf fractal dimension D is the slope of the line. Author ------ Alceu Ferraz Costa email: alceufc [at] icmc [dot] usp [dot] br- Parameters:
I
-- Returns:
-
findBorders
private byte[] findBorders(byte[] I, int xDim, int yDim)
FINDBORDERS Returns an binary image with the regions' boundaries of the input image I. FINDBORDERS returns a binary image with the regions' boundaries of the input image I. The input image I must be a binary image. The returned image Im takes the value 1 if the corresponding pixel in I has the value 1 and at least one neighboring pixel with value 0. Otherwise Im takes the value 0. Author ------ Alceu Ferraz Costa email: alceufc [at] icmc [dot] usp [dot] br- Parameters:
I
-- Returns:
-
otsurec
private void otsurec(short[] I, int ttotal)
OTSUREC Returns a set of thresholds for the input image using the multi-level otsu algorith. OTSUREC computes a set T of thresholds from the input image I employing the multi-level Otsu algorithm. The multi-level Otsu algorithm consists in finding the threshold that minimizes the input image intra-class variance. Then, recursively, the Otsu algorithm is applied to each image region until ttotal threholds are found.- Parameters:
I
-ttotal
-
-
otsurec_helper
private void otsurec_helper(int lowerBin, int upperBin, int tLower, int tUpper)
-
otsu
private int otsu(int[] counts)
-
-