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:
java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class AlgorithmThresholdDualRGB extends AlgorithmBase
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
-
-
Field Summary
Fields Modifier and Type Field Description private booleanentireImageFlag, if true, indicates that the whole image should be processed.private float[]fillValuesArrays containing fill values for each channel (red=0,green=1,blue=2).private booleanisInversefill values are for values outside (inverse) or inside (normal/false).private intpixelsInRangeBVariable that will store the total number of blue pixel values in thresholding rangeprivate intpixelsInRangeGVariable that will store the total number of green pixel values in thresholding rangeprivate intpixelsInRangeRVariable that will store the total number of red pixel values in thresholding rangeprivate float[]thresholdBDOCUMENT ME!private float[]thresholdGDOCUMENT ME!private float[]thresholdRThree arrays (R,G,B) containing minimum and maximum threshold for each channel.private boolean[]useChannelsWhich 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, threadStopped
-
-
Constructor Summary
Constructors Constructor Description 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.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcalcInPlace2D()Replace 2D source image with the thresholded image.private voidcalcInPlace34D()Replace 3D or 4D source image with the thresholded image.private voidcalcStoreInDest2D()Stores the thresholded image into the destination image.private voidcalcStoreInDest34D()Stores the thresholded image into the destination image.voidfinalize()Prepares this class for destruction.voidrunAlgorithm()Starts the program.private voidsetThresholdStatistics()-
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
Flag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas.
-
fillValues
private float[] fillValues
Arrays containing fill values for each channel (red=0,green=1,blue=2).
-
isInverse
private boolean isInverse
fill values are for values outside (inverse) or inside (normal/false).
-
thresholdB
private float[] thresholdB
DOCUMENT ME!
-
thresholdG
private float[] thresholdG
DOCUMENT ME!
-
thresholdR
private float[] thresholdR
Three arrays (R,G,B) containing minimum and maximum threshold for each channel.
-
useChannels
private boolean[] useChannels
Which channels to use (0 = red, 1 = green, 2 = blue).
-
pixelsInRangeR
private int pixelsInRangeR
Variable that will store the total number of red pixel values in thresholding range
-
pixelsInRangeG
private int pixelsInRangeG
Variable that will store the total number of green pixel values in thresholding range
-
pixelsInRangeB
private int pixelsInRangeB
Variable that will store the total number of blue pixel values in thresholding range
-
-
Constructor Detail
-
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 Detail
-
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()
-
-