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) int
BOUNDARY_CONDITION
(package private) int
BOUNDARY_CONDITION_DIRICHLET
(package private) int
BOUNDARY_CONDITION_PERIODIC
(package private) int
BOUNDARY_CONDITION_REFLECTING
(package private) int
DEFAULT_BOUNDARY_CONDITION
(package private) int
DEFAULT_GAUSSIAN_WINDOW_SIZE
private ModelImage
destuImage
private ModelImage
destvImage
private double
epsilon
(package private) double
GRAD_IS_ZERO
private double
lambda
(package private) int
MAX_ITERATIONS
(package private) int
Neumann
private int
nscales
private int
nwarps
(package private) double
PAR_DEFAULT_EPSILON
(package private) double
PAR_DEFAULT_LAMBDA
(package private) int
PAR_DEFAULT_NSCALES
(package private) int
PAR_DEFAULT_NWARPS
(package private) double
PAR_DEFAULT_TAU
(package private) double
PAR_DEFAULT_THETA
(package private) int
PAR_DEFAULT_VERBOSE
(package private) double
PAR_DEFAULT_ZFACTOR
(package private) int
Periodic
(package private) double
PRESMOOTHING_SIGMA
private ModelImage
srcImage1
private ModelImage
srcImage2
(package private) int
Symmetric
private double
tau
private double
theta
private boolean
verbose
private double
zfactor
(package private) double
ZOOM_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 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.double
bicubic_interpolation_cell(double[][] p, double x, double y)
Bicubic interpolation in two dimensionsvoid
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.void
centered_gradient(double[] input, double[] dx, double[] dy, int nx, int ny)
Function to compute the gradient with centered differencesdouble
cubic_interpolation_cell(double[] v, double x)
Cubic interpolation in one dimensionvoid
divergence(double[] v1, double[] v2, double[] div, int nx, int ny)
Function to compute the divergence with backward differences (see [2] for details)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 scalevoid
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 scalesvoid
forward_gradient(double[] f, double[] fx, double[] fy, int nx, int ny)
Function to compute the gradient with forward differences (see [2] for details)void
gaussian(double[] I, int xdim, int ydim, double sigma)
In-place Gaussian smoothing of an imagevoid
getminmax(double[] min, double[] max, double[] x, int n)
Compute the max and min of an arrayprivate double
hypot(double x, double y)
void
image_normalization(double[] I0, double[] I1, double[] I0n, double[] I1n, int size)
Function to normalize the images between 0 and 255int
neumann_bc(int x, int nx, boolean[] out)
Neumann boundary condition testint
periodic_bc(int x, int nx, boolean[] out)
Periodic boundary condition testvoid
runAlgorithm()
Actually runs the algorithm.int
symmetric_bc(int x, int nx, boolean[] out)
Symmetric boundary condition testvoid
zoom_in(double[] I, double[] Iout, int nx, int ny, int nxx, int nyy)
Function to upsample the imagevoid
zoom_out(double[] I, double[] Iout, int nx, int ny, double factor)
Downsample an imagevoid
zoom_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:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in 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
-
-