Class AlgorithmSubtractVOI
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmSubtractVOI
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class AlgorithmSubtractVOI extends AlgorithmBase
Algorithm that subtracts the mean or median value of a VOI from the image. If only 1 contour is present, that contour is used whether or not it is selected. If multiple contours are present, at least 1 contour must be selected, and only selected contours are used. Note that under MIPAV all selected contours must belong to the same VOI. If the new image exceeds the range that can be stored in an image of that type the data is either clipped and stored in the original image. Or a new image of a type (int, float...) that can store the range of new data is generated. For color the dialog currently disables promotion for color because MIPAV cannot handle negative color values.
-
-
Field Summary
Fields Modifier and Type Field Description private doubleaverageDOCUMENT ME!private floataverageBDOCUMENT ME!private floataverageGDOCUMENT ME!private intaverageModeDOCUMENT ME!private floataverageRDOCUMENT ME!static intCLIPDOCUMENT ME!private doubleclipMaxMaximum clipping modes if data result value exceeds the capacity of image's data type.private floatclipMaxCDOCUMENT ME!private doubleclipMinMinimum clipping modes if data result value exceeds the capacity of image's data type.private floatclipMinCDOCUMENT ME!private intclipModeClipping mode.private doublemaxUsed to store the image maximum.static intMEANDOCUMENT ME!static intMEDIANDOCUMENT ME!private doubleminUsed to store the image minimum.private doubleminBDOCUMENT ME!private doubleminGDOCUMENT ME!private doubleminRDOCUMENT ME!static intPROMOTEDOCUMENT 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 AlgorithmSubtractVOI(ModelImage srcImg, int _averageMode, int _clipMode)Creates a new AlgorithmSubtractVOI object.AlgorithmSubtractVOI(ModelImage destImg, ModelImage srcImg, int _averageMode, int _clipMode)Creates a new AlgorithmSubtractVOI object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcalcInPlace()Generates the new data and places in the source image.private voidcalcInPlaceColor()Generates the new data and places in the source image.private voidcalcStoreInDest()Generates the new data and places in a new (destination) image.private voidcalcStoreInDestColor()Generates the new data and places in a new (destination) image.voidfinalize()Prepares this class for destruction.private intfindType(int stType)Find the type able to contain the full range of the data.private voidgetAverage()DOCUMENT ME!private intpromoteType(int presentType)DOCUMENT ME!voidrunAlgorithm()Starts the program.private voidsetClipValues()Sets clipMin and clipMax.private booleantestType(int type, double minVal, double maxVal)Determine if the min and max values are in the image types range.-
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
-
MEAN
public static final int MEAN
DOCUMENT ME!- See Also:
- Constant Field Values
-
MEDIAN
public static final int MEDIAN
DOCUMENT ME!- See Also:
- Constant Field Values
-
CLIP
public static final int CLIP
DOCUMENT ME!- See Also:
- Constant Field Values
-
PROMOTE
public static final int PROMOTE
DOCUMENT ME!- See Also:
- Constant Field Values
-
average
private double average
DOCUMENT ME!
-
averageB
private float averageB
DOCUMENT ME!
-
averageG
private float averageG
DOCUMENT ME!
-
averageMode
private int averageMode
DOCUMENT ME!
-
averageR
private float averageR
DOCUMENT ME!
-
clipMax
private double clipMax
Maximum clipping modes if data result value exceeds the capacity of image's data type.
-
clipMaxC
private float clipMaxC
DOCUMENT ME!
-
clipMin
private double clipMin
Minimum clipping modes if data result value exceeds the capacity of image's data type.
-
clipMinC
private float clipMinC
DOCUMENT ME!
-
clipMode
private int clipMode
Clipping mode.CLIP = 0; clamp result data to the bounds of the input image type PROMOTE = 1; promote image type so that the range of the result fits into the new image type. ( ie. byte to short).
-
max
private double max
Used to store the image maximum.
-
min
private double min
Used to store the image minimum.
-
minR
private double minR
DOCUMENT ME!
-
minG
private double minG
DOCUMENT ME!
-
minB
private double minB
DOCUMENT ME!
-
-
Constructor Detail
-
AlgorithmSubtractVOI
public AlgorithmSubtractVOI(ModelImage srcImg, int _averageMode, int _clipMode)
Creates a new AlgorithmSubtractVOI object.- Parameters:
srcImg- source image model_averageMode- mean or median of VOI_clipMode- clamp data to image type range or promote image type to hold new data range.
-
AlgorithmSubtractVOI
public AlgorithmSubtractVOI(ModelImage destImg, ModelImage srcImg, int _averageMode, int _clipMode)
Creates a new AlgorithmSubtractVOI object.- Parameters:
destImg- image model where result image is to storedsrcImg- source image model_averageMode- mean or median of VOI_clipMode- clamp data to image type range or promote image type to hold new data range.
-
-
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
-
calcInPlace
private void calcInPlace()
Generates the new data and places in the source image.note that if this method is canceled part-way through a multi-sliced image, it will almost certainly be partially adjusted. This is because to save memory buffer-space, it returns an adjusted slice back to the source image after processing it; it then takes out the next slice to alter it. Canceling a job causes the current slice will not be affected, but all previous slices will be.
-
calcInPlaceColor
private void calcInPlaceColor()
Generates the new data and places in the source image.note that if this method is canceled part-way through a multi-sliced image, it will almost certainly be partially adjusted. This is because to save memory buffer-space, it returns an adjusted slice back to the source image after processing it; it then takes out the next slice to alter it. Canceling a job causes the current slice will not be affected, but all previous slices will be.
-
calcStoreInDest
private void calcStoreInDest()
Generates the new data and places in a new (destination) image.This method checks for thread halting actions more infrequently than the in-place method.
-
calcStoreInDestColor
private void calcStoreInDestColor()
Generates the new data and places in a new (destination) image.This method checks for thread halting actions more infrequently than the in-place method.
-
findType
private int findType(int stType)
Find the type able to contain the full range of the data.- Parameters:
stType- starting type of image. Image will be promoted above this type if needed.- Returns:
- type capable of storing full range of data. See ModelStorageBase for image types.
-
getAverage
private void getAverage()
DOCUMENT ME!
-
promoteType
private int promoteType(int presentType)
DOCUMENT ME!- Parameters:
presentType- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
setClipValues
private void setClipValues()
Sets clipMin and clipMax.
-
testType
private boolean testType(int type, double minVal, double maxVal)Determine if the min and max values are in the image types range.- Parameters:
type- image typeminVal- min value of the imagemaxVal- max value of the image- Returns:
- true if min and max are within the image type specified
-
-