Package gov.nih.mipav.model.algorithms
Class HartleyTransform2
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.HartleyTransform2
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class HartleyTransform2 extends AlgorithmBase
Smithsonian Astrophysical Observatory Submillimeter Receiver Laboratory am transform.c S. Paine rev. 2018 February 5 Discrete Fourier, Hartley, and Hilbert transforms.
-
-
Field Summary
Fields Modifier and Type Field Description static int
BANDPASS
static int
BANDSTOP
static int
BUTTERWORTH
static int
CHEBYSHEV_TYPE_I
static int
CHEBYSHEV_TYPE_II
static int
CONSTRUCTION_NONE
private int
constructionMethod
static int
ELLIPTIC
private double
epsilon
private double
f1
private double
f2
private static int
FHT_UNIT_STRIDE
private int
filterOrder
private int
filterType
static int
GAUSSIAN
static int
HIGHPASS
private ModelImage
inverseImage
private static int
L1_CACHE_BYTES
static int
LOWPASS
private double
rs
private ModelImage
transformImage
(package private) int
xDim
(package 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 HartleyTransform2()
HartleyTransform2(ModelImage transformImage, ModelImage inverseImage, ModelImage srcImg, int constructionMethod, int filterType, double f1, double f2, int filterOrder, double epsilon, double rs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private double[]
bitrevorder(double[] X)
private void
center(double[] data)
Centers the FFT for display purposes.private double
Chebyshev(int order, double w)
void
fht_dif(double[] x, int n)
void fht_dif(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-frequency FHT.(package private) static void
fht_dif_iter(double[] x, int n)
static void fht_dif_iter(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-frequency FHT.(package private) static void
fht_dif_iter_seq(double[] x, int n)
static void fht_dif_iter_seq(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-frequency FHT.(package private) static void
fht_dif_rec(double[] x, int n, int nbranch)
static void fht_dif_rec(double *x, unsigned long n, int nbranch) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-frequency FHT.void
fht_dit(double[] x, int n)
void fht_dit(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-time FHT.(package private) static void
fht_dit_iter(double[] x, int n)
static void fht_dit_iter(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-time FHT.(package private) static void
fht_dit_iter_seq(double[] x, int n)
static void fht_dit_iter_seq(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-time FHT.(package private) static void
fht_dit_rec(double[] x, int n, int nbranch)
static void fht_dit_rec(double *x, unsigned long n, int nbranch) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-time FHT.void
fht2D(int yDim, int xDim, double[][] src, double[][] dst, boolean forwardTransform)
private void
makeButterworthFilter(double[] buffer, double fr1, double fr2)
DOCUMENT ME!private void
makeChebyshevTypeIFilter(double[] buffer, double fr1, double fr2)
private void
makeChebyshevTypeIIFilter(double[] buffer, double fr1, double fr2)
private void
makeEllipticFilter(double[] buffer, double fr1, double fr2)
private void
makeGaussianFilter(double[] buffer, double rmsFreq)
void
runAlgorithm()
Actually runs the algorithm.void
testHartley()
-
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
-
transformImage
private ModelImage transformImage
-
inverseImage
private ModelImage inverseImage
-
FHT_UNIT_STRIDE
private static final int FHT_UNIT_STRIDE
- See Also:
- Constant Field Values
-
L1_CACHE_BYTES
private static final int L1_CACHE_BYTES
- See Also:
- Constant Field Values
-
xDim
int xDim
-
yDim
int yDim
-
constructionMethod
private int constructionMethod
-
CONSTRUCTION_NONE
public static final int CONSTRUCTION_NONE
- See Also:
- Constant Field Values
-
GAUSSIAN
public static final int GAUSSIAN
- See Also:
- Constant Field Values
-
BUTTERWORTH
public static final int BUTTERWORTH
- See Also:
- Constant Field Values
-
CHEBYSHEV_TYPE_I
public static final int CHEBYSHEV_TYPE_I
- See Also:
- Constant Field Values
-
CHEBYSHEV_TYPE_II
public static final int CHEBYSHEV_TYPE_II
- See Also:
- Constant Field Values
-
ELLIPTIC
public static final int ELLIPTIC
- See Also:
- Constant Field Values
-
filterType
private int filterType
-
f1
private double f1
-
f2
private double f2
-
LOWPASS
public static final int LOWPASS
- See Also:
- Constant Field Values
-
HIGHPASS
public static final int HIGHPASS
- See Also:
- Constant Field Values
-
BANDPASS
public static final int BANDPASS
- See Also:
- Constant Field Values
-
BANDSTOP
public static final int BANDSTOP
- See Also:
- Constant Field Values
-
filterOrder
private int filterOrder
-
epsilon
private double epsilon
-
rs
private double rs
-
-
Constructor Detail
-
HartleyTransform2
public HartleyTransform2()
-
HartleyTransform2
public HartleyTransform2(ModelImage transformImage, ModelImage inverseImage, ModelImage srcImg, int constructionMethod, int filterType, double f1, double f2, int filterOrder, double epsilon, double rs)
-
-
Method Detail
-
testHartley
public void testHartley()
-
fht2D
public void fht2D(int yDim, int xDim, double[][] src, double[][] dst, boolean forwardTransform)
-
fht_dif
public void fht_dif(double[] x, int n)
void fht_dif(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-frequency FHT. n must be a power of 2. Entering this function, x[] is in normal order. On return, x[] contains the Hartley transform, stored in bit-reversed order. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 Return: none
-
fht_dif_iter
static void fht_dif_iter(double[] x, int n)
static void fht_dif_iter(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-frequency FHT. n must be a power of 2. Entering this function, x[] is in normal order. On return, x[] contains the Hartley transform, stored in bit-reversed order. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 Return: none
-
fht_dif_iter_seq
static void fht_dif_iter_seq(double[] x, int n)
static void fht_dif_iter_seq(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-frequency FHT. n must be a power of 2. Entering this function, x[] is in normal order. On return, x[] contains the Hartley transform, stored in bit-reversed order. The two inner loops of the FHT computation are ordered to favor sequential memory access at the expense of redundant trig computations. See J. Arndt, "Algorithms for Programmers," online at http://www.jjj.de/fxt/. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 Return: none
-
fht_dif_rec
static void fht_dif_rec(double[] x, int n, int nbranch)
static void fht_dif_rec(double *x, unsigned long n, int nbranch) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-frequency FHT. If the computation is small enough to fit in cache, it is done iteratively. Otherwise, it is done recursively until the recursion descends to cache-sized chunks. n must be a power of 2. Entering this function, x[] must be in normal order. On return, x[] contains the Hartley transform, in bit-reversed order. To support OpenMP parallelism, nbranch keeps track of the number of active transforms at a given recursion level. On the first call to this function, nbranch should be 1. It is then doubled for each recursion. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 int nbranch - number of transforms at this recursion level Return: none
-
fht_dit
public void fht_dit(double[] x, int n)
void fht_dit(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-time FHT. n must be a power of 2. Entering this function, x[] must be in bit-reversed order. On return, x[] contains the Hartley transform, returned to normal order. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 Return: none
-
fht_dit_iter
static void fht_dit_iter(double[] x, int n)
static void fht_dit_iter(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-time FHT. n must be a power of 2. Entering this function, x[] must be in bit-reversed order. On return, x[] contains the Hartley transform, returned to normal order. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 Return: none
-
fht_dit_iter_seq
static void fht_dit_iter_seq(double[] x, int n)
static void fht_dit_iter_seq(double *x, unsigned long n) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using an iterative radix 2 decimation-in-time FHT. n must be a power of 2. Entering this function, x[] must be in bit-reversed order. On return, x[] contains the Hartley transform, returned to normal order. The two inner loops of the FHT computation are ordered to favor sequential memory access at the expense of redundant trig computations. See J. Arndt, "Algorithms for Programmers," online at http://www.jjj.de/fxt/. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 Return: none
-
fht_dit_rec
static void fht_dit_rec(double[] x, int n, int nbranch)
static void fht_dit_rec(double *x, unsigned long n, int nbranch) Purpose: Computes the discrete Hartley transform of a real sequence x[0..n-1], using a radix 2 decimation-in-time FHT. If the computation is small enough to fit in cache, it is done iteratively. Otherwise, it is done recursively until the recursion descends to cache-sized chunks. n must be a power of 2. Entering this function, x[] must be in bit-reversed order. On return, x[] contains the Hartley transform, returned to normal order. To support OpenMP parallelism, nbranch keeps track of the number of active transforms at a given recursion level. On the first call to this function, nbranch should be 1. It is then doubled for each recursion. Arguments: double *x - array of n doubles, representing n real numbers unsigned long n - dimension of x, must be a power of 2 int nbranch - number of transforms at this recursion level Return: none
-
bitrevorder
private double[] bitrevorder(double[] X)
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
makeGaussianFilter
private void makeGaussianFilter(double[] buffer, double rmsFreq)
-
makeButterworthFilter
private void makeButterworthFilter(double[] buffer, double fr1, double fr2)
DOCUMENT ME!- Parameters:
fr1
- DOCUMENT ME!fr2
- DOCUMENT ME!
-
makeEllipticFilter
private void makeEllipticFilter(double[] buffer, double fr1, double fr2)
-
Chebyshev
private double Chebyshev(int order, double w)
-
makeChebyshevTypeIFilter
private void makeChebyshevTypeIFilter(double[] buffer, double fr1, double fr2)
-
makeChebyshevTypeIIFilter
private void makeChebyshevTypeIIFilter(double[] buffer, double fr1, double fr2)
-
center
private void center(double[] data)
Centers the FFT for display purposes.- Parameters:
rData
- real data bufferiData
- imaginary data buffer
-
-