Package gov.nih.mipav.model.algorithms
Class TVL1FLOW
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.TVL1FLOW
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class TVL1FLOW extends AlgorithmBase
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intBOUNDARY_CONDITION(package private) intBOUNDARY_CONDITION_DIRICHLET(package private) intBOUNDARY_CONDITION_PERIODIC(package private) intBOUNDARY_CONDITION_REFLECTING(package private) intDEFAULT_BOUNDARY_CONDITION(package private) intDEFAULT_GAUSSIAN_WINDOW_SIZEprivate ModelImagedestuImageprivate ModelImagedestvImageprivate doubleepsilon(package private) doubleGRAD_IS_ZEROprivate doublelambda(package private) intMAX_ITERATIONS(package private) intNeumannprivate intnscalesprivate intnwarps(package private) doublePAR_DEFAULT_EPSILON(package private) doublePAR_DEFAULT_LAMBDA(package private) intPAR_DEFAULT_NSCALES(package private) intPAR_DEFAULT_NWARPS(package private) doublePAR_DEFAULT_TAU(package private) doublePAR_DEFAULT_THETA(package private) intPAR_DEFAULT_VERBOSE(package private) doublePAR_DEFAULT_ZFACTOR(package private) intPeriodic(package private) doublePRESMOOTHING_SIGMAprivate ModelImagesrcImage1private ModelImagesrcImage2(package private) intSymmetricprivate doubletauprivate doublethetaprivate booleanverboseprivate doublezfactor(package private) doubleZOOM_SIGMA_ZERO-
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 TVL1FLOW()TVL1FLOW(ModelImage destuImg, ModelImage destvImg, ModelImage srcImg1, ModelImage srcImg2, double tau, double lambda, double theta, int nscales, double zfactor, int nwarps, double epsilon, boolean verbose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublebicubic_interpolation_at(double[] input, double uu, double vv, int nx, int ny, boolean border_out)Compute the bicubic interpolation of a point in an image.doublebicubic_interpolation_cell(double[][] p, double x, double y)Bicubic interpolation in two dimensionsvoidbicubic_interpolation_warp(double[] input, double[] u, double[] v, double[] output, int nx, int ny, boolean border_out)Compute the bicubic interpolation of an image.voidcentered_gradient(double[] input, double[] dx, double[] dy, int nx, int ny)Function to compute the gradient with centered differencesdoublecubic_interpolation_cell(double[] v, double x)Cubic interpolation in one dimensionvoiddivergence(double[] v1, double[] v2, double[] div, int nx, int ny)Function to compute the divergence with backward differences (see [2] for details)voidDual_TVL1_optic_flow(double[] I0, double[] I1, double[] u1, double[] u2, int nx, int ny, double tau, double lambda, double theta, int warps, double epsilon, boolean verbose)Function to compute the optical flow in one scalevoidDual_TVL1_optic_flow_multiscale(double[] I0, double[] I1, double[] u1, double[] u2, int nxx, int nyy, double tau, double lambda, double theta, int nscales, double zfactor, int warps, double epsilon, boolean verbose)Function to compute the optical flow using multiple scalesvoidforward_gradient(double[] f, double[] fx, double[] fy, int nx, int ny)Function to compute the gradient with forward differences (see [2] for details)voidgaussian(double[] I, int xdim, int ydim, double sigma)In-place Gaussian smoothing of an imagevoidgetminmax(double[] min, double[] max, double[] x, int n)Compute the max and min of an arrayprivate doublehypot(double x, double y)voidimage_normalization(double[] I0, double[] I1, double[] I0n, double[] I1n, int size)Function to normalize the images between 0 and 255intneumann_bc(int x, int nx, boolean[] out)Neumann boundary condition testintperiodic_bc(int x, int nx, boolean[] out)Periodic boundary condition testvoidrunAlgorithm()Actually runs the algorithm.intsymmetric_bc(int x, int nx, boolean[] out)Symmetric boundary condition testvoidzoom_in(double[] I, double[] Iout, int nx, int ny, int nxx, int nyy)Function to upsample the imagevoidzoom_out(double[] I, double[] Iout, int nx, int ny, double factor)Downsample an imagevoidzoom_size(int nx, int ny, int[] nxx, int[] nyy, double factor)Compute the size of a zoomed image from the zoom factor-
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
-
Neumann
final int Neumann
- See Also:
- Constant Field Values
-
Periodic
final int Periodic
- See Also:
- Constant Field Values
-
Symmetric
final int Symmetric
- See Also:
- Constant Field Values
-
BOUNDARY_CONDITION
int BOUNDARY_CONDITION
-
PAR_DEFAULT_TAU
final double PAR_DEFAULT_TAU
- See Also:
- Constant Field Values
-
PAR_DEFAULT_LAMBDA
final double PAR_DEFAULT_LAMBDA
- See Also:
- Constant Field Values
-
PAR_DEFAULT_THETA
final double PAR_DEFAULT_THETA
- See Also:
- Constant Field Values
-
PAR_DEFAULT_NSCALES
final int PAR_DEFAULT_NSCALES
- See Also:
- Constant Field Values
-
PAR_DEFAULT_ZFACTOR
final double PAR_DEFAULT_ZFACTOR
- See Also:
- Constant Field Values
-
PAR_DEFAULT_NWARPS
final int PAR_DEFAULT_NWARPS
- See Also:
- Constant Field Values
-
PAR_DEFAULT_EPSILON
final double PAR_DEFAULT_EPSILON
- See Also:
- Constant Field Values
-
PAR_DEFAULT_VERBOSE
final int PAR_DEFAULT_VERBOSE
- See Also:
- Constant Field Values
-
srcImage1
private ModelImage srcImage1
-
srcImage2
private ModelImage srcImage2
-
destuImage
private ModelImage destuImage
-
destvImage
private ModelImage destvImage
-
tau
private double tau
-
lambda
private double lambda
-
theta
private double theta
-
nscales
private int nscales
-
zfactor
private double zfactor
-
nwarps
private int nwarps
-
epsilon
private double epsilon
-
verbose
private boolean verbose
-
BOUNDARY_CONDITION_DIRICHLET
final int BOUNDARY_CONDITION_DIRICHLET
- See Also:
- Constant Field Values
-
BOUNDARY_CONDITION_REFLECTING
final int BOUNDARY_CONDITION_REFLECTING
- See Also:
- Constant Field Values
-
BOUNDARY_CONDITION_PERIODIC
final int BOUNDARY_CONDITION_PERIODIC
- See Also:
- Constant Field Values
-
DEFAULT_GAUSSIAN_WINDOW_SIZE
final int DEFAULT_GAUSSIAN_WINDOW_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_BOUNDARY_CONDITION
final int DEFAULT_BOUNDARY_CONDITION
- See Also:
- Constant Field Values
-
ZOOM_SIGMA_ZERO
final double ZOOM_SIGMA_ZERO
- See Also:
- Constant Field Values
-
MAX_ITERATIONS
final int MAX_ITERATIONS
- See Also:
- Constant Field Values
-
PRESMOOTHING_SIGMA
final double PRESMOOTHING_SIGMA
- See Also:
- Constant Field Values
-
GRAD_IS_ZERO
final double GRAD_IS_ZERO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TVL1FLOW
public TVL1FLOW()
-
TVL1FLOW
public TVL1FLOW(ModelImage destuImg, ModelImage destvImg, ModelImage srcImg1, ModelImage srcImg2, double tau, double lambda, double theta, int nscales, double zfactor, int nwarps, double epsilon, boolean verbose)
-
-
Method Detail
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin classAlgorithmBase
-
hypot
private double hypot(double x, double y)
-
neumann_bc
public int neumann_bc(int x, int nx, boolean[] out)Neumann boundary condition test
-
periodic_bc
public int periodic_bc(int x, int nx, boolean[] out)Periodic boundary condition test
-
symmetric_bc
public int symmetric_bc(int x, int nx, boolean[] out)Symmetric boundary condition test
-
cubic_interpolation_cell
public double cubic_interpolation_cell(double[] v, double x)Cubic interpolation in one dimension
-
bicubic_interpolation_cell
public double bicubic_interpolation_cell(double[][] p, double x, double y)Bicubic interpolation in two dimensions
-
bicubic_interpolation_at
public double bicubic_interpolation_at(double[] input, double uu, double vv, int nx, int ny, boolean border_out)Compute the bicubic interpolation of a point in an image. Detect if the point goes outside the image domain.
-
bicubic_interpolation_warp
public void bicubic_interpolation_warp(double[] input, double[] u, double[] v, double[] output, int nx, int ny, boolean border_out)Compute the bicubic interpolation of an image.
-
divergence
public void divergence(double[] v1, double[] v2, double[] div, int nx, int ny)Function to compute the divergence with backward differences (see [2] for details)
-
forward_gradient
public void forward_gradient(double[] f, double[] fx, double[] fy, int nx, int ny)Function to compute the gradient with forward differences (see [2] for details)
-
centered_gradient
public void centered_gradient(double[] input, double[] dx, double[] dy, int nx, int ny)Function to compute the gradient with centered differences
-
gaussian
public void gaussian(double[] I, int xdim, int ydim, double sigma)In-place Gaussian smoothing of an image
-
zoom_size
public void zoom_size(int nx, int ny, int[] nxx, int[] nyy, double factor)Compute the size of a zoomed image from the zoom factor
-
zoom_out
public void zoom_out(double[] I, double[] Iout, int nx, int ny, double factor)Downsample an image
-
zoom_in
public void zoom_in(double[] I, double[] Iout, int nx, int ny, int nxx, int nyy)Function to upsample the image
-
Dual_TVL1_optic_flow
public void Dual_TVL1_optic_flow(double[] I0, double[] I1, double[] u1, double[] u2, int nx, int ny, double tau, double lambda, double theta, int warps, double epsilon, boolean verbose)Function to compute the optical flow in one scale
-
getminmax
public void getminmax(double[] min, double[] max, double[] x, int n)Compute the max and min of an array
-
image_normalization
public void image_normalization(double[] I0, double[] I1, double[] I0n, double[] I1n, int size)Function to normalize the images between 0 and 255
-
Dual_TVL1_optic_flow_multiscale
public void Dual_TVL1_optic_flow_multiscale(double[] I0, double[] I1, double[] u1, double[] u2, int nxx, int nyy, double tau, double lambda, double theta, int nscales, double zfactor, int warps, double epsilon, boolean verbose)Function to compute the optical flow using multiple scales
-
-