Package gov.nih.mipav.model.algorithms
Class AlgorithmThresholdDual
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmThresholdDual
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmThresholdDual extends AlgorithmBase
This algorithm has two modes of operation:1. Generates binary image based on threshold values passed in by the constructor. Inside the volume of interest: If the image intensity is greater than or equal to the threshold[0] and less than or equal to the threshold[1], the binary image is set to one. Otherwise, it is set to zero. Outside the volume of interest: The binary image is set equal to zero.
2. Inside the volume of interest: Preserves all grey scale values from threshold[0] to threshold[1] and sets all values less than the lower threshold and all values greater than the upper threshold to the fillValue supplied to this algorithm via the constructor. Outside the volume of interest: Sets all gray scale values to the fill value.
- Version:
- 1.0 March 8, 2000
- Author:
- Matthew J. McAuliffe, Ph.D.
-
-
Field Summary
Fields Modifier and Type Field Description static int
BINARY_TYPE
DOCUMENT ME!private boolean
entireImage
Flag, if true, indicates that the whole image should be processed.private float
fillValue
All values outside the thresholds are set to this value.private boolean
isInverse
Inverse threshold: false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value (fill value can also be binary (0)).static int
ORIGINAL_TYPE
DOCUMENT ME!private int
outputType
Type of output (same type, binary, or unsigned byte).private int
pixelsInRange
Variable that will store the total number of pixels in thresholding rangeprivate float[]
threshold
Array of two thresholds. threshold[0] = Minimum threshold, threshold[1] = Maximum threshold.static int
UNSIGNED_BYTE_TYPE
DOCUMENT ME!-
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 AlgorithmThresholdDual(ModelImage srcImg, float[] threshold, float fillValue, int output_type, boolean maskFlag, boolean isInverse)
Creates a new AlgorithmThresholdDual object.AlgorithmThresholdDual(ModelImage destImg, ModelImage srcImg, float[] threshold, float fillValue, int output_type, boolean maskFlag, boolean isInverse)
Creates a new AlgorithmThresholdDual object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calcInPlace2D()
Replace 2D source image with the thresholded image.private void
calcInPlace34D()
Replace 3D or 4D source image with the thresholded image.private void
calcStoreInDest2D()
Stores the thresholded image into the destination image.private void
calcStoreInDest34D()
Stores the thresholded image into the destination image.void
finalize()
Prepares this class for destruction.void
runAlgorithm()
Starts the program.private void
setThresholdStatistics()
-
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
-
ORIGINAL_TYPE
public static final int ORIGINAL_TYPE
DOCUMENT ME!- See Also:
- Constant Field Values
-
BINARY_TYPE
public static final int BINARY_TYPE
DOCUMENT ME!- See Also:
- Constant Field Values
-
UNSIGNED_BYTE_TYPE
public static final int UNSIGNED_BYTE_TYPE
DOCUMENT ME!- See Also:
- Constant Field Values
-
entireImage
private boolean entireImage
Flag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas.
-
fillValue
private float fillValue
All values outside the thresholds are set to this value.
-
isInverse
private boolean isInverse
Inverse threshold: false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value (fill value can also be binary (0)).
-
outputType
private int outputType
Type of output (same type, binary, or unsigned byte).
-
threshold
private float[] threshold
Array of two thresholds. threshold[0] = Minimum threshold, threshold[1] = Maximum threshold.
-
pixelsInRange
private int pixelsInRange
Variable that will store the total number of pixels in thresholding range
-
-
Constructor Detail
-
AlgorithmThresholdDual
public AlgorithmThresholdDual(ModelImage srcImg, float[] threshold, float fillValue, int output_type, boolean maskFlag, boolean isInverse)
Creates a new AlgorithmThresholdDual object.- Parameters:
srcImg
- source image modelthreshold
- array of two thresholdsfillValue
- all values outside the thresholds are set to this valueoutput_type
- same type, binary, or unsigned bytemaskFlag
- true indicates that the whole image should be processedisInverse
- false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value
-
AlgorithmThresholdDual
public AlgorithmThresholdDual(ModelImage destImg, ModelImage srcImg, float[] threshold, float fillValue, int output_type, boolean maskFlag, boolean isInverse)
Creates a new AlgorithmThresholdDual object.- Parameters:
destImg
- image model where result image is to be storedsrcImg
- source image modelthreshold
- array of two thresholdsfillValue
- all values outside the thresholds are set to this valueoutput_type
- same type, binary, or unsigned bytemaskFlag
- true indicates that the whole image should be processedisInverse
- false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value
-
-
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
-
calcInPlace2D
private void calcInPlace2D()
Replace 2D source image with the thresholded image.
-
calcInPlace34D
private void calcInPlace34D()
Replace 3D or 4D source image with the thresholded image.
-
calcStoreInDest2D
private void calcStoreInDest2D()
Stores the thresholded image into the destination image.
-
calcStoreInDest34D
private void calcStoreInDest34D()
Stores the thresholded image into the destination image.
-
setThresholdStatistics
private void setThresholdStatistics()
-
-