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:
ActionListener,WindowListener,Runnable,EventListener
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 invalid input: '<'= ch1 invalid input: '<' min1 + (max1 - min1)/(bin1 - 1)
bin ch1 = 1 covers min1 + (max1 - min1)/(bin1 - 1) invalid input: '<'= ch1 invalid input: '<' min1 + 2*(max1 - min1)/(bin1 - 1)
bin ch1 = bin1 - 2 covers min1 + (bin1 - 2)*(max - min1)/(bin1 - 1) invalid input: '<'= ch1 invalid input: '<' 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ModelImageImage for Y-axis of Histogramprivate intNumber of bins for Image1private intNumber of bins for Image2private booleanBoolean value.private booleanBoolean value.private booleanFor color images only.private booleanFor color images only.private booleanFor 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, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmHistogram2Dim(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
Modifier and TypeMethodDescriptionprivate voidThis function produces a 2D histogram image with srcImage values represented across the x axis and baseImage values represented across the y axis.private voidThis function produces a 2D histogram image with first color values represented across the x axis and second color values represented across the y axis.voidfinalize()Prepares this class for destruction.voidstarts 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, 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
-
baseImage
Image for Y-axis of Histogram -
bin1
private int bin1Number of bins for Image1 -
bin2
private int bin2Number of bins for Image2 -
doLinearRescale
private boolean doLinearRescaleBoolean value. If true baseImage (Image2) is rescaled to the range of source image (Image1) -
doLogResult
private boolean doLogResultBoolean value. If true, the log of the result image is displayed for better visualization -
useBlue
private boolean useBlueFor color images only. If true blue image is used as one of the images to create a 2D Histogram -
useGreen
private boolean useGreenFor color images only. If true green image is used as one of the images to create a 2D Histogram -
useRed
private boolean useRedFor color images only. If true red image is used as one of the images to create a 2D Histogram
-
-
Constructor Details
-
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 Details
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()starts the algorithm.- Specified by:
runAlgorithmin 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.
-