net.imglib2.view.Views.extendPeriodic()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中net.imglib2.view.Views.extendPeriodic()方法的一些代码示例,展示了Views.extendPeriodic()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Views.extendPeriodic()方法的具体详情如下:
包路径:net.imglib2.view.Views
类名称:Views
方法名:extendPeriodic

Views.extendPeriodic介绍

[英]Extend a RandomAccessibleInterval with a periodic out-of-bounds strategy.
[中]使用周期性越界策略扩展随机访问的区间。

代码示例

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. public PSFExtraction(
  2. final RandomAccessibleInterval< T > img,
  3. final Collection< RealLocalizable > locations,
  4. final T type,
  5. final long[] size,
  6. final boolean multithreaded )
  7. {
  8. // Mirror produces some artifacts ... so we use periodic
  9. this( Views.extendPeriodic( img ), locations, type, size, multithreaded );
  10. }

代码示例来源:origin: imagej/imagej-ops

  1. @Override
  2. public ExtendedRandomAccessibleInterval<T, F> calculate(F input) {
  3. return Views.extendPeriodic(input);
  4. }
  5. }

代码示例来源:origin: net.imglib2/imglib2-script

  1. public ExtendPeriodic(final RandomAccessibleInterval<T> img) {
  2. super(Views.interval(Views.extendPeriodic(img), img));
  3. }

代码示例来源:origin: net.imglib2/imglib2

  1. /**
  2. * Expand a RandomAccessibleInterval as specified by border. source will be
  3. * extended with a periodic out-of-bounds strategy.
  4. *
  5. * @param source
  6. * the interval to expand.
  7. * @return Expansion of the {@link RandomAccessibleInterval} source as
  8. * specified by border.
  9. */
  10. public static < T > IntervalView< T > expandPeriodic( final RandomAccessibleInterval< T > source, final long... border )
  11. {
  12. return interval( extendPeriodic( source ), Intervals.expand( source, border ) );
  13. }

代码示例来源:origin: imglib/imglib2

  1. /**
  2. * Expand a RandomAccessibleInterval as specified by border. source will be
  3. * extended with a periodic out-of-bounds strategy.
  4. *
  5. * @param source
  6. * the interval to expand.
  7. * @return Expansion of the {@link RandomAccessibleInterval} source as
  8. * specified by border.
  9. */
  10. public static < T > IntervalView< T > expandPeriodic( final RandomAccessibleInterval< T > source, final long... border )
  11. {
  12. return interval( extendPeriodic( source ), Intervals.expand( source, border ) );
  13. }

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

  1. public static < R extends RealType< R > > Img< ComplexFloatType > computeKernelFFT(
  2. final Interval kernelConvolutionInterval,
  3. final long[] min,
  4. final long[] max,
  5. final boolean complexConjugate,
  6. final RandomAccessible< R > kernel,
  7. final ImgFactory< ComplexFloatType > fftFactory,
  8. final ExecutorService service )
  9. {
  10. // assemble the correct kernel (size of the input + extended periodic +
  11. // top left at center of input kernel)
  12. final RandomAccessibleInterval< R > kernelInput = Views.interval( Views.extendPeriodic( Views.interval( kernel, kernelConvolutionInterval ) ), new FinalInterval( min, max ) );
  13. final Img< ComplexFloatType > fftKernel = FFT.realToComplex( kernelInput, fftFactory, service );
  14. // if complexConjugate is set we are computing the correlation
  15. // instead of the convolution (same as mirroring the kernel)
  16. // should be false by default
  17. if ( complexConjugate )
  18. FFTMethods.complexConjugate( fftKernel );
  19. return fftKernel;
  20. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. public static < R extends RealType< R > > Img< ComplexFloatType > computeKernelFFT(
  2. final Interval kernelConvolutionInterval,
  3. final long[] min,
  4. final long[] max,
  5. final boolean complexConjugate,
  6. final RandomAccessible< R > kernel,
  7. final ImgFactory< ComplexFloatType > fftFactory,
  8. final ExecutorService service )
  9. {
  10. // assemble the correct kernel (size of the input + extended periodic +
  11. // top left at center of input kernel)
  12. final RandomAccessibleInterval< R > kernelInput = Views.interval( Views.extendPeriodic( Views.interval( kernel, kernelConvolutionInterval ) ), new FinalInterval( min, max ) );
  13. final Img< ComplexFloatType > fftKernel = FFT.realToComplex( kernelInput, fftFactory, service );
  14. // if complexConjugate is set we are computing the correlation
  15. // instead of the convolution (same as mirroring the kernel)
  16. // should be false by default
  17. if ( complexConjugate )
  18. FFTMethods.complexConjugate( fftKernel );
  19. return fftKernel;
  20. }

代码示例来源:origin: net.imglib2/imglib2-ops

  1. /**
  2. * Creates the histograms for all contextual regions. The image is scanned
  3. * line by line as this (hopefully) speeds up the underlying image cursor.
  4. */
  5. private int[] createHistograms( K img )
  6. {
  7. RandomAccess< T > ra = Views.extendPeriodic( img ).randomAccess();
  8. int[] histograms = new int[ m_ctxNrX * m_ctxNrY * histNrBins ];
  9. for ( int ctxY = 0; ctxY < m_ctxNrY; ctxY++ )
  10. {
  11. for ( int y = 0; y < ctxYSize; y++ )
  12. {
  13. for ( int ctxX = 0; ctxX < m_ctxNrX; ctxX++ )
  14. {
  15. for ( int x = 0; x < ctxXSize; x++ )
  16. {
  17. ra.fwd( 0 );
  18. final int bin = valueToBin( ra.get().getRealDouble() );
  19. final int offSet = ctxY * m_ctxNrX * histNrBins + ctxX * histNrBins;
  20. final int index = offSet + bin;
  21. histograms[ index ]++;
  22. }
  23. }
  24. ra.fwd( 1 );
  25. }
  26. }
  27. return histograms;
  28. }

代码示例来源:origin: net.imglib2/imglib2-algorithms-legacy

  1. ExtendedRandomAccessibleInterval<FloatType, Img<FloatType>> extendedInvPCM = Views.extendPeriodic(invPCM);
  2. final LocalNeighborhoodCursor<FloatType> localCursor =
  3. new LocalNeighborhoodCursor<FloatType>( extendedInvPCM.randomAccess(), 1 );

代码示例来源:origin: imagej/imagej-ops

  1. @Override
  2. @SuppressWarnings("unchecked")
  3. public O calculate(final I kernel, final Dimensions paddedDimensions) {
  4. Dimensions paddedFFTInputDimensions;
  5. // if an fftsize op has been set recompute padded size
  6. if (fftSizeOp != null) {
  7. long[][] sizes = fftSizeOp.calculate(paddedDimensions);
  8. paddedFFTInputDimensions = new FinalDimensions(sizes[0]);
  9. }
  10. else {
  11. paddedFFTInputDimensions = paddedDimensions;
  12. }
  13. // compute where to place the final Interval for the kernel so that the
  14. // coordinate in the center
  15. // of the kernel is shifted to position (0,0).
  16. final Interval kernelConvolutionInterval = paddingIntervalCentered.calculate(
  17. kernel, paddedFFTInputDimensions);
  18. final Interval kernelConvolutionIntervalOrigin = paddingIntervalOrigin
  19. .calculate(kernel, kernelConvolutionInterval);
  20. return (O) Views.interval(Views.extendPeriodic(Views.interval(Views
  21. .extendValue(kernel, Util.getTypeFromInterval(kernel).createVariable()),
  22. kernelConvolutionInterval)), kernelConvolutionIntervalOrigin);
  23. }

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

  1. final RandomAccessibleInterval< R > kernelInput = Views.interval( Views.extendPeriodic( Views.interval( kernel, kernelConvolutionInterval ) ), new FinalInterval( min, max ) );
  2. final RandomAccessibleInterval< R > imgInput = Views.interval( img, imgConvolutionInterval );

代码示例来源:origin: net.imglib2/imglib2-algorithms-gpl

  1. final RandomAccessibleInterval< R > kernelInput = Views.interval( Views.extendPeriodic( Views.interval( kernel, kernelConvolutionInterval ) ), new FinalInterval( min, max ) );
  2. final RandomAccessibleInterval< R > imgInput = Views.interval( img, imgConvolutionInterval );

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. final RandomAccessibleInterval< R > kernelInput = Views.interval( Views.extendPeriodic( Views.interval( kernel, kernelConvolutionInterval ) ), new FinalInterval( min, max ) );
  2. final RandomAccessibleInterval< R > imgInput = Views.interval( img, imgConvolutionInterval );

代码示例来源:origin: net.imagej/imagej-deprecated

  1. break;
  2. case PERIODICAL:
  3. RandomAccess< T > srcRA = Views.extendPeriodic( op ).randomAccess();
  4. Cursor< T > resCur = Views.iterable( res ).localizingCursor();
  5. while ( resCur.hasNext() )

代码示例来源:origin: net.imglib2/imglib2-algorithms-legacy

  1. cursor = Views.extendPeriodic( laPlacian ).randomAccess();
  2. else
  3. cursor = laPlacian.randomAccess();

代码示例来源:origin: net.imglib2/imglib2-algorithms-gpl

  1. final RandomAccessibleInterval< R > kernelInput = Views.interval( Views.extendPeriodic( Views.interval( kernel, kernelConvolutionInterval ) ), new FinalInterval( min, max ) );
  2. final RandomAccessibleInterval< R > imgInput = Views.interval( img, imgConvolutionInterval );

代码示例来源:origin: net.imglib2/imglib2-ops

  1. default:
  2. RandomAccess< T > srcRA = Views.extendPeriodic( op ).randomAccess();
  3. Cursor< T > resCur = res.localizingCursor();
  4. while ( resCur.hasNext() )

代码示例来源:origin: imagej/imagej-ops

  1. @Test
  2. public void extendPeriodicTest() {
  3. Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
  4. OutOfBounds<DoubleType> il2 = Views.extendPeriodic(img).randomAccess();
  5. OutOfBounds<DoubleType> opr = ops.transform().extendPeriodicView(img).randomAccess();
  6. il2.setPosition(new int[] { -1, -1 });
  7. opr.setPosition(new int[] { -1, -1 });
  8. assertEquals(il2.get().get(), opr.get().get(), 1e-10);
  9. il2.setPosition(new int[] { 11, 11 });
  10. opr.setPosition(new int[] { 11, 11 });
  11. assertEquals(il2.get().get(), opr.get().get(), 1e-10);
  12. }

相关文章