Class AlgorithmImageMath
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
- Version:
- 1.0 Dec 30, 1999
- Author:
- Matthew J. McAuliffe, Ph.D.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private doubleMaximum clipping modes if data result value exceeds the capacity of image's data type.private doubleMinimum clipping modes if data result value exceeds the capacity of image's data type.private intClipping mode.static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private booleanFlag, if true, indicates that the whole image should be processed.static final intstatic final intDOCUMENT ME!static final intDOCUMENT ME!private doubleUsed to store the image maximum.private doubleprivate doubleprivate doubleprivate doubleUsed to store the image minimum.private doubleprivate doubleprivate doublestatic final intDOCUMENT ME!private AlgorithmImageMath.OperatorOperation to be performed on the images (i.e.static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private booleanDOCUMENT ME!private doublethe value to modify the image with.private doubleprivate doubleimaginary part of value to modify complex or dcomplex image with or green color of color image.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
ConstructorsConstructorDescriptionAlgorithmImageMath(ModelImage srcImg, int type, double val, double valI, double valB, int _clipMode, boolean maskFlag) Creates a new AlgorithmImageMath object.AlgorithmImageMath(ModelImage destImg, ModelImage srcImg, int type, double val, double valI, double valB, int _clipMode, boolean maskFlag) Creates a new AlgorithmImageMath object. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidGenerates the new data and places in the source image.private voidprivate voidGenerates the new data and places in the source image.private voidGenerates the new data and places in a new (destination) image.private voidprivate voidGenerates 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 intpromoteType(int presentType) DOCUMENT ME!voidStarts the program.private voidSets 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, 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
-
ABSOLUTE_VALUE
public static final int ABSOLUTE_VALUEDOCUMENT ME!- See Also:
-
ADD
public static final int ADDDOCUMENT ME!- See Also:
-
AVERAGE
public static final int AVERAGEDOCUMENT ME!- See Also:
-
CONSTANT
public static final int CONSTANTDOCUMENT ME!- See Also:
-
DIVIDE
public static final int DIVIDEDOCUMENT ME!- See Also:
-
LOG
public static final int LOGDOCUMENT ME!- See Also:
-
MULTIPLY
public static final int MULTIPLYDOCUMENT ME!- See Also:
-
SQUARE
public static final int SQUAREDOCUMENT ME!- See Also:
-
SQUARE_ROOT
public static final int SQUARE_ROOTDOCUMENT ME!- See Also:
-
SUBTRACT
public static final int SUBTRACTDOCUMENT ME!- See Also:
-
SUM
public static final int SUMDOCUMENT ME!- See Also:
-
INVERSE
public static final int INVERSEDOCUMENT ME!- See Also:
-
EXP
public static final int EXP- See Also:
-
CLIP
public static final int CLIPDOCUMENT ME!- See Also:
-
PROMOTE
public static final int PROMOTEDOCUMENT ME!- See Also:
-
CONVERT_FLOAT
public static final int CONVERT_FLOATDOCUMENT ME!- See Also:
-
clipMax
private double clipMaxMaximum clipping modes if data result value exceeds the capacity of image's data type. -
clipMin
private double clipMinMinimum clipping modes if data result value exceeds the capacity of image's data type. -
clipMode
private int clipModeClipping 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). FLOAT = 2; Convert image to float -
entireImage
private boolean entireImageFlag, if true, indicates that the whole image should be processed. If false, process the image over the mask areas. -
max
private double maxUsed to store the image maximum. -
min
private double minUsed to store the image minimum. -
minR
private double minR -
maxR
private double maxR -
minG
private double minG -
maxG
private double maxG -
minB
private double minB -
maxB
private double maxB -
opType
Operation to be performed on the images (i.e. Add, ...) -
useComplex
private boolean useComplexDOCUMENT ME! -
value
private double valuethe value to modify the image with. -
valueI
private double valueIimaginary part of value to modify complex or dcomplex image with or green color of color image. -
valueB
private double valueB
-
-
Constructor Details
-
AlgorithmImageMath
public AlgorithmImageMath(ModelImage srcImg, int type, double val, double valI, double valB, int _clipMode, boolean maskFlag) Creates a new AlgorithmImageMath object.- Parameters:
srcImg- source image modeltype- operation type to be performed on the imageval- value applied to the imagevalI- imaginary part of value applied if image is of complex type or green part of color if color imagevalB- blue part of color image_clipMode- clamp data to image type range or promote image type to hold new data range.maskFlag- Flag that indicates that the operator will be calculated for the whole image if equal to true
-
AlgorithmImageMath
public AlgorithmImageMath(ModelImage destImg, ModelImage srcImg, int type, double val, double valI, double valB, int _clipMode, boolean maskFlag) Creates a new AlgorithmImageMath object.- Parameters:
destImg- image model where result image is to storedsrcImg- source image modeltype- operation type to be performed on the imageval- value applied to the imagevalI- imaginary part of value applied if image is of complex type or green part of color if color imagevalB- blue part of color image_clipMode- clamp data to image type range or promote image type to hold new data range.maskFlag- Flag that indicates that the operator will be calculated for the whole image if equal to true
-
-
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
-
calcInPlaceColor
private void calcInPlaceColor() -
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.
-
calcInPlaceComplex
private void calcInPlaceComplex()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.
-
calcStoreInDestColor
private void calcStoreInDestColor() -
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.
-
calcStoreInDestComplex
private void calcStoreInDestComplex()Generates the new data and places in a new (destination) image. -
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.
-
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
-