Class AlgorithmGradientMagnitudeSep
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmGradientMagnitudeSep
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmGradientMagnitudeSep extends AlgorithmBase
Calculates the gradient magnitude of an image at a scale defined by the user (using separable convolutions). Adapted from AlgorithmGradientMagnitude. This version should be faster but uses significantly more memory.Produces equivalent result images to AlgorithmGradientMagnitude (aside from some rounding error that seems to be at most 10^-4)
- Version:
- 0.1 July 31, 2003
- Author:
- Evan McCreedy
- See Also:
AlgorithmGradientMagnitude
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
blue
DOCUMENT ME!private boolean
directionNeeded
private boolean
doEndSlices
private boolean
entireImage
Flag, if true, indicates that the whole image should be processed.private Kernel
gaussianKernel
private boolean
green
DOCUMENT ME!private int[]
kExtents
private boolean
normalized
private float[]
outputBuffer
private boolean
red
Flags indicate which color channel to process.private float[]
sigmas
Standard deviations of the gaussian used to calculate the kernels.private float[]
xDerivativeDirections
private float[]
yDerivativeDirections
private int
zEnd
-
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 AlgorithmGradientMagnitudeSep(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D)
Creates a new AlgorithmGradientMagnitudeSep object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterExecute()
void
beforeExecute()
private float[]
calculateDerivativeImage(float[] imgData, int[] imgExtents, boolean color, float[][] kernelData, int progressFrom, int progressTo)
int
calculateValidEndZIndex()
int
calculateValidStartZIndex()
void
execute()
void
finalize()
Prepares this class for destruction.int[]
getKExtents()
float[]
getResultBuffer()
float[]
getXDerivativeDirections()
float[]
getYDerivativeDirections()
private boolean
is3DKernel()
boolean
isDirectionNeeded()
boolean
isNormalized()
private float[]
magnitude(float[] buffer, int cFactor, float[] xDerivatives, float[] yDerivatives, float[] zDerivatives, int progressFrom, int progressTo)
void
runAlgorithm()
Starts the program.void
setBlue(boolean flag)
Sets the flag for the blue channel.void
setDirectionNeeded(boolean directionNeeded)
void
setGreen(boolean flag)
Sets the flag for the green channel.void
setNormalized(boolean normalized)
void
setRed(boolean flag)
Sets the flag for the red channel.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, 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, 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
-
blue
private boolean blue
DOCUMENT ME!
-
entireImage
private boolean entireImage
Flag, if true, indicates that the whole image should be processed. If false only process the image over the mask areas.
-
green
private boolean green
DOCUMENT ME!
-
gaussianKernel
private Kernel gaussianKernel
-
red
private boolean red
Flags indicate which color channel to process. True indicates the channel should be processed.
-
sigmas
private float[] sigmas
Standard deviations of the gaussian used to calculate the kernels.
-
outputBuffer
private float[] outputBuffer
-
normalized
private boolean normalized
-
directionNeeded
private boolean directionNeeded
-
xDerivativeDirections
private float[] xDerivativeDirections
-
yDerivativeDirections
private float[] yDerivativeDirections
-
zEnd
private int zEnd
-
doEndSlices
private boolean doEndSlices
-
kExtents
private int[] kExtents
-
-
Constructor Detail
-
AlgorithmGradientMagnitudeSep
public AlgorithmGradientMagnitudeSep(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D)
Creates a new AlgorithmGradientMagnitudeSep object.- Parameters:
srcImg
- source image modelsigmas
- Gaussian standard deviations in each dimensionmaskFlag
- Flag, if true, indicates that the gradient magnitude will be calculated for the whole imageimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
-
-
Method Detail
-
beforeExecute
public void beforeExecute()
-
execute
public void execute()
-
afterExecute
public void afterExecute()
-
calculateDerivativeImage
private float[] calculateDerivativeImage(float[] imgData, int[] imgExtents, boolean color, float[][] kernelData, int progressFrom, int progressTo)
-
magnitude
private float[] magnitude(float[] buffer, int cFactor, float[] xDerivatives, float[] yDerivatives, float[] zDerivatives, int progressFrom, int progressTo)
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
setBlue
public void setBlue(boolean flag)
Sets the flag for the blue channel.- Parameters:
flag
- if set to true then the blue channel is processed.
-
setGreen
public void setGreen(boolean flag)
Sets the flag for the green channel.- Parameters:
flag
- if set to true then the green channel is processed.
-
setRed
public void setRed(boolean flag)
Sets the flag for the red channel.- Parameters:
flag
- if set to true then the red channel is processed.
-
getResultBuffer
public float[] getResultBuffer()
-
getXDerivativeDirections
public float[] getXDerivativeDirections()
-
getYDerivativeDirections
public float[] getYDerivativeDirections()
-
isNormalized
public boolean isNormalized()
-
setNormalized
public void setNormalized(boolean normalized)
-
isDirectionNeeded
public boolean isDirectionNeeded()
-
setDirectionNeeded
public void setDirectionNeeded(boolean directionNeeded)
-
is3DKernel
private boolean is3DKernel()
-
calculateValidStartZIndex
public int calculateValidStartZIndex()
-
calculateValidEndZIndex
public int calculateValidEndZIndex()
-
getKExtents
public int[] getKExtents()
-
-