Package gov.nih.mipav.model.algorithms
Class DiscreteCosineTransform
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.DiscreteCosineTransform
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class DiscreteCosineTransform extends AlgorithmBase
This routines except the SLOW routines are ported from FORTRAN to Java from: ALGORITHM 749, COLLECTED ALGORITHMS FROM ACM. THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, VOL. 21, NO. 4, December, 1995, P. 372--378. This file contains 4 files separated by lines of the form C*** filename The filenames in this file are: driver.f driverd.f fct.f fctd.f driver.f and fct.f are float versions and driverd.f and fctd.f are double versions.From the ACM website:
ACM Software License Agreement All software, both binary and source published by the Association for Computing Machinery (hereafter, Software) is copyrighted by the Association (hereafter, ACM) and ownership of all right, title and interest in and to the Software remains with ACM. By using or copying the Software, User agrees to abide by the terms of this Agreement. Noncommercial Use The ACM grants to you (hereafter, User) a royalty-free, nonexclusive right to execute, copy, modify and distribute both the binary and source code solely for academic, research and other similar noncommercial uses, subject to the following conditions: 1. User acknowledges that the Software is still in the development stage and that it is being supplied "as is," without any support services from ACM. Neither ACM nor the author makes any representations or warranties, express or implied, including, without limitation, any representations or warranties of the merchantability or fitness for any particular purpose, or that the application of the software, will not infringe on any patents or other proprietary rights of others. 2. ACM shall not be held liable for direct, indirect, incidental or consequential damages arising from any claim by User or any third party with respect to uses allowed under this Agreement, or from any use of the Software. 3. User agrees to fully indemnify and hold harmless ACM and/or the author(s) of the original work from and against any and all claims, demands, suits, losses, damages, costs and expenses arising out of the User's use of the Software, including, without limitation, arising out of the User's modification of the Software. 4. User may modify the Software and distribute that modified work to third parties provided that: (a) if posted separately, it clearly acknowledges that it contains material copyrighted by ACM (b) no charge is associated with such copies, (c) User agrees to notify ACM and the Author(s) of the distribution, and (d) User clearly notifies secondary users that such modified work is not the original Software. 5. User agrees that ACM, the authors of the original work and others may enjoy a royalty-free, non-exclusive license to use, copy, modify and redistribute these modifications to the Software made by the User and distributed to third parties as a derivative work under this agreement. 6. This agreement will terminate immediately upon User's breach of, or non-compliance with, any of its terms. User may be held liable for any copyright infringement or the infringement of any other proprietary rights in the Software that is caused or facilitated by the User's failure to abide by the terms of this agreement. 7. This agreement will be construed and enforced in accordance with the law of the state of New York applicable to contracts performed entirely within the State. The parties irrevocably consent to the exclusive jurisdiction of the state or federal courts located in the City of New York for all disputes concerning this agreement. Commercial Use Any User wishing to make a commercial use of the Software must contact ACM at permissions@acm.org to arrange an appropriate license. Commercial use includes (1) integrating or incorporating all or part of the source code into a product for sale or license by, or on behalf of, User to third parties, or (2) distribution of the binary or source code to third parties for use with a commercial product sold or licensed by, or on behalf of, User. Revised 6/98
SLOW routines adapted from: DCT and IDCT - listing 1 Copyright (c) 2001 Emil Mikulic. http://unix4lyfe.org/dct/ Feel free to do whatever you like with this code. Feel free to credit me.
-
-
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
private int[]
dims
static int
ELLIPTIC
private double
epsilon
private double
f1
private double
f2
private boolean
fastAlgorithm
private int
filterOrder
private int
filterType
static int
GAUSSIAN
static int
HIGHPASS
private ModelImage
inverseImage
private int
IPOW
private int
LENGTH
static int
LOWPASS
private int
MAXPOW
private boolean
printData
static int
randomData
private double
rs
private double
RT2INV
static int
sinusoidalData
private int
testDataType
private ModelImage
transformImage
private int
transformLength
private int
xDim
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 DiscreteCosineTransform()
DiscreteCosineTransform(boolean fastAlgorithm, int[] dims, int testDataType, boolean printData, int filterType, double filterVal1, double filterVal2)
DiscreteCosineTransform(ModelImage transformImage, ModelImage inverseImage, ModelImage srcImg, int constructionMethod, int filterType, double f1, double f2, int filterOrder, double epsilon, double rs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
BITREV(double[] F, int transformLength)
private double
Chebyshev(int order, double w)
private void
FCT(double[] F, double[] C, int transformLength, int[] IFAULT)
void
FCT2D(double[] F, int xDim, int yDim)
private void
IFCT(double[] F, double[] C, int transformLength, int[] IFAULT)
private void
IFCT2D(double[] F, int xDim, int yDim)
private void
INIFCT(double[] C, int transformLength, int[] IFAULT)
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)
double
RANDOM(int[] IX, int[] IY, int[] IZ)
void
runAlgorithm()
Actually runs the algorithm.void
runTest()
private void
SCRAMB(double[] F, int transformLength)
void
SLOW2DFCT(double[] F, int xDim, int yDim)
private void
SLOW2DIFCT(double[] F, int xDim, int yDim)
private void
SLOWFCT(double[] F, int transformLength)
private void
SLOWIFCT(double[] F, int transformLength)
private void
USCRAM(double[] F, int transformLength)
-
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
-
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
-
transformLength
private int transformLength
-
randomData
public static final int randomData
- See Also:
- Constant Field Values
-
sinusoidalData
public static final int sinusoidalData
- See Also:
- Constant Field Values
-
testDataType
private int testDataType
-
printData
private boolean printData
-
MAXPOW
private final int MAXPOW
- See Also:
- Constant Field Values
-
RT2INV
private final double RT2INV
-
fastAlgorithm
private boolean fastAlgorithm
-
LENGTH
private int LENGTH
-
IPOW
private int IPOW
-
dims
private int[] dims
-
xDim
private int xDim
-
yDim
private int yDim
-
transformImage
private ModelImage transformImage
-
inverseImage
private ModelImage inverseImage
-
-
Constructor Detail
-
DiscreteCosineTransform
public DiscreteCosineTransform()
-
DiscreteCosineTransform
public DiscreteCosineTransform(ModelImage transformImage, ModelImage inverseImage, ModelImage srcImg, int constructionMethod, int filterType, double f1, double f2, int filterOrder, double epsilon, double rs)
-
DiscreteCosineTransform
public DiscreteCosineTransform(boolean fastAlgorithm, int[] dims, int testDataType, boolean printData, int filterType, double filterVal1, double filterVal2)
-
-
Method Detail
-
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()
-
RANDOM
public double RANDOM(int[] IX, int[] IY, int[] IZ)
-
FCT2D
public void FCT2D(double[] F, int xDim, int yDim)
-
IFCT2D
private void IFCT2D(double[] F, int xDim, int yDim)
-
FCT
private void FCT(double[] F, double[] C, int transformLength, int[] IFAULT)
-
IFCT
private void IFCT(double[] F, double[] C, int transformLength, int[] IFAULT)
-
BITREV
private void BITREV(double[] F, int transformLength)
-
SCRAMB
private void SCRAMB(double[] F, int transformLength)
-
USCRAM
private void USCRAM(double[] F, int transformLength)
-
INIFCT
private void INIFCT(double[] C, int transformLength, int[] IFAULT)
-
SLOWFCT
private void SLOWFCT(double[] F, int transformLength)
-
SLOW2DFCT
public void SLOW2DFCT(double[] F, int xDim, int yDim)
-
SLOWIFCT
private void SLOWIFCT(double[] F, int transformLength)
-
SLOW2DIFCT
private void SLOW2DIFCT(double[] F, int xDim, int yDim)
-
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)
-
-