org.jtransforms.fft
Class RealFFTUtils_3D
- java.lang.Object
-
- org.jtransforms.fft.RealFFTUtils_3D
-
public class RealFFTUtils_3D extends java.lang.ObjectThis is a set of utility methods for R/W access to data resulting from a call to the Fourier transform of real data. Memory optimized methods, namelyDoubleFFT_3D.realForward(double[])DoubleFFT_3D.realForward(DoubleLargeArray)DoubleFFT_3D.realForward(double[][][])FloatFFT_3D.realForward(float[])FloatFFT_3D.realForward(FloatLargeArray)FloatFFT_3D.realForward(float[][][])
Example for Fourier Transform of real, double precision 1d data
DoubleFFT_3D fft = new DoubleFFT_2D(slices, rows, columns); double[] data = new double[2 * slices * rows * columns]; ... fft.realForwardFull(data); data[(s1 * rows + r1) * 2 * columns + c1] = val1; val2 = data[(s2 * rows + r2) * 2 * columns + c2];
is equivalent toDoubleFFT_3D fft = new DoubleFFT_3D(slices, rows, columns); RealFFTUtils_3D unpacker = new RealFFTUtils_3D(slices, rows, columns); double[] data = new double[slices * rows * columns]; ... fft.realForward(data); unpacker.pack(val1, s1, r1, c1, data); val2 = unpacker.unpack(s2, r2, c2, data, 0);
Even (resp. odd) values ofccorrespond to the real (resp. imaginary) part of the Fourier mode.Example for Fourier Transform of real, double precision 3d data
DoubleFFT_3D fft = new DoubleFFT_3D(slices, rows, columns); double[][][] data = new double[slices][rows][2 * columns]; ... fft.realForwardFull(data); data[s1][r1][c1] = val1; val2 = data[s2][r2][c2];
is equivalent toDoubleFFT_3D fft = new DoubleFFT_3D(slices, rows, columns); RealFFTUtils_3D unpacker = new RealFFTUtils_3D(slices, rows, columns); double[][][] data = new double[slices][rows][columns]; ... fft.realForward(data); unpacker.pack(val1, s1, r1, c1, data); val2 = unpacker.unpack(s2, r2, c2, data, 0);
Even (resp. odd) values ofccorrespond to the real (resp. imaginary) part of the Fourier mode.
-
-
Constructor Summary
Constructors Constructor and Description RealFFTUtils_3D(long slices, long rows, long columns)Creates a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetIndex(int s, int r, int c)Returns the 1d index of the specified 3d Fourier mode.longgetIndex(long s, long r, long c)Returns the 1d index of the specified 3d Fourier mode.voidpack(double val, int s, int r, int c, double[][][] packed)Sets the specified Fourier mode of the transformed data.voidpack(double val, int s, int r, int c, double[] packed, int pos)Sets the specified Fourier mode of the transformed data.voidpack(double val, long s, long r, long c, DoubleLargeArray packed, long pos)Sets the specified Fourier mode of the transformed data.voidpack(float val, int s, int r, int c, float[][][] packed)Sets the specified Fourier mode of the transformed data.voidpack(float val, int s, int r, int c, float[] packed, int pos)Sets the specified Fourier mode of the transformed data.voidpack(float val, long s, long r, long c, FloatLargeArray packed, long pos)Sets the specified Fourier mode of the transformed data.doubleunpack(int s, int r, int c, double[][][] packed)Returns the specified Fourier mode of the transformed data.doubleunpack(int s, int r, int c, double[] packed, int pos)Returns the specified Fourier mode of the transformed data.floatunpack(int s, int r, int c, float[][][] packed)Returns the specified Fourier mode of the transformed data.floatunpack(int s, int r, int c, float[] packed, int pos)Returns the specified Fourier mode of the transformed data.doubleunpack(long s, long r, long c, DoubleLargeArray packed, long pos)Returns the specified Fourier mode of the transformed data.floatunpack(long s, long r, long c, FloatLargeArray packed, long pos)Returns the specified Fourier mode of the transformed data.
-
-
-
Constructor Detail
-
RealFFTUtils_3D
public RealFFTUtils_3D(long slices, long rows, long columns)Creates a new instance of this class. The size of the underlyingDoubleFFT_3DorFloatFFT_3Dmust be specified.- Parameters:
slices- number of slicesrows- number of rowscolumns- number of columns
-
-
Method Detail
-
getIndex
public int getIndex(int s, int r, int c)Returns the 1d index of the specified 3d Fourier mode. In other words, ifpackedcontains the transformed data following a call toDoubleFFT_3D.realForwardFull(double[])orFloatFFT_3D.realForward(float[]), then the returned valueindexgives access to the[s][r][c]Fourier mode- if
index ==, then the Fourier mode is zero,Integer.MIN_VALUE - if
index ≥ 0, then the Fourier mode ispacked[index], - if
index < 0, then the Fourier mode is-packed[-index],
- Parameters:
s- the slice indexr- the row indexc- the column index- Returns:
- the value of
index
- if
-
getIndex
public long getIndex(long s, long r, long c)Returns the 1d index of the specified 3d Fourier mode. In other words, ifpackedcontains the transformed data following a call toDoubleFFT_3D.realForwardFull(double[])orFloatFFT_3D.realForward(float[]), then the returned valueindexgives access to the[s][r][c]Fourier mode- if
index ==, then the Fourier mode is zero,Integer.MIN_VALUE - if
index ≥ 0, then the Fourier mode ispacked[index], - if
index < 0, then the Fourier mode is-packed[-index],
- Parameters:
s- the slice indexr- the row indexc- the column index- Returns:
- the value of
index
- if
-
pack
public void pack(double val, int s, int r, int c, double[] packed, int pos)Sets the specified Fourier mode of the transformed data. The data array results from a call toDoubleFFT_3D.realForward(double[]).- Parameters:
val- the new value of the[s][r][c]Fourier modes- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked
-
pack
public void pack(double val, long s, long r, long c, DoubleLargeArray packed, long pos)Sets the specified Fourier mode of the transformed data. The data array results from a call toDoubleFFT_3D.realForward(DoubleLargeArray).- Parameters:
val- the new value of the[s][r][c]Fourier modes- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked
-
pack
public void pack(double val, int s, int r, int c, double[][][] packed)Sets the specified Fourier mode of the transformed data. The data array results from a call toDoubleFFT_3D.realForward(double[][][]).- Parameters:
val- the new value of the[s][r][c]Fourier modes- the slice indexr- the row indexc- the column indexpacked- the transformed data
-
pack
public void pack(float val, int s, int r, int c, float[] packed, int pos)Sets the specified Fourier mode of the transformed data. The data array results from a call toFloatFFT_3D.realForward(float[]).- Parameters:
val- the new value of the[s][r][c]Fourier modes- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked
-
pack
public void pack(float val, long s, long r, long c, FloatLargeArray packed, long pos)Sets the specified Fourier mode of the transformed data. The data array results from a call toFloatFFT_3D.realForward(FloatLargeArray).- Parameters:
val- the new value of the[s][r][c]Fourier modes- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked
-
pack
public void pack(float val, int s, int r, int c, float[][][] packed)Sets the specified Fourier mode of the transformed data. The data array results from a call toFloatFFT_3D.realForward(float[][][]).- Parameters:
val- the new value of the[s][r][c]Fourier modes- the slice indexr- the row indexc- the column indexpacked- the transformed data
-
unpack
public double unpack(int s, int r, int c, double[] packed, int pos)Returns the specified Fourier mode of the transformed data. The data array results from a call toDoubleFFT_3D.realForward(double[]).- Parameters:
s- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked- Returns:
- the value of the
[s][r][c]Fourier mode
-
unpack
public double unpack(long s, long r, long c, DoubleLargeArray packed, long pos)Returns the specified Fourier mode of the transformed data. The data array results from a call toDoubleFFT_3D.realForward(DoubleLargeArray).- Parameters:
s- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked- Returns:
- the value of the
[s][r][c]Fourier mode
-
unpack
public double unpack(int s, int r, int c, double[][][] packed)Returns the specified Fourier mode of the transformed data. The data array results from a call toDoubleFFT_3D.realForward(double[][][]).- Parameters:
s- the slice indexr- the row indexc- the column indexpacked- the transformed data- Returns:
- the value of the
[s][r][c]Fourier mode
-
unpack
public float unpack(int s, int r, int c, float[] packed, int pos)Returns the specified Fourier mode of the transformed data. The data array results from a call toFloatFFT_3D.realForward(float[]).- Parameters:
s- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked- Returns:
- the value of the
[s][r][c]Fourier mode
-
unpack
public float unpack(long s, long r, long c, FloatLargeArray packed, long pos)Returns the specified Fourier mode of the transformed data. The data array results from a call toFloatFFT_3D.realForward(FloatLargeArray).- Parameters:
s- the slice indexr- the row indexc- the column indexpacked- the transformed datapos- index of the first element in arraypacked- Returns:
- the value of the
[s][r][c]Fourier mode
-
unpack
public float unpack(int s, int r, int c, float[][][] packed)Returns the specified Fourier mode of the transformed data. The data array results from a call toFloatFFT_3D.realForward(float[][][]).- Parameters:
s- the slice indexr- the row indexc- the column indexpacked- the transformed data- Returns:
- the value of the
[s][r][c]Fourier mode
-
-
DataMelt 3.0 © DataMelt by jWork.ORG