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:
ActionListener,WindowListener,Runnable,EventListener
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDOCUMENT ME!private booleanFlag, if true, indicates that the whole image should be processed.private floatAll values outside the thresholds are set to this value.private booleanInverse 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 final intDOCUMENT ME!private intType of output (same type, binary, or unsigned byte).private intVariable that will store the total number of pixels in thresholding rangeprivate float[]Array of two thresholds. threshold[0] = Minimum threshold, threshold[1] = Maximum threshold.static final intDOCUMENT 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, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmThresholdDual(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
Modifier and TypeMethodDescriptionprivate voidReplace 2D source image with the thresholded image.private voidReplace 3D or 4D source image with the thresholded image.private voidStores the thresholded image into the destination image.private voidStores the thresholded image into the destination image.voidfinalize()Prepares this class for destruction.voidStarts the program.private voidMethods 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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
ORIGINAL_TYPE
public static final int ORIGINAL_TYPEDOCUMENT ME!- See Also:
-
BINARY_TYPE
public static final int BINARY_TYPEDOCUMENT ME!- See Also:
-
UNSIGNED_BYTE_TYPE
public static final int UNSIGNED_BYTE_TYPEDOCUMENT ME!- See Also:
-
entireImage
private boolean entireImageFlag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas. -
fillValue
private float fillValueAll values outside the thresholds are set to this value. -
isInverse
private boolean isInverseInverse 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 outputTypeType of output (same type, binary, or unsigned byte). -
threshold
private float[] thresholdArray of two thresholds. threshold[0] = Minimum threshold, threshold[1] = Maximum threshold. -
pixelsInRange
private int pixelsInRangeVariable that will store the total number of pixels in thresholding range
-
-
Constructor Details
-
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 Details
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()Starts the program.- Specified by:
runAlgorithmin 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()
-