Class FFTUtility
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.FFTUtility
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class FFTUtility extends AlgorithmBase
This FFT should only be used when it is necessary to perform a N-dimensional FFT on non-power of two data without adding padding. Otherwise, developers should use AlgorithmFFT (which has multithreading/jocl optimizations). For forward transforms arrays a and b originally hold the real and imaginary components of the data, and return the real and imaginary components of the resulting fourier coefficients. The roles reverse for the inverse transform. multivariate data is indexed according to Java indexing conventions in which the last dimension is contiguous in memory, without limit on the number of implied multiple subscripts. the subroutine is called once for each variate. the calls for a multivariate transform may be in any order. n is the dimension of the current variable. If n has more than 15 "factors", FFT terminates with an error message. The smallest number with 16 "factors" is 12,754,584, so this error condition should not occur very often. nspn is the spacing of consecutive data values while indexing the current variable. nseg*n*nspn is the total number of complex data values. The sign of isn determines the sign of the complex exponential, and the magnitude of isn is normally one. isn is -1 for the forward transform and +1 for the inverse transform. The magnitude of isn determines the indexing increment for a & b. If fft is called twice, with opposite signs on isn, an identity transformation is done. Calls can be in either order. The results are scaled by 1/n when the sign of isn is positive. a tri-variate transform with a(n1,n2,n3), b(n1,n2,n3) is computed by FFTUtility fft = new FFTUtility(a,b,n1*n2,n3,1,-1,FFTUtility.FFT); fft.run(); fft = new FFTUtility(a,b,n1,n2,n3,-1,FFTUtility.FFT); fft.run(); fft = new FFTUtility(a,b,1,n1,n2*n3,-1,FFTUtility.FFT); fft.run(); for a single-variate transform, FFTUtility fft = new FFTUtility(a,b,1,n,1,-1,FFTUtility.FFT); fft.run();
-
-
Field Summary
Fields Modifier and Type Field Description private double[]
a
DOCUMENT ME!private double[]
b
DOCUMENT ME!static int
FFT
DOCUMENT ME!private int
functionType
DOCUMENT ME!private int
isn
DOCUMENT ME!private int
n
DOCUMENT ME!private int
nseg
DOCUMENT ME!private int
nspn
DOCUMENT ME!static int
REALS
DOCUMENT ME!static int
REALT
DOCUMENT ME!static int
SELF_TEST
DOCUMENT ME!private boolean
showProgress
-
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 FFTUtility(double[] a, double[] b, int nseg, int n, int nspn, int isn, int functionType)
Creates a new FFTUtility object.FFTUtility(int functionType)
This constructor should only be used for functionType == SELF_TEST.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
fft()
DOCUMENT ME!void
finalize()
DOCUMENT ME!(package private) double[]
normal()
DOCUMENT ME!private void
reals()
DOCUMENT ME!private void
realt()
DOCUMENT ME!(package private) double[]
rms(double[] a, double[] b, double[] c, double[] d, int n)
DOCUMENT ME!void
runAlgorithm()
Starts the program.private void
selfTest()
DOCUMENT ME!void
setShowProgress(boolean showProgress)
void
sortg(double[] a, int n, double[] tag)
DOCUMENT ME!-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, 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
-
FFT
public static final int FFT
DOCUMENT ME!- See Also:
- Constant Field Values
-
REALS
public static final int REALS
DOCUMENT ME!- See Also:
- Constant Field Values
-
REALT
public static final int REALT
DOCUMENT ME!- See Also:
- Constant Field Values
-
SELF_TEST
public static final int SELF_TEST
DOCUMENT ME!- See Also:
- Constant Field Values
-
a
private double[] a
DOCUMENT ME!
-
b
private double[] b
DOCUMENT ME!
-
functionType
private int functionType
DOCUMENT ME!
-
isn
private int isn
DOCUMENT ME!
-
n
private int n
DOCUMENT ME!
-
nseg
private int nseg
DOCUMENT ME!
-
nspn
private int nspn
DOCUMENT ME!
-
showProgress
private boolean showProgress
-
-
Constructor Detail
-
FFTUtility
public FFTUtility(int functionType)
This constructor should only be used for functionType == SELF_TEST.- Parameters:
functionType
- DOCUMENT ME!
-
FFTUtility
public FFTUtility(double[] a, double[] b, int nseg, int n, int nspn, int isn, int functionType)
Creates a new FFTUtility object.- Parameters:
a
- DOCUMENT ME!b
- DOCUMENT ME!nseg
- DOCUMENT ME!n
- DOCUMENT ME!nspn
- DOCUMENT ME!isn
- DOCUMENT ME!functionType
- DOCUMENT ME!
-
-
Method Detail
-
finalize
public void finalize()
DOCUMENT ME!- Overrides:
finalize
in classAlgorithmBase
-
setShowProgress
public void setShowProgress(boolean showProgress)
- Parameters:
showProgress
-
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
normal
double[] normal()
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
rms
double[] rms(double[] a, double[] b, double[] c, double[] d, int n)
DOCUMENT ME!- Parameters:
a
- DOCUMENT ME!b
- DOCUMENT ME!c
- DOCUMENT ME!d
- DOCUMENT ME!n
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
fft
private void fft()
DOCUMENT ME!
-
reals
private void reals()
DOCUMENT ME!
-
realt
private void realt()
DOCUMENT ME!
-
selfTest
private void selfTest()
DOCUMENT ME!
-
sortg
public void sortg(double[] a, int n, double[] tag)
DOCUMENT ME!- Parameters:
a
- DOCUMENT ME!n
- DOCUMENT ME!tag
- DOCUMENT ME!
-
-