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

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

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

Views.raster介绍

[英]Turns a RealRandomAccessible into a RandomAccessible, providing RandomAccess at integer coordinates.
[中]将RealRandomAccessible转换为RandomAccessible,在整数坐标下提供RandomAccess。

代码示例

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

@Override
public RandomAccessibleOnRealRandomAccessible<T> calculate(RealRandomAccessible<T> input) {
  return Views.raster(input);
}

代码示例来源:origin: sc.fiji/bigdataviewer-core

@Override
public RandomAccessibleInterval< T > getSource( final int t, final int level )
{
  return Views.interval( Views.raster( accessible ), getInterval( t, level ) );
}

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

private static <T> IterableInterval<T> iterableInterval(
  final RealRandomAccessibleRealInterval<T> realInterval)
{
  final RandomAccessibleOnRealRandomAccessible<T> raster =
    Views.raster(realInterval);
  final IntervalView<T> interval =
    Views.interval(raster, findMin(realInterval), findMax(realInterval));
  return Views.iterable(interval);
}

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

@Override
public RandomAccessibleInterval<T> calculate(RandomAccessibleInterval<T> input) {
  final long[] newDims = Intervals.dimensionsAsLongArray(in());
  for (int i = 0; i < Math.min(scaleFactors.length, in().numDimensions()); i++) {
    newDims[i] = Math.round(in().dimension(i) * scaleFactors[i]);
  }
  IntervalView<T> interval = Views.interval(Views.raster(RealViews.affineReal(
    Views.interpolate(Views.extendMirrorSingle(input), interpolator),
    new Scale(scaleFactors))), new FinalInterval(newDims));
  return interval;
}

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

public RandomAccessibleInterval< FloatType > getRandomAccessibleInterval()
{
  // InverseDistanceWeightingInterpolatorFactory
  final NearestNeighborSearch< FloatType > search = new NearestNeighborSearchOnKDTree<>( new KDTree<>( qualityList ) );
  final RealRandomAccessible< FloatType > realRandomAccessible = Views.interpolate( search, new NearestNeighborSearchInterpolatorFactory< FloatType >() );
  final RandomAccessible< FloatType > randomAccessible = Views.raster( realRandomAccessible );
  final RandomAccessibleInterval< FloatType > rai = Views.interval( randomAccessible, interval );
  return Views.interval( Views.extendZero( rai ), interval );
}

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

public RandomAccessibleInterval< FloatType > getRandomAccessibleInterval( final int numPoints, final double power )
{
  final KNearestNeighborSearch< FloatType > search = new KNearestNeighborSearchOnKDTree<>( new KDTree<>( qualityList ), numPoints );
  final RealRandomAccessible< FloatType > realRandomAccessible = Views.interpolate( search, new InverseDistanceWeightingInterpolatorFactory< FloatType >( power ) );
  final RandomAccessible< FloatType > randomAccessible = Views.raster( realRandomAccessible );
  final RandomAccessibleInterval< FloatType > rai = Views.interval( randomAccessible, interval );
  return Views.interval( Views.extendZero( rai ), interval );
}

代码示例来源:origin: sc.fiji/TrakEM2_

Views.raster(
    RealViews.transform(
        RealViews.transform(

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

@Override
public ImageRoi convert(final RealMaskRealInterval mask) {
  // Wrap mask as RRARI
  final RealRandomAccessibleRealInterval<BoolType> rrari = Masks
    .toRealRandomAccessibleRealInterval(mask);
  // Convert the RRARI to a RAI whose min is (0, 0), this will ensure it
  // displays properly
  final RandomAccessible<BoolType> raster = Views.raster(rrari);
  final RandomAccessible<BoolType> translate = Views.translate(raster,
    new long[] { (long) -mask.realMin(0), (long) -mask.realMin(1) });
  final RandomAccessibleInterval<BoolType> rai = Views.interval(translate,
    new long[] { 0, 0 }, new long[] { (long) (mask.realMax(0) - mask.realMin(
      0)), (long) (mask.realMax(1) - mask.realMin(1)) });
  // Convert RAI to ImagePlus
  final Dataset d = datasetService.create(rai);
  final ImagePlus ip = convertService.convert(d, ImagePlus.class);
  return new ImageRoi((int) mask.realMin(0), (int) mask.realMin(1), ip
    .getBufferedImage());
}

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

@Test
  public void defaultRasterTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{10,  10}, new DoubleType());
    MersenneTwisterFast r = new MersenneTwisterFast(SEED);
    for (DoubleType d : img) {
      d.set(r.nextDouble());
    }
    RealRandomAccessible<DoubleType> realImg = Views.interpolate(img, new FloorInterpolatorFactory<DoubleType>());
    
    RandomAccessibleOnRealRandomAccessible<DoubleType> il2 = Views.raster(realImg);
    RandomAccessibleOnRealRandomAccessible<DoubleType> opr = ops.transform().rasterView(realImg);
    
    Cursor<DoubleType> il2C = Views.interval(il2, img).localizingCursor();
    RandomAccess<DoubleType> oprRA = Views.interval(opr, img).randomAccess();
    
    while (il2C.hasNext()) {
      il2C.next();
      oprRA.setPosition(il2C);
      assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
    }
  }
}

相关文章