@Override public Runnable create( final double[] halfkernel, final RandomAccess< S > in, final RandomAccess< T > out, final int d, final long lineLength ) { return new DoubleConvolverRealTypeBuffered< S, T >( halfkernel, in, out, d, lineLength ); } };
private static < S extends RealType< S >, T extends RealType< T > > void convolveRealTypeDouble( final double[][] halfkernels, final RandomAccessible< S > source, final RandomAccessibleInterval< T > target, final ExecutorService service ) { final DoubleType type = new DoubleType(); final ImgFactory< DoubleType > imgfac = getImgFactory( target, halfkernels, type ); if ( canUseBufferedConvolver( target, halfkernels ) ) convolve( halfkernels, source, target, DoubleConvolverRealTypeBuffered.< S, DoubleType >factory(), DoubleConvolverRealTypeBuffered.< DoubleType, DoubleType >factory(), DoubleConvolverRealTypeBuffered.< DoubleType, T >factory(), DoubleConvolverRealTypeBuffered.< S, T >factory(), imgfac, service ); else convolve( halfkernels, source, target, DoubleConvolverRealType.< S, DoubleType >factory(), DoubleConvolverRealType.< DoubleType, DoubleType >factory(), DoubleConvolverRealType.< DoubleType, T >factory(), DoubleConvolverRealType.< S, T >factory(), imgfac, service ); }
@Override public void run() { final int max = buflen - k1; for ( int i = k1; i < max; ++i ) { final double w = in.get().getRealDouble(); // center buf[ i ] += w * kernel[ 0 ]; // loop for ( int j = 1; j < k1; ++j ) { final double wk = w * kernel[ j ]; buf[ i + j ] += wk; buf[ i - j ] += wk; } // outer-most final double wk = w * kernel[ k1 ]; buf[ i - k1 ] += wk; buf[ i + k1 ] = wk; in.fwd( d ); } writeLine(); }
private static < S extends RealType< S >, T extends RealType< T > > void convolveRealTypeDouble( final double[][] halfkernels, final RandomAccessible< S > source, final RandomAccessibleInterval< T > target, final int numThreads ) { final DoubleType type = new DoubleType(); final ImgFactory< DoubleType > imgfac = getImgFactory( target, halfkernels, type ); if ( canUseBufferedConvolver( target, halfkernels ) ) convolve( halfkernels, source, target, DoubleConvolverRealTypeBuffered.< S, DoubleType >factory(), DoubleConvolverRealTypeBuffered.< DoubleType, DoubleType >factory(), DoubleConvolverRealTypeBuffered.< DoubleType, T >factory(), DoubleConvolverRealTypeBuffered.< S, T >factory(), imgfac, type, numThreads ); else convolve( halfkernels, source, target, DoubleConvolverRealType.< S, DoubleType >factory(), DoubleConvolverRealType.< DoubleType, DoubleType >factory(), DoubleConvolverRealType.< DoubleType, T >factory(), DoubleConvolverRealType.< S, T >factory(), imgfac, type, numThreads ); }
@Override public void run() { final int max = buflen - k1; for ( int i = k1; i < max; ++i ) { final double w = in.get().getRealDouble(); // center buf[ i ] += w * kernel[ 0 ]; // loop for ( int j = 1; j < k1; ++j ) { final double wk = w * kernel[ j ]; buf[ i + j ] += wk; buf[ i - j ] += wk; } // outer-most final double wk = w * kernel[ k1 ]; buf[ i - k1 ] += wk; buf[ i + k1 ] = wk; in.fwd( d ); } writeLine(); }
@Override public Runnable create( final double[] halfkernel, final RandomAccess< S > in, final RandomAccess< T > out, final int d, final long lineLength ) { return new DoubleConvolverRealTypeBuffered< S, T >( halfkernel, in, out, d, lineLength ); } };
/** * @return a {@link ConvolverFactory} producing {@link DoubleConvolverRealTypeBuffered}. */ public static < S extends RealType< S >, T extends RealType< T > > ConvolverFactory< S, T > factory() { return new ConvolverFactory< S, T >() { @Override public Runnable create( final double[] halfkernel, final RandomAccess< S > in, final RandomAccess< T > out, final int d, final long lineLength ) { return new DoubleConvolverRealTypeBuffered< S, T >( halfkernel, in, out, d, lineLength ); } }; }
/** * @return a {@link ConvolverFactory} producing * {@link DoubleConvolverRealTypeBuffered}. */ public static < S extends RealType< S >, T extends RealType< T > > ConvolverFactory< S, T > factory() { return new ConvolverFactory< S, T >() { @Override public Runnable create( final double[] halfkernel, final RandomAccess< S > in, final RandomAccess< T > out, final int d, final long lineLength ) { return new DoubleConvolverRealTypeBuffered< S, T >( halfkernel, in, out, d, lineLength ); } }; }