Class AlgorithmNonlocalMeansFilter
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmNonlocalMeansFilter
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmNonlocalMeansFilter extends AlgorithmBase
This is a port of the 09/03/2006 NLmeansfilter.m and UNLmeansfilter2.m on 02/15/2008 by Jose Vicente Manjon Herrera & Antoni Buades. The code in NLmeansfilter.m is an implementation of the algorithm in the article "A non-local algorithm for image denoising" by Antoni Buades and Jean-Michel Morel. The code in UNLmeansfilter2.m is an implementation of the algortihm in the article "MRI denoising using non-Local Means" by Jose Manjon, Jose Carbonell-Caballero, Juan J. Lull, Gracian Garcia-Marti, Luis Marti-Bonmati, Montserratt Robles, Medical Image Analysis 12 (2008), pp. 514-523. For post processing with Bayes shrink threshold computation: B. K. Shreyamsha Kumar, "Image Denoising based on Non Local-means Filter and its Method Noise Thresholding", Signal, Image and Video Processing, Vol. 7, Issue 6, pp. 1211-1227, 2013. (doi: 10.1007/s11760-012-0389-y) unbiased nonlocal means (value) = sqrt((nonlocal means (value))**2 - 2* sigma**2) For Rician noise standard deviation = sqrt(background mean/2)
-
-
Field Summary
Fields Modifier and Type Field Description private float
degreeOfFiltering
Used only with Rician noise filter.private boolean
do25D
In 3D if do25D == true, process each slice separately.private boolean
doBayesShrinkThresholdComputation
private boolean
doRician
If true, use unbiased version of NLM to deal with Rician noise in MRIprivate boolean
estimateNoiseStandardDeviation
private float
noiseStandardDeviation
Noise standard deviationprivate int
searchWindowSide
Side of the learning window of pixels which will be averaged.private int
similarityWindowSide
Comparsion window.-
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 AlgorithmNonlocalMeansFilter(ModelImage destImage, ModelImage srcImg, int searchWindowSide, int similarityWindowSide, boolean estimateNoiseStandardDeviation, float noiseStandardDeviation, float degreeOfFiltering, boolean doRician, boolean do25D, boolean doBayesShrinkThresholdComputation)
Creates a new AlgorithmNonlocalMeans object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for destruction.private void
run2D()
private void
run2DRician()
private void
run3D()
private void
run3DRician()
void
runAlgorithm()
Starts the nonlocal means filter 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
-
searchWindowSide
private int searchWindowSide
Side of the learning window of pixels which will be averaged. Sizes generally range from about 15 X 15 to 21 X 21.
-
similarityWindowSide
private int similarityWindowSide
Comparsion window. This should be smaller than the search window size. In a non-noisy image it can be set to 3 X 3. The value increases with the amount of noise. In general, for noisy images 7 X 7 or 9 X 9 is a good size.
-
estimateNoiseStandardDeviation
private boolean estimateNoiseStandardDeviation
-
noiseStandardDeviation
private float noiseStandardDeviation
Noise standard deviation
-
degreeOfFiltering
private float degreeOfFiltering
Used only with Rician noise filter. Should theoretically be around sqrt(2).
-
doRician
private boolean doRician
If true, use unbiased version of NLM to deal with Rician noise in MRI
-
do25D
private boolean do25D
In 3D if do25D == true, process each slice separately.
-
doBayesShrinkThresholdComputation
private boolean doBayesShrinkThresholdComputation
-
-
Constructor Detail
-
AlgorithmNonlocalMeansFilter
public AlgorithmNonlocalMeansFilter(ModelImage destImage, ModelImage srcImg, int searchWindowSide, int similarityWindowSide, boolean estimateNoiseStandardDeviation, float noiseStandardDeviation, float degreeOfFiltering, boolean doRician, boolean do25D, boolean doBayesShrinkThresholdComputation)
Creates a new AlgorithmNonlocalMeans object.- Parameters:
destImage
- denoised imagesrcImg
- 2D or 3D source imagesearchWindowSide
- Side of the learning window of pixels which will be averagedsimilarityWindowSide
- Side of the comparsion windowestimateNoiseStandardDeviation
-noiseStandardDeviation
- Noise standard deviationdegreeOfFiltering
- degree of filtering - used only for Rician noise filterdo25D
- If true, do slice by slice filteringdoBayesShrinkThresholdComputation
-
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the nonlocal means filter algorithm.- Specified by:
runAlgorithm
in classAlgorithmBase
-
run2D
private void run2D()
-
run2DRician
private void run2DRician()
-
run3D
private void run3D()
-
run3DRician
private void run3DRician()
-
-