Class AlgorithmRuleBasedContrastEnhancement
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmRuleBasedContrastEnhancement
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmRuleBasedContrastEnhancement extends AlgorithmBase
This algorithm uses an equation with 3 membership functions, udark, ugray, and ubright, to transform a gray level g to a new gray level g' for histogram enhancement. Data type is promoted if necessary. g' = (udark(g)*gmin + ugray(g)*gmid + ubright(g)*gmax)/(udark(g) + ugray(g) + ubright(g)) gmin and gmax are the new user selected minimum and maximum gray scale levels, with gmin = srcMax. Must have gmin srcMax. If we were to have gmin == srcMin and gmax = srcMax, then the image would be unchanged after processing. By default gmid = (srcMin + srcMax)/2.0, but the user can select other values between srcMin and srcMax. Note that in reference 3 the authors used gmin = 0, gmid = 200, gmax = 255. udark(g) has 2 straight line segments. The first stays at 1 from gmin to srcMin. The second goes from goes from 1 at srcMin to 0 at gmid. ugray(g) has 2 line segments. The first goes from 0 at srcMin to 1 at gmid. The second goes from 1 at gmid to 0 at srcMax. udark has 2 straight line segments. The first goes from 0 at gmid to 1 at srcMax. The second stays at 1 from srcMax to gmax. References: 1.) Digital Image Processing Third Edition by Rafael C. Gonzalez and Richard E. Woods, Section 3.8.4 Using Fuzzy Sets for Intensity Transformations, Pearson Prentice Hall, 2008, pp. 186-189. 2.) Tizhoosh, H. R., "Fuzzy Image Enhancement: An Overview," in Fuzzy Techniques in Image Processing, E. Kerre and M. Nachtegael, eds., Springer-Verlag, New York, 2000, pp. 147-148. 3.) Tizhoosh HR, Krell G, and Michaelis B., "On Fuzzy Image Enhancement of Megavoltage Images in Radiation Therapy," in Proceedings of FUZZ-IEEE'97 (Barcelona), pp. 1399-1404, 1997.
-
-
Field Summary
Fields Modifier and Type Field Description private double
gmax
The new image maximum.private double
gmid
Gray scale value at which ugray(g) = 1.0.private double
gmin
The new image minimum.-
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 AlgorithmRuleBasedContrastEnhancement(ModelImage srcImg, double gmin, double gmid, double gmax)
Constructor for images in which changes are returned to the source image.AlgorithmRuleBasedContrastEnhancement(ModelImage destImg, ModelImage srcImg, double gmin, double gmid, double gmax)
Constructor for images in which changes are 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 new image that has had rule based contrast enhancementprivate void
calcStoreInPlace()
Rule based contrast enhancement of the source image.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
-
gmin
private double gmin
The new image minimum. Must have gmin-
gmid
private double gmid
Gray scale value at which ugray(g) = 1.0. By default gmid = (srcMin + srcMmax)/2.0, but it can assume any value between srcMin and srcMax
-
gmax
private double gmax
The new image maximum. Must have gmax >= srcMax
-
Constructor Detail
-
AlgorithmRuleBasedContrastEnhancement
public AlgorithmRuleBasedContrastEnhancement(ModelImage srcImg, double gmin, double gmid, double gmax)
Constructor for images in which changes are returned to the source image.- Parameters:
srcImg
- Source image model.gmin
- The new image minimumgmid
- Gray scale value at which ugray(g) = 1.0gmax
- The new image maximum
-
AlgorithmRuleBasedContrastEnhancement
public AlgorithmRuleBasedContrastEnhancement(ModelImage destImg, ModelImage srcImg, double gmin, double gmid, double gmax)
Constructor for images in which changes are placed in a predetermined destination image.- Parameters:
destImg
- Image model where result image is stored.srcImg
- Source image model.gmin
- The new image minimumgmid
- Gray scale value at which ugray(g) = 1.0gmax
- The new image maximum
-
-
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
-
calcStoreInPlace
private void calcStoreInPlace()
Rule based contrast enhancement of the source image. Replaces the original image with the processed image.
-
calcStoreInDest
private void calcStoreInDest()
This function produces a new image that has had rule based contrast enhancement
-
-
-
-