/** * Computes a complex-to-real inverse FFT transform of an n-dimensional dataset in a certain dimension (typically dim = 0). * By default as many threads as processors are available are used. * By default the real values are scaled (divided by the amount of pixels in the input dataset), this way after performing a forward and reverse FFT, the values will be exactly the same * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param dim - the dimension to compute the inverse FFT in * @return - true if successful, false if the dimensions of input and output are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static < C extends ComplexType< C >, R extends RealType< R > > boolean complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final int dim ) { return complexToReal( input, output, output, dim, true ); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional dataset in a certain dimension (typically dim = 0). * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in the image * @param numThreads - the number of threads used for the computation (if dataset is more than 1-dimensional) * @return - true if successful, false if the dimensions of input and output are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static < C extends ComplexType< C >, R extends RealType< R > > boolean complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final int dim, final boolean scale, final int numThreads ) { return complexToReal( input, output, output, dim, scale, numThreads ); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional dataset in a certain dimension (typically dim = 0). * By default as many threads as processors are available are used. * By default the real values are scaled (divided by the amount of pixels in the input dataset), this way after performing a forward and reverse FFT, the values will be exactly the same * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param interval - if just a subset of the real-values output is required it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the inverse FFT in * @return - true if successful, false if the dimensions of input and output are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static < C extends ComplexType< C >, R extends RealType< R > > boolean complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final Interval interval, final int dim ) { return complexToReal( input, output, interval, dim, true ); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). By default as many * threads as processors are available are used. By default the real values * are scaled (divided by the amount of pixels in the input dataset), this way * after performing a forward and reverse FFT, the values will be exactly the * same * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param dim - the dimension to compute the inverse FFT in * @return - true if successful, false if the dimensions of input and output * are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static <C extends ComplexType<C>, R extends RealType<R>> boolean complexToReal(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<R> output, final int dim) { return complexToReal(input, output, output, dim, true); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in * the image * @param nThreads - number of threads to utilize * @return - true if successful, false if the dimensions of input and output * are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static <C extends ComplexType<C>, R extends RealType<R>> boolean complexToReal(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<R> output, final int dim, final boolean scale, int nThreads) { return complexToReal(input, output, output, dim, scale, nThreads); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). By default as many * threads as processors are available are used. By default the real values * are scaled (divided by the amount of pixels in the input dataset), this way * after performing a forward and reverse FFT, the values will be exactly the * same * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param interval - if just a subset of the real-values output is required it * can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the inverse FFT in * @return - true if successful, false if the dimensions of input and output * are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static <C extends ComplexType<C>, R extends RealType<R>> boolean complexToReal(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<R> output, final Interval interval, final int dim) { return complexToReal(input, output, interval, dim, true); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). By default as many * threads as processors are available are used. * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in * the image * @param service - service providing threads for multi-threading (if numDims * > 1) * @return - true if successful, false if the dimensions of input and output * are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static <C extends ComplexType<C>, R extends RealType<R>> boolean complexToReal(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<R> output, final int dim, final boolean scale, final ExecutorService service) { return complexToReal(input, output, output, dim, scale, service); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional dataset in a certain dimension (typically dim = 0). * By default as many threads as processors are available are used. * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in the image * @return - true if successful, false if the dimensions of input and output are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static < C extends ComplexType< C >, R extends RealType< R > > boolean complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final int dim, final boolean scale ) { return complexToReal( input, output, output, dim, scale, Runtime.getRuntime().availableProcessors() ); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional dataset in a certain dimension (typically dim = 0). * By default as many threads as processors are available are used. * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param interval - if just a subset of the real-values output is required it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in the image * @return - true if successful, false if the dimensions of input and output are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static < C extends ComplexType< C >, R extends RealType< R > > boolean complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final Interval interval, final int dim, final boolean scale ) { return complexToReal( input, output, interval, dim, scale, Runtime.getRuntime().availableProcessors() ); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). By default as many * threads as processors are available are used. * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param interval - if just a subset of the real-values output is required it * can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in * the image * @return - true if successful, false if the dimensions of input and output * are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static <C extends ComplexType<C>, R extends RealType<R>> boolean complexToReal(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<R> output, final Interval interval, final int dim, final boolean scale) { return complexToReal(input, output, interval, dim, scale, Runtime .getRuntime().availableProcessors()); }
/** * Computes a complex-to-real inverse FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). By default as many * threads as processors are available are used. * * @param input - the complex-valued input dataset * @param output - the real-valued output dataset * @param interval - if just a subset of the real-values output is required it * can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the inverse FFT in * @param scale - define if each pixel is divided by the sum of all pixels in * the image * @param nThreads - number of threads to utilize * @return - true if successful, false if the dimensions of input and output * are not compatible, i.e. not supported by the edu_mines_jtk 1d fft */ final public static <C extends ComplexType<C>, R extends RealType<R>> boolean complexToReal(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<R> output, final Interval interval, final int dim, final boolean scale, int nThreads) { ExecutorService service = Executors.newFixedThreadPool(nThreads); boolean ret = complexToReal(input, output, interval, dim, scale, service); service.shutdown(); return ret; }
final public static < C extends ComplexType< C >, R extends RealType< R > > void complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output ) { for ( int d = 1; d < input.numDimensions(); ++d ) FFTMethods.complexToComplex( input, d, false ); FFTMethods.complexToReal( input, output, 0 ); }
final public static < C extends ComplexType< C >, R extends RealType< R > > void complexToReal( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final ExecutorService service ) { for ( int d = 1; d < input.numDimensions(); ++d ) FFTMethods.complexToComplex( input, d, false, true, service ); FFTMethods.complexToReal( input, output, 0, true, service ); }
final public static < C extends ComplexType< C >, R extends RealType< R > > void complexToRealUnpad( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output ) { for ( int d = 1; d < input.numDimensions(); ++d ) FFTMethods.complexToComplex( input, d, false ); FFTMethods.complexToReal( input, output, FFTMethods.unpaddingIntervalCentered( input, output ), 0 ); } }
final public static < C extends ComplexType< C >, R extends RealType< R > > void complexToRealUnpad( final RandomAccessibleInterval< C > input, final RandomAccessibleInterval< R > output, final ExecutorService service ) { for ( int d = 1; d < input.numDimensions(); ++d ) FFTMethods.complexToComplex( input, d, false, true, service ); FFTMethods.complexToReal( input, output, FFTMethods.unpaddingIntervalCentered( input, output ), 0, true, service ); }
/** * Compute an ND inverse FFT */ @Override public void compute(final RandomAccessibleInterval<C> input, final RandomAccessibleInterval<T> output) { final RandomAccessibleInterval<C> temp = copyOp.calculate(input); for (int d = input.numDimensions() - 1; d > 0; d--) FFTMethods.complexToComplex(temp, d, false, true, ts .getExecutorService()); FFTMethods.complexToReal(temp, output, FFTMethods.unpaddingIntervalCentered( temp, output), 0, true, ts.getExecutorService()); }
FFTMethods.complexToComplex( fft, d, false ); FFTMethods.complexToReal( fft, output, 0 ); FFTMethods.complexToComplex( fft, d, false ); FFTMethods.complexToReal( fft, output, FFTMethods.unpaddingIntervalCentered( inputInterval, outputDimensions ), 0 );
FFTMethods.complexToComplex( fft, d, false ); FFTMethods.complexToReal( fft, output, 0, true, service ); FFTMethods.complexToComplex( fft, d, false, true, service ); FFTMethods.complexToReal( fft, output, FFTMethods.unpaddingIntervalCentered( inputInterval, outputDimensions ), 0, true, service );