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 intBANDPASSstatic intBANDSTOPstatic intBUTTERWORTHstatic intCHEBYSHEV_TYPE_Istatic intCHEBYSHEV_TYPE_IIstatic intCONSTRUCTION_NONEprivate intconstructionMethodstatic intELLIPTICprivate doubleepsilonprivate doublef1private doublef2private static intFHT_UNIT_STRIDEprivate intfilterOrderprivate intfilterTypestatic intGAUSSIANstatic intHIGHPASSprivate ModelImageinverseImageprivate static intL1_CACHE_BYTESstatic intLOWPASSprivate doublersprivate ModelImagetransformImage(package private) intxDim(package private) intyDim-
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 voidcenter(double[] data)Centers the FFT for display purposes.private doubleChebyshev(int order, double w)voidfht_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 voidfht_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 voidfht_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 voidfht_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.voidfht_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 voidfht_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 voidfht_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 voidfht_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.voidfht2D(int yDim, int xDim, double[][] src, double[][] dst, boolean forwardTransform)private voidmakeButterworthFilter(double[] buffer, double fr1, double fr2)DOCUMENT ME!private voidmakeChebyshevTypeIFilter(double[] buffer, double fr1, double fr2)private voidmakeChebyshevTypeIIFilter(double[] buffer, double fr1, double fr2)private voidmakeEllipticFilter(double[] buffer, double fr1, double fr2)private voidmakeGaussianFilter(double[] buffer, double rmsFreq)voidrunAlgorithm()Actually runs the algorithm.voidtestHartley()-
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:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin 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
-
-