net.imglib2.img.Img.localizingCursor()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(240)

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

Img.localizingCursor介绍

暂无

代码示例

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

@Override
public Cursor<T> localizingCursor() {
  return img.localizingCursor();
}

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

@Override
public Cursor< LongType > localizingCursor()
{
  return counts.localizingCursor();
}

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

@Override
public Cursor< LongType > localizingCursor()
{
  return counts.localizingCursor();
}

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

@Override
public Cursor<T> localizingCursor() {
  return img.localizingCursor();
}

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

@Override
public Cursor<T> localizingCursor() {
  return img.localizingCursor();
}

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

@Override
public Cursor< LabelingType< T > > localizingCursor()
{
  final Cursor< I > c = img.localizingCursor();
  return new LabelingConvertedCursor< I, T >( c, generation, mapping );
}

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

public static final <T extends RealType<T>> void addGaussianNoiseToImage(Img<T> img, double sigma_noise) {
  Cursor<T> lc = img.localizingCursor();
  double val;
  T var = img.firstElement().createVariable();
  while (lc.hasNext()) {
    lc.fwd();
    val = Math.max(0, sigma_noise * ran.nextGaussian());
    var.setReal(val);
    lc.get().add(var);
  }
}

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

private void copy(ShuffledView<T> shuffled, Img<T> buffer) {
  Cursor<T> cursor = buffer.localizingCursor();
  RandomAccess<T> ra = shuffled.randomAccess();
  while (cursor.hasNext()) {
    T v = cursor.next();
    ra.setPosition(cursor);
    v.set(ra.get());
  }
}

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

public static final <T extends RealType<T>> void addGaussianSpotToImage(Img<T> img, double[] params) {
  Cursor<T> lc = img.localizingCursor();
  double[] position = new double[img.numDimensions()];
  double val;
  T var = img.firstElement().createVariable();
  while (lc.hasNext()) {
    lc.fwd();
    position[0] = lc.getDoublePosition(0);
    position[1] = lc.getDoublePosition(1);
    val = g.val(position, params);
    var.setReal(val);
    lc.get().add(var);
  }
}

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

public void copyWithSourceIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final long[] pos = new long[ dimensions.length ];
  final Cursor< IntType > src = srcImg.localizingCursor();
  final RandomAccess< IntType > dst = dstImg.randomAccess();
  while ( src.hasNext() )
  {
    src.fwd();
    src.localize( pos );
    dst.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

void copyWithSourceIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final long[] pos = new long[ dimensions.length ];
  final Cursor< IntType > src = srcImg.localizingCursor();
  final RandomAccess< IntType > dst = dstImg.randomAccess();
  while ( src.hasNext() )
  {
    src.fwd();
    src.localize( pos );
    dst.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

public void copyWithSourceIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final int[] pos = new int[ dimensions.length ];
  final Cursor< IntType > src = srcImg.localizingCursor();
  final RandomAccess< IntType > dst = dstImg.randomAccess();
  while ( src.hasNext() )
  {
    src.fwd();
    src.localize( pos );
    dst.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

public void copyWithSourceIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final int[] pos = new int[ dimensions.length ];
  final Cursor< IntType > src = srcImg.localizingCursor();
  final RandomAccess< IntType > dst = dstImg.randomAccess();
  while ( src.hasNext() )
  {
    src.fwd();
    src.localize( pos );
    dst.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

void copyWithSourceIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final long[] pos = new long[ dimensions.length ];
  final Cursor< IntType > src = srcImg.localizingCursor();
  final RandomAccess< IntType > dst = dstImg.randomAccess();
  while ( src.hasNext() )
  {
    src.fwd();
    src.localize( pos );
    dst.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

void copyWithDestIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final long[] pos = new long[ dstImg.numDimensions() ];
  final Cursor< IntType > dst = dstImg.localizingCursor();
  final RandomAccess< IntType > src = srcImg.randomAccess();
  while ( dst.hasNext() )
  {
    dst.fwd();
    dst.localize( pos );
    src.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

void copyWithDestIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final long[] pos = new long[ dstImg.numDimensions() ];
  final Cursor< IntType > dst = dstImg.localizingCursor();
  final RandomAccess< IntType > src = srcImg.randomAccess();
  while ( dst.hasNext() )
  {
    dst.fwd();
    dst.localize( pos );
    src.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

void copyWithDestIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
  final long[] pos = new long[ dstImg.numDimensions() ];
  final Cursor< IntType > dst = dstImg.localizingCursor();
  final RandomAccess< IntType > src = srcImg.randomAccess();
  while ( dst.hasNext() )
  {
    dst.fwd();
    dst.localize( pos );
    src.setPosition( pos );
    dst.get().set( src.get() );
  }
}

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

@Test
public void copyRAINoOutputTest() {
  @SuppressWarnings("unchecked")
  RandomAccessibleInterval<DoubleType> output = (RandomAccessibleInterval<DoubleType>) ops
      .run(CopyII.class, input);
  Cursor<DoubleType> inc = input.localizingCursor();
  RandomAccess<DoubleType> outRA = output.randomAccess();
  while (inc.hasNext()) {
    inc.fwd();
    outRA.setPosition(inc);
    assertEquals(inc.get().get(), outRA.get().get(), 0.0);
  }
}

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

@Test
  public void testFillHoles2() {
    RandomAccessibleInterval<BitType> result = ops.morphology().fillHoles(imgWithoutHoles);
    Cursor<BitType> groundTruthC = imgWithoutHoles.localizingCursor();
    RandomAccess<BitType> resultRA = result.randomAccess();

    while (groundTruthC.hasNext()) {
      boolean r = groundTruthC.next().get();
      resultRA.setPosition(groundTruthC);
      assertEquals(r, resultRA.get().get());
    }
  }
}

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

@Test
public void testFillHoles1() {
  Img<BitType> result = ops.create().img(invertedImgWithFilledHoles);
  Img<BitType> inverted = ops.create().img(invertedImgWithFilledHoles);
  ops.image().invert(inverted, imgWithHoles);
  ops.morphology().fillHoles(result, inverted, new DiamondShape(1));
  Cursor<BitType> resultC = result.localizingCursor();
  RandomAccess<BitType> groundTruthRA = invertedImgWithFilledHoles.randomAccess();
  while (resultC.hasNext()) {
    boolean r = resultC.next().get();
    groundTruthRA.setPosition(resultC);
    assertEquals(groundTruthRA.get().get(), r);
  }
}

相关文章