Class AlgorithmEllipticFilter
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmEllipticFilter
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmEllipticFilter extends AlgorithmBase
This module contains a port from FORTRAN to Java of the FORTRAN program for designing elliptic-function filters and a port from MATLAB to Java of the MATLAB program ellipap1 for designing an elliptic analog lowpass filter prototype found in "Elliptic Functions for Filter Design" by H. J. Orchard and Alan N. Willson, Jr. in IEEE Transactions on Circuits and Systems-I: Fundamental Theory and Applications, Vol. 44. No. 4, April, 1997, pp. 273-287. Permission to port code kindly granted by Alan N. Willson, Jr.
-
-
Field Summary
Fields Modifier and Type Field Description private double[]
D0
private double[]
D1
private double[]
D2
private boolean
displayOutput
private double[]
gain
private double
k
private int
n
private double[]
N0
private int
n2
private double[]
N2
private int
n3
private int
no
private double[]
pimag
private double[]
preal
private double
rp
private double
rs
private boolean
runFORTRAN
private boolean
test
private double[]
zimag
-
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 AlgorithmEllipticFilter()
The FORTRAN example in the article of n = 7, apd = 0.1dB, k = 0.8 gives in Table VI: Make FORTRAN zeros poles and FORTRAN poles zeros Poles: -0.0455944342 + j1.026557002 -0.1713670100 + j0.918389608 -0.3689660125 + j0.603979789 -0.4980421689 + j0.0 Zeros: 1.268831784 1.467798747 2.384834232 For the MATLAB example rs = 55.43dB.AlgorithmEllipticFilter(int n, double rp, double k, double[] preal, double[] pimag, double[] zimag, boolean displayOutput)
AlgorithmEllipticFilter(int n, double rp, double rs, double[] zimag, double[] preal, double[] pimag, double[] gain, boolean displayOutput)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
ellipap1()
void
finalize()
Prepares this class for destruction.double
find3dBfrequency()
double
findGain(double w)
void
generatePoly()
void
runAlgorithm()
Actually runs the algorithm.void
runFORTRAN()
Starts the program.void
runTest()
private double
zabs(double zr, double zi)
zabs computes the absolute value or magnitude of a double precision complex variable zr + j*zi.private void
zdiv(double ar, double ai, double br, double bi, double[] cr, double[] ci)
complex divide c = a/b.private void
zmlt(double ar, double ai, double br, double bi, double[] cr, double[] ci)
complex multiply c = a * b.-
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
-
n
private int n
-
rp
private double rp
-
k
private double k
-
displayOutput
private boolean displayOutput
-
no
private int no
-
n2
private int n2
-
n3
private int n3
-
runFORTRAN
private boolean runFORTRAN
-
rs
private double rs
-
zimag
private double[] zimag
-
preal
private double[] preal
-
pimag
private double[] pimag
-
gain
private double[] gain
-
N2
private double[] N2
-
N0
private double[] N0
-
D2
private double[] D2
-
D1
private double[] D1
-
D0
private double[] D0
-
test
private boolean test
-
-
Constructor Detail
-
AlgorithmEllipticFilter
public AlgorithmEllipticFilter()
The FORTRAN example in the article of n = 7, apd = 0.1dB, k = 0.8 gives in Table VI: Make FORTRAN zeros poles and FORTRAN poles zeros Poles: -0.0455944342 + j1.026557002 -0.1713670100 + j0.918389608 -0.3689660125 + j0.603979789 -0.4980421689 + j0.0 Zeros: 1.268831784 1.467798747 2.384834232 For the MATLAB example rs = 55.43dB. ellipap1 PORT gives: Zeros: j * -2.384764161974976 j * 2.384764161974976 j * -1.4677649005263902 j * 1.4677649005263902 j * -1.268807714942811 j * 1.268807714942811 Poles: -0.368967058832794 + j * -0.6039890555820511 -0.368967058832794 + j * 0.6039890555820511 -0.17136300802103874 + j * -0.9183938396880713 -0.17136300802103874 + j * 0.9183938396880713 -0.04559255065683074 + j * -1.026556156803157 -0.04559255065683074 + j * 1.026556156803157 -0.498050705720998 + j * 0.0 Gain = 0.011657502783825976
-
AlgorithmEllipticFilter
public AlgorithmEllipticFilter(int n, double rp, double k, double[] preal, double[] pimag, double[] zimag, boolean displayOutput)
- Parameters:
n
-apd
-k
-preal
-pimag
-zimag
-displayOutput
-
-
AlgorithmEllipticFilter
public AlgorithmEllipticFilter(int n, double rp, double rs, double[] zimag, double[] preal, double[] pimag, double[] gain, boolean displayOutput)
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
runTest
public void runTest()
-
runFORTRAN
public void runFORTRAN()
Starts the program.
-
ellipap1
public void ellipap1()
-
generatePoly
public void generatePoly()
-
findGain
public double findGain(double w)
-
find3dBfrequency
public double find3dBfrequency()
-
zmlt
private void zmlt(double ar, double ai, double br, double bi, double[] cr, double[] ci)
complex multiply c = a * b.- Parameters:
ar
- doubleai
- doublebr
- doublebi
- doublecr
- double[]ci
- double[]
-
zdiv
private void zdiv(double ar, double ai, double br, double bi, double[] cr, double[] ci)
complex divide c = a/b.- Parameters:
ar
- doubleai
- doublebr
- doublebi
- doublecr
- double[]ci
- double[]
-
zabs
private double zabs(double zr, double zi)
zabs computes the absolute value or magnitude of a double precision complex variable zr + j*zi.- Parameters:
zr
- doublezi
- double- Returns:
- double
-
-