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

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

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

Views.permuteCoordinates介绍

[英]Bijective permutation of the integer coordinates in each dimension of a RandomAccessibleInterval.
[中]在随机可访问区间的每个维度上整数坐标的双射排列。

代码示例

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

@Override
public IntervalView<T> calculate(RandomAccessibleInterval<T> input) {
  return Views.permuteCoordinates(input, permutation);
}

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

final TransformView< LongType > inverseBijectivePermutation = new TransformView< LongType >( bijectivePermutation, t.inverse() );
final IntervalView< LongType > viewTransformed = Views.permuteCoordinatesInverse( img, PermutationTransformTest.lut );
final IntervalView< LongType > identity = Views.permuteCoordinates( viewTransformed, PermutationTransformTest.lut );

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

final IntervalView< IntType > identity = Views.permuteCoordinates( viewTransformed, this.lut, this.d );

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

@Override
public IntervalView<T> calculate(RandomAccessibleInterval<T> input) {
  return Views.permuteCoordinates(input, permutation, d);
}

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

@Test
public void defaultPermuteCoordinatesTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType());
  Cursor<DoubleType> c = img.cursor();
  MersenneTwisterFast r = new MersenneTwisterFast(SEED);
  while (c.hasNext()) {
    c.next().set(r.nextDouble());
  }
  Cursor<DoubleType> il2 = Views.permuteCoordinates(img, new int[]{0, 1}).cursor();
  RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}).randomAccess();
  
  while (il2.hasNext()) {
    il2.next();
    opr.setPosition(il2);
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
  }
  
}

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

@Test
public void permuteCoordinatesOfDimensionTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType());
  Cursor<DoubleType> c = img.cursor();
  MersenneTwisterFast r = new MersenneTwisterFast(SEED);
  while (c.hasNext()) {
    c.next().set(r.nextDouble());
  }
  Cursor<DoubleType> il2 = Views.permuteCoordinates(img, new int[]{0, 1}, 1).cursor();
  RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}, 1).randomAccess();
  
  while (il2.hasNext()) {
    il2.next();
    opr.setPosition(il2);
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
  }
  
}

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

@Test
public void testIntervalPermuteCoordinates() {
  Img<DoubleType> img = ArrayImgs.doubles(2, 2);
  Cursor<DoubleType> c = img.cursor();
  MersenneTwisterFast r = new MersenneTwisterFast(SEED);
  while (c.hasNext()) {
    c.next().set(r.nextDouble());
  }
  IntervalView<DoubleType> expected = Views.permuteCoordinates(img, new int[]{0, 1});
  Cursor<DoubleType> e = expected.cursor();
  RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesView(img, new int[]{0, 1});
  RandomAccess<DoubleType> actualRA = actual.randomAccess();
  
  while (e.hasNext()) {
    e.next();
    actualRA.setPosition(e);
    assertEquals(e.get().get(), actualRA.get().get(), 1e-10);
  }
  
  assertTrue(Intervals.equals(expected, actual));
  
}

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

@Test
public void testIntervalPermuteDimensionCoordinates() {
  Img<DoubleType> img = ArrayImgs.doubles(2, 2);
  Cursor<DoubleType> c = img.cursor();
  MersenneTwisterFast r = new MersenneTwisterFast(SEED);
  while (c.hasNext()) {
    c.next().set(r.nextDouble());
  }
  IntervalView<DoubleType> expected = Views.permuteCoordinates(img, new int[]{0, 1}, 1);
  Cursor<DoubleType> e = expected.cursor();
  RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}, 1);
  RandomAccess<DoubleType> actualRA = actual.randomAccess();
  
  while (e.hasNext()) {
    e.next();
    actualRA.setPosition(e);
    assertEquals(e.get().get(), actualRA.get().get(), 1e-10);
  }
  
  assertTrue(Intervals.equals(expected, actual));
  
}

相关文章