Class AlgorithmUnsharpMask
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmUnsharpMask
-
- All Implemented Interfaces:
AlgorithmInterface
,java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmUnsharpMask extends AlgorithmBase implements AlgorithmInterface
Calculates the Unsharp Mask of an image at a scale defined by the user ( unsharp image = original image - weight * blurred image); weight- Version:
- 1.0 Feb 11, 2000
- Author:
- Matthew J. McAuliffe, Ph.D.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
cubic
private boolean
entireImage
DOCUMENT ME!private float[]
gaussData
DOCUMENT ME!private int[]
kExtents
DOCUMENT ME!private double
maximumCorrection
private float[]
outputBuffer
private float[]
sigmas
DOCUMENT ME!private double
weightA
-
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 AlgorithmUnsharpMask(ModelImage srcImg, float[] sigmas, double weight, boolean maskFlag, boolean img25D, boolean cubic, double maximumCorrection)
Constructor.AlgorithmUnsharpMask(ModelImage destImg, ModelImage srcImg, float[] sigmas, double weight, boolean maskFlag, boolean img25D, boolean cubic, double maximumCorrection)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
algorithmPerformed(AlgorithmBase algorithm)
Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).private void
calcInPlace2D(int nImages)
calculates the blurred image and replaces the source image with the blurred image.private void
calcInPlace3D()
calculates the UnsharpMask and replaces the source image with the new image.private void
calcStoreInDest2D(int nImages)
this function produces a new image that has been blurred.private void
calcStoreInDest3D()
this function produces the UnsharpMask of input image.void
finalize()
prepares this class for destruction.private void
makeKernels2D()
creates Gaussian kernels for the blurring process.private void
makeKernels3D()
creates Gaussian kernels for the blurring process.void
runAlgorithm()
starts the program.private void
runCubicAlgorithm()
-
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
-
entireImage
private boolean entireImage
DOCUMENT ME!
-
gaussData
private float[] gaussData
DOCUMENT ME!
-
kExtents
private int[] kExtents
DOCUMENT ME!
-
sigmas
private float[] sigmas
DOCUMENT ME!
-
weightA
private double weightA
-
outputBuffer
private float[] outputBuffer
-
cubic
private boolean cubic
-
maximumCorrection
private double maximumCorrection
-
-
Constructor Detail
-
AlgorithmUnsharpMask
public AlgorithmUnsharpMask(ModelImage srcImg, float[] sigmas, double weight, boolean maskFlag, boolean img25D, boolean cubic, double maximumCorrection)
Constructor.- Parameters:
srcImg
- source image modelsigmas
- Gaussian's standard deviations in the each dimensionweight
- weighting factor, should be less than 1maskFlag
- Flag that indicates that the unsharp mask will be calculated for the whole image if equal to trueimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.cubic
- If true use nonlinear cubic filtermaximumCorrection
- absolute value of maximum correction allowed in cubic algorithm
-
AlgorithmUnsharpMask
public AlgorithmUnsharpMask(ModelImage destImg, ModelImage srcImg, float[] sigmas, double weight, boolean maskFlag, boolean img25D, boolean cubic, double maximumCorrection)
Constructor.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image modelsigmas
- Gaussian's standard deviations in the each dimensionweight
- weighting factor, should be less than 1maskFlag
- Flag that indicates that the unsharp mask will be calculated for the whole image if equal to trueimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.cubic
- If true use nonlinear cubic filtermaximumCorrection
- absolute value of maximum correction allowed in cubic algorithm
-
-
Method Detail
-
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
-
runCubicAlgorithm
private void runCubicAlgorithm()
-
calcInPlace2D
private void calcInPlace2D(int nImages)
calculates the blurred image and replaces the source image with the blurred image.- Parameters:
nImages
- number of images to be processed. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.
-
calcInPlace3D
private void calcInPlace3D()
calculates the UnsharpMask and replaces the source image with the new image.
-
calcStoreInDest2D
private void calcStoreInDest2D(int nImages)
this function produces a new image that has been blurred.- Parameters:
nImages
- number of images to be processed. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.
-
calcStoreInDest3D
private void calcStoreInDest3D()
this function produces the UnsharpMask of input image.
-
makeKernels2D
private void makeKernels2D()
creates Gaussian kernels for the blurring process.
-
makeKernels3D
private void makeKernels3D()
creates Gaussian kernels for the blurring process.
-
algorithmPerformed
public void algorithmPerformed(AlgorithmBase algorithm)
Description copied from interface:AlgorithmInterface
Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.- Specified by:
algorithmPerformed
in interfaceAlgorithmInterface
- Parameters:
algorithm
- the algorithm which has just completed
-
-