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

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

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

Views.permuteCoordinatesInverse介绍

[英]Inverse 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.permuteCoordinatesInverse(input, permutation);
}

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

/**
 * Inverse bijective permutation of the integer coordinates of one dimension
 * of a {@link RandomAccessibleInterval}.
 *
 * @param source
 *            must have dimension(dimension) == permutation.length
 * @param permutation
 *            must be a bijective permutation over its index set, i.e. for a
 *            lut of length n, the sorted content the array must be
 *            [0,...,n-1] which is the index set of the lut.
 * @param d
 *            dimension index to be permuted
 *
 * @return {@link IntervalView} of permuted source.
 *
 * @deprecated use {@link Views#permuteCoordinatesInverse(RandomAccessibleInterval, int[], int)}
 */
@Deprecated
public static < T > IntervalView< T > permuteCoordinateInverse( final RandomAccessibleInterval< T > source, final int[] permutation, final int d )
{
  return permuteCoordinatesInverse(source, permutation, d);
}

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

/**
 * Inverse bijective permutation of the integer coordinates of one dimension
 * of a {@link RandomAccessibleInterval}.
 *
 * @param source
 *            must have dimension(dimension) == permutation.length
 * @param permutation
 *            must be a bijective permutation over its index set, i.e. for a
 *            lut of length n, the sorted content the array must be
 *            [0,...,n-1] which is the index set of the lut.
 * @param d
 *            dimension index to be permuted
 *
 * @return {@link IntervalView} of permuted source.
 *
 * @deprecated use {@link Views#permuteCoordinatesInverse(RandomAccessibleInterval, int[], int)}
 */
@Deprecated
public static < T > IntervalView< T > permuteCoordinateInverse( final RandomAccessibleInterval< T > source, final int[] permutation, final int d )
{
  return permuteCoordinatesInverse(source, permutation, d);
}

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

@Test
public void permuteCoordinatesInverseOfDimensionTest() {
  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());
  }
  
  IntervalView<DoubleType> out = Views.permuteCoordinatesInverse(img, new int[]{0, 1}, 1);
  
  Cursor<DoubleType> il2 = out.cursor();
  RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesInverseView(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 defaultPermuteCoordinatesInverseTest() {
  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.permuteCoordinatesInverse(img, new int[]{0, 1}).cursor();
  RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesInverseView(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 testIntervalPermuteInverseCoordinates() {
  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.permuteCoordinatesInverse(img, new int[]{0, 1});
  Cursor<DoubleType> e = expected.cursor();
  RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesInverseView(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 testIntervalPermuteInverseDimensionCoordinates() {
    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.permuteCoordinatesInverse(img, new int[]{0, 1}, 1);
    Cursor<DoubleType> e = expected.cursor();
    RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesInverseView(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));
    
  }
}

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

final TransformView< LongType > bijectivePermutation = new TransformView< LongType >( img, t );
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 TransformView< IntType > inversed = new TransformView< IntType >( transformed, inverse );
final IntervalView< IntType > viewTransformed = Views.permuteCoordinatesInverse( this.img, this.lut, this.d );
final IntervalView< IntType > identity = Views.permuteCoordinates( viewTransformed, this.lut, this.d );

相关文章