Class AlgorithmTrilateralFilter
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmTrilateralFilter
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmTrilateralFilter extends AlgorithmBase
This is a port of openCVtrilateralFilter.h and openCVtrilateralFilter.cpp written by Tobi Vaudrey. These files were released under the 3-clause BSD license References: 1.) "Fast Trilateral Filtering" by Tobi Vaudrey and Reinhard Klette, Conference Paper in Lecture Notes in Computer Science, September, 2009, DOI: 10.1007/978-3-642-03767-2_66 2.) "The Trilateral Filter for High Contrast Images and Meshes" by Prasun Choudhury and Jack Tumblin, Eurographics Symposium on Rendering 2003, pp. 1-11, Per Christensen and Daniel Cohen-Or (Editors) By downloading, copying, installing or using the software you agree to this license. If you do not agree to this license, do not download, install, copy or use the software. License Agreement For Open Source Computer Vision Library (3-clause BSD License) Copyright (C) 2000-2020, Intel Corporation, all rights reserved. Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved. Copyright (C) 2015-2016, Itseez Inc., all rights reserved. Copyright (C) 2019-2020, Xperience AI, all rights reserved. Third party copyrights are property of their respective owners. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall copyright holders or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. (c) 2021 GitHub, Inc.
-
-
Field Summary
Fields Modifier and Type Field Description int
BORDER_CONSTANT
int
BORDER_DEFAULT
int
BORDER_REFLECT
int
BORDER_REFLECT_101
int
BORDER_REPLICATE
int
BORDER_WRAP
private double
epsilon
private int
filterType
private int
length
private double
sigmaC
private int
TYPE_FAST
private int
TYPE_LUT
private int
xDim
private int
yDim
-
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 AlgorithmTrilateralFilter()
AlgorithmTrilateralFilter(ModelImage destImg, ModelImage srcImg, double sigmaC, double epsilon, int filterType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
BilateralGradientFilter(double[][] xGradient, double[][] yGradient, double[][] gradientMagnitude, double sigmaC, double sigmaR, double epsilon, double[][] xGradientSmooth, double[][] yGradientSmooth)
void
BilateralGradientFilterLUT(double[][] xGradient, double[][] yGradient, double[][] gradientMagnitude, double sigmaC, double sigmaR, double[][] xGradientSmooth, double[][] yGradientSmooth)
void
buildMinMaxImageStack(double[][] gradientMagnitude, double[][][] minStack, double[][][] maxStack)
void
computeGradients(double[][] inputImg, double[][] xGradient, double[][] yGradient)
void
computeMagnitude(double[][] xGradient, double[][] yGradient, double[][] gradientMagnitude)
double[][]
copyMakeBorder(double[][] src, int top, int bottom, int left, int right, int borderType, double borderValue)
void
DetailBilateralFilter(double[][] inputImage, double[][] adaptiveRegion, double[][] xGradientSmooth, double[][] yGradientSmooth, double sigmaC, double sigmaR, int maxDomainSize, double epsilon, double[][] outputImg)
void
DetailBilateralFilterLUT(double[][] inputImage, double[][] adaptiveRegion, double[][] xGradientSmooth, double[][] yGradientSmooth, double sigmaC, double sigmaR, int maxDomainSize, double[][] outputImg)
private int
log2(int input, boolean roundUp)
void
minMaxLoc(double[][] input, double[] minGrad, double[] maxGrad)
void
runAlgorithm()
Actually runs the algorithm.void
setAdaptiveNeighbourHood(double[][] gradientMagnitude, double sigmaR, int maxLevel, double[][] adaptiveNeighborhood)
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, 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
-
BORDER_CONSTANT
public final int BORDER_CONSTANT
- See Also:
- Constant Field Values
-
BORDER_REPLICATE
public final int BORDER_REPLICATE
- See Also:
- Constant Field Values
-
BORDER_REFLECT
public final int BORDER_REFLECT
- See Also:
- Constant Field Values
-
BORDER_WRAP
public final int BORDER_WRAP
- See Also:
- Constant Field Values
-
BORDER_REFLECT_101
public final int BORDER_REFLECT_101
- See Also:
- Constant Field Values
-
BORDER_DEFAULT
public final int BORDER_DEFAULT
- See Also:
- Constant Field Values
-
sigmaC
private double sigmaC
-
epsilon
private double epsilon
-
TYPE_LUT
private final int TYPE_LUT
- See Also:
- Constant Field Values
-
TYPE_FAST
private final int TYPE_FAST
- See Also:
- Constant Field Values
-
filterType
private int filterType
-
xDim
private int xDim
-
yDim
private int yDim
-
length
private int length
-
-
Constructor Detail
-
AlgorithmTrilateralFilter
public AlgorithmTrilateralFilter()
-
AlgorithmTrilateralFilter
public AlgorithmTrilateralFilter(ModelImage destImg, ModelImage srcImg, double sigmaC, double epsilon, int filterType)
-
-
Method Detail
-
log2
private int log2(int input, boolean roundUp)
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
computeGradients
public void computeGradients(double[][] inputImg, double[][] xGradient, double[][] yGradient)
-
computeMagnitude
public void computeMagnitude(double[][] xGradient, double[][] yGradient, double[][] gradientMagnitude)
-
minMaxLoc
public void minMaxLoc(double[][] input, double[] minGrad, double[] maxGrad)
-
setAdaptiveNeighbourHood
public void setAdaptiveNeighbourHood(double[][] gradientMagnitude, double sigmaR, int maxLevel, double[][] adaptiveNeighborhood)
-
buildMinMaxImageStack
public void buildMinMaxImageStack(double[][] gradientMagnitude, double[][][] minStack, double[][][] maxStack)
-
BilateralGradientFilterLUT
public void BilateralGradientFilterLUT(double[][] xGradient, double[][] yGradient, double[][] gradientMagnitude, double sigmaC, double sigmaR, double[][] xGradientSmooth, double[][] yGradientSmooth)
-
BilateralGradientFilter
public void BilateralGradientFilter(double[][] xGradient, double[][] yGradient, double[][] gradientMagnitude, double sigmaC, double sigmaR, double epsilon, double[][] xGradientSmooth, double[][] yGradientSmooth)
-
DetailBilateralFilterLUT
public void DetailBilateralFilterLUT(double[][] inputImage, double[][] adaptiveRegion, double[][] xGradientSmooth, double[][] yGradientSmooth, double sigmaC, double sigmaR, int maxDomainSize, double[][] outputImg)
-
DetailBilateralFilter
public void DetailBilateralFilter(double[][] inputImage, double[][] adaptiveRegion, double[][] xGradientSmooth, double[][] yGradientSmooth, double sigmaC, double sigmaR, int maxDomainSize, double epsilon, double[][] outputImg)
-
copyMakeBorder
public double[][] copyMakeBorder(double[][] src, int top, int bottom, int left, int right, int borderType, double borderValue)
-
-