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:
ActionListener,WindowListener,Runnable,EventListener
Smithsonian Astrophysical Observatory
Submillimeter Receiver Laboratory
am
transform.c S. Paine rev. 2018 February 5
Discrete Fourier, Hartley, and Hilbert transforms.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprivate intstatic final intprivate doubleprivate doubleprivate doubleprivate static final intprivate intprivate intstatic final intstatic final intprivate ModelImageprivate static final intstatic final intprivate doubleprivate ModelImage(package private) int(package private) intFields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionHartleyTransform2(ModelImage transformImage, ModelImage inverseImage, ModelImage srcImg, int constructionMethod, int filterType, double f1, double f2, int filterOrder, double epsilon, double rs) -
Method Summary
Modifier and TypeMethodDescriptionprivate 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) voidActually runs the algorithm.voidMethods 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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
transformImage
-
inverseImage
-
FHT_UNIT_STRIDE
private static final int FHT_UNIT_STRIDE- See Also:
-
L1_CACHE_BYTES
private static final int L1_CACHE_BYTES- See Also:
-
xDim
int xDim -
yDim
int yDim -
constructionMethod
private int constructionMethod -
CONSTRUCTION_NONE
public static final int CONSTRUCTION_NONE- See Also:
-
GAUSSIAN
public static final int GAUSSIAN- See Also:
-
BUTTERWORTH
public static final int BUTTERWORTH- See Also:
-
CHEBYSHEV_TYPE_I
public static final int CHEBYSHEV_TYPE_I- See Also:
-
CHEBYSHEV_TYPE_II
public static final int CHEBYSHEV_TYPE_II- See Also:
-
ELLIPTIC
public static final int ELLIPTIC- See Also:
-
filterType
private int filterType -
f1
private double f1 -
f2
private double f2 -
LOWPASS
public static final int LOWPASS- See Also:
-
HIGHPASS
public static final int HIGHPASS- See Also:
-
BANDPASS
public static final int BANDPASS- See Also:
-
BANDSTOP
public static final int BANDSTOP- See Also:
-
filterOrder
private int filterOrder -
epsilon
private double epsilon -
rs
private double rs
-
-
Constructor Details
-
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 Details
-
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
-