Package gov.nih.mipav.model.algorithms
Class AlgorithmHistogram2Dim
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmHistogram2Dim
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmHistogram2Dim extends AlgorithmBase
This algorithm creates a two dimensional histogram of the data in 2 black and white images or 1 color image. if doLinearRescale is true, the range of data in the second image is rescaled to be the same as the range of data in the first image. That is the second image minimum is rescaled to the first image minimum and the second image maximum is rescaled to the first image maximum. Also, if linear rescaling is used the number of bins in the second image is set equal to the number of bins in the first image. The default number of bins equals the min(256,maximum value - minimum value + 1) if the data is not float or double. If the data is float or double, the default number of bins is 256. ch1 = 0 to ch1 = bin1 - 2 all have a width of (bin1 - 1)/range1, but ch1 = bin1 - 1 has no width, it is a single value at max1. bin ch1 = 0 covers min1 <= ch1 < min1 + (max1 - min1)/(bin1 - 1) bin ch1 = 1 covers min1 + (max1 - min1)/(bin1 - 1) <= ch1 < min1 + 2*(max1 - min1)/(bin1 - 1) bin ch1 = bin1 - 2 covers min1 + (bin1 - 2)*(max - min1)/(bin1 - 1) <= ch1 < max1 bin ch1 = bin1 - 1 covers only max1 The processing for maximum values is specially handled to prevent loss of top bin counts from rounding errors.
-
-
Field Summary
Fields Modifier and Type Field Description private ModelImage
baseImage
Image for Y-axis of Histogramprivate int
bin1
Number of bins for Image1private int
bin2
Number of bins for Image2private boolean
doLinearRescale
Boolean value.private boolean
doLogResult
Boolean value.private boolean
useBlue
For color images only.private boolean
useGreen
For color images only.private boolean
useRed
For color images only.-
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 AlgorithmHistogram2Dim(ModelImage destImg, ModelImage srcImg, boolean doLinearRescale, boolean doLogResult, int bin1, int bin2, boolean useRed, boolean useGreen, boolean useBlue)
Constructor for images in which 2D histogram is placed in a predetermined destination image.AlgorithmHistogram2Dim(ModelImage destImg, ModelImage srcImg, ModelImage baseImage, boolean doLinearRescale, boolean doLogResult, int bin1, int bin2)
Constructor for images in which 2D histogram is placed in a predetermined destination image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calcStoreInDest()
This function produces a 2D histogram image with srcImage values represented across the x axis and baseImage values represented across the y axis.private void
calcStoreInDestColor()
This function produces a 2D histogram image with first color values represented across the x axis and second color values represented across the y axis.void
finalize()
Prepares this class for destruction.void
runAlgorithm()
starts the 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
-
baseImage
private ModelImage baseImage
Image for Y-axis of Histogram
-
bin1
private int bin1
Number of bins for Image1
-
bin2
private int bin2
Number of bins for Image2
-
doLinearRescale
private boolean doLinearRescale
Boolean value. If true baseImage (Image2) is rescaled to the range of source image (Image1)
-
doLogResult
private boolean doLogResult
Boolean value. If true, the log of the result image is displayed for better visualization
-
useBlue
private boolean useBlue
For color images only. If true blue image is used as one of the images to create a 2D Histogram
-
useGreen
private boolean useGreen
For color images only. If true green image is used as one of the images to create a 2D Histogram
-
useRed
private boolean useRed
For color images only. If true red image is used as one of the images to create a 2D Histogram
-
-
Constructor Detail
-
AlgorithmHistogram2Dim
public AlgorithmHistogram2Dim(ModelImage destImg, ModelImage srcImg, ModelImage baseImage, boolean doLinearRescale, boolean doLogResult, int bin1, int bin2)
Constructor for images in which 2D histogram is placed in a predetermined destination image. Used for 2 black and white images- Parameters:
destImg
- image model where result image is to storedsrcImg
- image for x axis of histogrambaseImage
- image for y axis of histogramdoLinearRescale
- If true rescales the Image2 data to the range of Image1 datadoLogResult
- If true, displays the log of the result image for better visualizationbin1
- Number of bins on x-axis (Image1)bin2
- Number of bins in y-axis (Image2)
-
AlgorithmHistogram2Dim
public AlgorithmHistogram2Dim(ModelImage destImg, ModelImage srcImg, boolean doLinearRescale, boolean doLogResult, int bin1, int bin2, boolean useRed, boolean useGreen, boolean useBlue)
Constructor for images in which 2D histogram is placed in a predetermined destination image. Used for 1 color image.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image modeldoLinearRescale
- If true rescales the Image2 data to the range of Image1 datadoLogResult
- If true, displays the log of the result image for better visualizationbin1
- Number of bins on x-axis (Image1)bin2
- Number of bins in y-axis (Image2)useRed
- For color images only. If true red image is used as one of the images to create a 2D HistogramuseGreen
- For color images only. If true green image is used as one of the images to create a 2D HistogramuseBlue
- For color images only. If true blue image is used as one of the images to create a 2D Histogram
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
starts the algorithm.- Specified by:
runAlgorithm
in classAlgorithmBase
-
calcStoreInDest
private void calcStoreInDest()
This function produces a 2D histogram image with srcImage values represented across the x axis and baseImage values represented across the y axis.
-
calcStoreInDestColor
private void calcStoreInDestColor()
This function produces a 2D histogram image with first color values represented across the x axis and second color values represented across the y axis.
-
-