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

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

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

Views.shear介绍

[英]Positive shear transform of a RandomAccessible using ShearTransform, i.e. c[ shearDimension ] = c[ shearDimension ] + c[ referenceDimension ]
[中]使用剪切变换的随机变量的正剪切变换,即c[shearDimension]=c[shearDimension]+c[referenceDimension]

代码示例

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

@Override
public IntervalView<T> calculate(RandomAccessible<T> input) {
  return Views.shear(input, interval, shearDimension, referenceDimension);
}

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

@Override
public TransformView<T> calculate(RandomAccessible<T> input) {
  return Views.shear(input, shearDimension, referenceDimension);
}

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

/**
 * Positive shear transform of a RandomAccessible using
 * {@link ShearTransform}, i.e. c[ shearDimension ] = c[ shearDimension ] +
 * c[ referenceDimension ]
 *
 * @param source
 *            input, e.g. extended {@link RandomAccessibleInterval}
 * @param interval
 *            original interval
 * @param shearDimension
 *            dimension to be sheared
 * @param referenceDimension
 *            reference dimension for shear
 *
 * @return {@link IntervalView} containing the result. The returned
 *         interval's dimension are determined by applying the
 *         {@link ShearTransform#transform} method on the input interval.
 */
public static < T > IntervalView< T > shear( final RandomAccessible< T > source, final Interval interval, final int shearDimension, final int referenceDimension )
{
  final ShearTransform transform = new ShearTransform( source.numDimensions(), shearDimension, referenceDimension );
  return Views.interval( Views.shear( source, shearDimension, referenceDimension ), transform.transform( new BoundingBox( interval ) ).getInterval() );
}

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

/**
 * Positive shear transform of a RandomAccessible using
 * {@link ShearTransform}, i.e. c[ shearDimension ] = c[ shearDimension ] +
 * c[ referenceDimension ]
 *
 * @param source
 *            input, e.g. extended {@link RandomAccessibleInterval}
 * @param interval
 *            original interval
 * @param shearDimension
 *            dimension to be sheared
 * @param referenceDimension
 *            reference dimension for shear
 *
 * @return {@link IntervalView} containing the result. The returned
 *         interval's dimension are determined by applying the
 *         {@link ShearTransform#transform} method on the input interval.
 */
public static < T > IntervalView< T > shear( final RandomAccessible< T > source, final Interval interval, final int shearDimension, final int referenceDimension )
{
  final ShearTransform transform = new ShearTransform( source.numDimensions(), shearDimension, referenceDimension );
  return Views.interval( Views.shear( source, shearDimension, referenceDimension ), transform.transform( new BoundingBox( interval ) ).getInterval() );
}

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

@Test
  public void UnshearIntervalTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 2, 2 }, new DoubleType());
    Cursor<DoubleType> imgC = img.cursor();
    while (imgC.hasNext()) {
      imgC.next().set(1);
    }

    Cursor<DoubleType> il2 = Views
        .unshear(Views.shear(Views.extendZero(img), 0, 1), new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 }), 0, 1)
        .cursor();
    RandomAccess<DoubleType> opr = ops.transform()
        .unshearView(Views.shear(Views.extendZero(img), 0, 1), new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 }), 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 defaultUnshearTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 2, 2 }, new DoubleType());
  Cursor<DoubleType> imgC = img.cursor();
  while (imgC.hasNext()) {
    imgC.next().set(1);
  }
  TransformView<DoubleType> il2 = Views.unshear(Views.shear(Views.extendZero(img), 0, 1), 0, 1);
  TransformView<DoubleType> opr = ops.transform().unshearView(Views.shear(Views.extendZero(img), 0, 1), 0, 1);
  Cursor<DoubleType> il2C = Views.interval(il2, new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 }))
      .cursor();
  RandomAccess<DoubleType> oprRA = Views
      .interval(opr, new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 })).randomAccess();
  while (il2C.hasNext()) {
    il2C.next();
    oprRA.setPosition(il2C);
    assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
  }
}

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

/** Tests {@link ShearViewInterval}. */
  @Test
  public void ShearIntervalTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 2, 2 }, new DoubleType());
    Cursor<DoubleType> imgC = img.cursor();
    while (imgC.hasNext()) {
      imgC.next().set(1);
    }

    Cursor<DoubleType> il2 = Views
        .shear(Views.extendZero(img), new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 }), 0, 1)
        .cursor();
    RandomAccess<DoubleType> opr = ops.transform()
        .shearView(Views.extendZero(img), new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 }), 0, 1)
        .randomAccess();

    while (il2.hasNext()) {
      il2.next();
      opr.setPosition(il2);
      assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    }
  }
}

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

/** Tests {@link DefaultShearView}. */
@Test
public void defaultShearTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 2, 2 }, new DoubleType());
  Cursor<DoubleType> imgC = img.cursor();
  while (imgC.hasNext()) {
    imgC.next().set(1);
  }
  TransformView<DoubleType> il2 = Views.shear(Views.extendZero(img), 0, 1);
  TransformView<DoubleType> opr = ops.transform().shearView(Views.extendZero(img), 0, 1);
  Cursor<DoubleType> il2C = Views.interval(il2, new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 }))
      .cursor();
  RandomAccess<DoubleType> oprRA = Views
      .interval(opr, new FinalInterval(new long[] { 0, 0 }, new long[] { 3, 3 })).randomAccess();
  while (il2C.hasNext()) {
    il2C.next();
    oprRA.setPosition(il2C);
    assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
  }
}

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

tf.transform( boundingBox );
IntervalView<FloatType> viewTransformed = Views.shear( extended, img, target, source );

相关文章