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

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

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

Views.extendRandom介绍

[英]Extend a RandomAccessibleInterval with a random-value out-of-bounds strategy.
[中]使用随机值越界策略扩展RandomAccessibleInterval。

代码示例

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

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

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

  1. /**
  2. * Expand a RandomAccessibleInterval as specified by border. source will be
  3. * extended with a random-value out-of-bounds strategy.
  4. *
  5. * @param source
  6. * the interval to expand.
  7. * @param min
  8. * the minimal random value
  9. * @param max
  10. * the maximal random value
  11. * @return Expansion of the {@link RandomAccessibleInterval} source as
  12. * specified by min, max, and border.
  13. */
  14. public static < T extends RealType< T > > IntervalView< T > expandRandom( final RandomAccessibleInterval< T > source, final double min, final double max, final long... border )
  15. {
  16. return interval( extendRandom( source, min, max ), Intervals.expand( source, border ) );
  17. }

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

  1. /**
  2. * Expand a RandomAccessibleInterval as specified by border. source will be
  3. * extended with a random-value out-of-bounds strategy.
  4. *
  5. * @param source
  6. * the interval to expand.
  7. * @param min
  8. * the minimal random value
  9. * @param max
  10. * the maximal random value
  11. * @return Expansion of the {@link RandomAccessibleInterval} source as
  12. * specified by min, max, and border.
  13. */
  14. public static < T extends RealType< T > > IntervalView< T > expandRandom( final RandomAccessibleInterval< T > source, final double min, final double max, final long... border )
  15. {
  16. return interval( extendRandom( source, min, max ), Intervals.expand( source, border ) );
  17. }

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

  1. @Test
  2. public void extendRandomTest() {
  3. Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
  4. OutOfBounds<DoubleType> il2 = Views.extendRandom(img, 0, 0).randomAccess();
  5. OutOfBounds<DoubleType> opr = ops.transform().extendRandomView(img, 0, 0).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. }

相关文章