Package gov.nih.mipav.model.algorithms
Class AlgorithmThresholdDualRGB
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmThresholdDualRGB
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
Runs threshold (lower and upper) on color images and replaces values either outside (inverse) or inside (normal) with
the fill values specified.
- Version:
- 1.0
- Author:
- Ben Link
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag, if true, indicates that the whole image should be processed.private float[]Arrays containing fill values for each channel (red=0,green=1,blue=2).private booleanfill values are for values outside (inverse) or inside (normal/false).private intVariable that will store the total number of blue pixel values in thresholding rangeprivate intVariable that will store the total number of green pixel values in thresholding rangeprivate intVariable that will store the total number of red pixel values in thresholding rangeprivate float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]Three arrays (R,G,B) containing minimum and maximum threshold for each channel.private boolean[]Which channels to use (0 = red, 1 = green, 2 = blue).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
ConstructorsConstructorDescriptionAlgorithmThresholdDualRGB(ModelImage srcImage, float[] thresholdR, float[] thresholdG, float[] thresholdB, float[] fillValues, boolean[] useChannels, boolean maskFlag, boolean isInverse) Default constructor for running algorithm on and modifying source image.AlgorithmThresholdDualRGB(ModelImage destImg, ModelImage srcImg, float[] thresholdR, float[] thresholdG, float[] thresholdB, float[] fillValues, boolean[] useChannels, boolean maskFlag, boolean isInverse) Default constructor for running algorithm into a destination image. -
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
-
entireImage
private boolean entireImageFlag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas. -
fillValues
private float[] fillValuesArrays containing fill values for each channel (red=0,green=1,blue=2). -
isInverse
private boolean isInversefill values are for values outside (inverse) or inside (normal/false). -
thresholdB
private float[] thresholdBDOCUMENT ME! -
thresholdG
private float[] thresholdGDOCUMENT ME! -
thresholdR
private float[] thresholdRThree arrays (R,G,B) containing minimum and maximum threshold for each channel. -
useChannels
private boolean[] useChannelsWhich channels to use (0 = red, 1 = green, 2 = blue). -
pixelsInRangeR
private int pixelsInRangeRVariable that will store the total number of red pixel values in thresholding range -
pixelsInRangeG
private int pixelsInRangeGVariable that will store the total number of green pixel values in thresholding range -
pixelsInRangeB
private int pixelsInRangeBVariable that will store the total number of blue pixel values in thresholding range
-
-
Constructor Details
-
AlgorithmThresholdDualRGB
public AlgorithmThresholdDualRGB(ModelImage srcImage, float[] thresholdR, float[] thresholdG, float[] thresholdB, float[] fillValues, boolean[] useChannels, boolean maskFlag, boolean isInverse) Default constructor for running algorithm on and modifying source image.- Parameters:
srcImage- ModelImage sourcethresholdR- float[] red threshthresholdG- float[] green threshthresholdB- float[] blue threshfillValues- float[] fill values [3] (r,g,b)useChannels- boolean[] use channels [3] (r,g,b)maskFlag- boolean whole image or voiisInverse- boolean replace values outside (true) or inside (false)
-
AlgorithmThresholdDualRGB
public AlgorithmThresholdDualRGB(ModelImage destImg, ModelImage srcImg, float[] thresholdR, float[] thresholdG, float[] thresholdB, float[] fillValues, boolean[] useChannels, boolean maskFlag, boolean isInverse) Default constructor for running algorithm into a destination image.- Parameters:
destImg- ModelImage destinationsrcImg- ModelImage sourcethresholdR- float[] red threshthresholdG- float[] green threshthresholdB- float[] blue threshfillValues- float[] fill values [3] (r,g,b)useChannels- boolean[] use channels [3] (r,g,b)maskFlag- boolean whole image or voiisInverse- boolean replace values outside (true) or inside (false)
-
-
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()
-