Class AlgorithmChangeType
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.utilities.AlgorithmChangeType
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmChangeType extends AlgorithmBase
This is a convenience function to convert from one image type to another and remap the data into a new range. It assumes that that calling function has checked that the range values are in the range of the image type. For example, an Unsigned Byte image type can represent data from 0 - 255 and therefore if converting from a Short type (-32768 to 32767) the range parameters should fall between 0 and 255. This class can also be used to remap data to a different range without changing the data type! In going between COMPLEX and DCOMPLEX the real and imaginary signs should not be changed and the imaginary/real ratios should not be changed so just multiply both the real and imaginary parts by endRange2/endRange1.- Version:
- 0.1 June 15, 1998
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
ModelImage
-
-
Field Summary
Fields Modifier and Type Field Description private int
colorFactor
1 for black and white, 4 for color.private int
complexFactor
1 for real images, 2 for complex.private double
endRange1
The ending range value of the input image.private double
endRange2
The ending range value of the output image.private ModelStorageBase.DataType
newType
Indicates the new data type which the image should be converted to.private double
stRange1
The starting range value of the input image.private double
stRange2
The starting range value of the output 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, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmChangeType(ModelImage srcImg, int newType, double stRge1, double endRge1, double stRge2, double endRge2, boolean img25D)
Creates a new AlgorithmChangeType object.AlgorithmChangeType(ModelImage destImg, ModelImage srcImg, double stRge1, double endRge1, double stRge2, double endRge2, boolean img25D)
Creates a new AlgorithmChangeType object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calcInPlace2D()
This function replaces the source image with the new type image and new data range.private void
calcInPlace34D()
This function replaces the source image with the new type image and new data range.private void
calcStoreInDest2D()
This function produces a new image with the new data type and new data range.private void
calcStoreInDest34D()
This function produces a new image with the new data type and new data range.void
finalize()
Prepares this class for destruction.void
runAlgorithm()
Start algorithm.-
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
-
colorFactor
private int colorFactor
1 for black and white, 4 for color.
-
complexFactor
private int complexFactor
1 for real images, 2 for complex.
-
endRange1
private double endRange1
The ending range value of the input image. Typically the image maximum.
-
endRange2
private double endRange2
The ending range value of the output image.
-
newType
private ModelStorageBase.DataType newType
Indicates the new data type which the image should be converted to.- See Also:
ModelStorageBase
-
stRange1
private double stRange1
The starting range value of the input image. Typically the image minimum.
-
stRange2
private double stRange2
The starting range value of the output image.
-
-
Constructor Detail
-
AlgorithmChangeType
public AlgorithmChangeType(ModelImage destImg, ModelImage srcImg, double stRge1, double endRge1, double stRge2, double endRge2, boolean img25D)
Creates a new AlgorithmChangeType object.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image modelstRge1
- starting value of intensities of the source imageendRge1
- ending value of intensities of the source imagestRge2
- starting value of intensities of the destination imageendRge2
- ending value of intensities of the destination imageimg25D
- DOCUMENT ME!
-
AlgorithmChangeType
public AlgorithmChangeType(ModelImage srcImg, int newType, double stRge1, double endRge1, double stRge2, double endRge2, boolean img25D)
Creates a new AlgorithmChangeType object.- Parameters:
srcImg
- source image modelnewType
- new type that the source image is to become.stRge1
- starting value of intensities of the source imageendRge1
- ending value of intensities of the source imagestRge2
- starting value of intensities of the destination imageendRge2
- ending value of intensities of the destination imageimg25D
- DOCUMENT ME!
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Start algorithm.- Specified by:
runAlgorithm
in classAlgorithmBase
-
calcInPlace2D
private void calcInPlace2D()
This function replaces the source image with the new type image and new data range.
-
calcInPlace34D
private void calcInPlace34D()
This function replaces the source image with the new type image and new data range.
-
calcStoreInDest2D
private void calcStoreInDest2D()
This function produces a new image with the new data type and new data range.
-
calcStoreInDest34D
private void calcStoreInDest34D()
This function produces a new image with the new data type and new data range.
-
-