/** * Computes a real-to-complex forward 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 complex values are not scaled (not divided by the amount of pixels in the input dataset) * * @param input - the real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 < R extends RealType< R >, C extends ComplexType< C > > boolean realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output, final int dim ) { return realToComplex( input, output, output, dim, false ); }
/** * Computes a real-to-complex forward FFT transform of an n-dimensional dataset in a certain dimension (typically dim = 0). * * @param input - the real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 < R extends RealType< R >, C extends ComplexType< C > > boolean realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output, final int dim, final boolean scale, final int numThreads ) { return realToComplex( input, output, output, dim, scale, numThreads ); }
/** * Computes a real-to-complex forward 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 complex values are not scaled (not divided by the amount of pixels in the input dataset) * * @param input - the real-valued input dataset * @param output - the complex-valued output dataset * @param interval - if just a subset of the complex-valued output is required it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the 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 < R extends RealType< R >, C extends ComplexType< C > > boolean realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output, final Interval interval, final int dim ) { return realToComplex( input, output, dim, false ); }
/** * Computes a real-to-complex forward 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 complex values * are not scaled (not divided by the amount of pixels in the input dataset) * * @param input - the real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final int dim) { return realToComplex(input, output, output, dim, false); }
/** * Computes a real-to-complex forward 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 complex values * are not scaled (not divided by the amount of pixels in the input dataset) * * @param input - the real-valued input dataset * @param output - the complex-valued output dataset * @param interval - if just a subset of the complex-valued output is required * it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the 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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final Interval interval, final int dim) { return realToComplex(input, output, dim, false); }
/** * Computes a real-to-complex forward 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 real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final int dim, final boolean scale, int nThreads) { return realToComplex(input, output, output, dim, scale, nThreads); }
/** * Computes a real-to-complex forward 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 real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final int dim, final boolean scale) { return realToComplex(input, output, output, dim, scale); }
/** * Computes a real-to-complex forward FFT transform of an n-dimensional * dataset in a certain dimension (typically dim = 0). * * @param input - the real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 * @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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final int dim, final boolean scale, final ExecutorService service) { return realToComplex(input, output, output, dim, scale, service); }
/** * Computes a real-to-complex forward 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 real-valued input dataset * @param output - the complex-valued output dataset * @param dim - the dimension to compute the 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 < R extends RealType< R >, C extends ComplexType< C > > boolean realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output, final int dim, final boolean scale ) { return realToComplex( input, output, output, dim, scale, Runtime.getRuntime().availableProcessors() ); }
/** * Computes a real-to-complex forward 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 real-valued input dataset * @param output - the complex-valued output dataset * @param interval - if just a subset of the complex-valued output is required it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the 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 < R extends RealType< R >, C extends ComplexType< C > > boolean realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output, final Interval interval, final int dim, final boolean scale ) { return realToComplex( input, output, interval, dim, scale, Runtime.getRuntime().availableProcessors() ); }
/** * Computes a real-to-complex forward 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 real-valued input dataset * @param output - the complex-valued output dataset * @param interval - if just a subset of the complex-valued output is required * it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the 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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final Interval interval, final int dim, final boolean scale, int nThreads) { ExecutorService service = Executors.newFixedThreadPool(nThreads); boolean ret = realToComplex(input, output, interval, dim, scale, service); service.shutdown(); return ret; }
/** * Computes a real-to-complex forward 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 real-valued input dataset * @param output - the complex-valued output dataset * @param interval - if just a subset of the complex-valued output is required * it can be defined here (otherwise it can just be equal to output) * @param dim - the dimension to compute the 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 <R extends RealType<R>, C extends ComplexType<C>> boolean realToComplex(final RandomAccessibleInterval<R> input, final RandomAccessibleInterval<C> output, final Interval interval, final int dim, final boolean scale) { return realToComplex(input, output, interval, dim, scale, Runtime .getRuntime().availableProcessors()); }
final public static < R extends RealType< R >, C extends ComplexType< C > > void realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output ) { FFTMethods.realToComplex( input, output, 0 ); for ( int d = 1; d < input.numDimensions(); ++d ) FFTMethods.complexToComplex( output, d, true ); }
final public static < R extends RealType< R >, C extends ComplexType< C > > void realToComplex( final RandomAccessibleInterval< R > input, final RandomAccessibleInterval< C > output, final ExecutorService service ) { FFTMethods.realToComplex( input, output, 0, false, service ); for ( int d = 1; d < input.numDimensions(); ++d ) FFTMethods.complexToComplex( output, d, true, false, service ); }
/** * Computes an ND FFT using FFTMethods */ @Override public void compute(final RandomAccessibleInterval<T> input, final RandomAccessibleInterval<C> output) { // perform a real to complex FFT in the first dimension FFTMethods.realToComplex(input, output, 0, false, ts.getExecutorService()); // loop and perform complex to complex FFT in the remaining dimensions for (int d = 1; d < input.numDimensions(); d++) FFTMethods.complexToComplex(output, d, true, false, ts .getExecutorService()); }