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

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

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

Img.randomAccess介绍

暂无

代码示例

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

  1. @Override
  2. public RandomAccess< LongType > randomAccess()
  3. {
  4. return counts.randomAccess();
  5. }

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

  1. @Override
  2. public RandomAccess< LongType > randomAccess( final Interval interval )
  3. {
  4. return counts.randomAccess( interval );
  5. }

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

  1. /**
  2. * returns the nValue image's RandomAccess
  3. *
  4. * @return the RandomAccess containing the nValues
  5. */
  6. protected RandomAccess<DoubleType> getNValuesRandomAccess() {
  7. return nValues.randomAccess();
  8. }

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

  1. @Override
  2. public RandomAccess< LongType > randomAccess( final Interval interval )
  3. {
  4. return counts.randomAccess( interval );
  5. }

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

  1. @Override
  2. public RandomAccess<T> randomAccess(final Interval interval) {
  3. return img.randomAccess(interval);
  4. }

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

  1. @Override
  2. public RandomAccess<T> randomAccess() {
  3. return img.randomAccess();
  4. }

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

  1. @Override
  2. public RandomAccess<T> randomAccess() {
  3. return img.randomAccess();
  4. }

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

  1. @Override
  2. public RandomAccess< LongType > randomAccess()
  3. {
  4. return counts.randomAccess();
  5. }

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

  1. @Override
  2. public RandomAccess<T> randomAccess(final Interval interval) {
  3. return img.randomAccess(interval);
  4. }

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

  1. /**
  2. * returns the pValue image's RandomAccess
  3. *
  4. * @return the RandomAccess containing the pValues
  5. */
  6. protected RandomAccess<DoubleType> getPValuesRandomAccess() {
  7. return pValues.randomAccess();
  8. }

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

  1. /**
  2. * returns the gradient image's RandomAccess
  3. *
  4. * @return the RandomAccess containing the gradients
  5. */
  6. protected RandomAccess<DoubleType> getGradientsRandomAccess() {
  7. return gradients.randomAccess();
  8. }
  9. }

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

  1. /**
  2. * Construct an n-dimensional counter using a provided {@code Img<LongType>} to
  3. * store counts.
  4. */
  5. public DiscreteFrequencyDistribution( final Img< LongType > img )
  6. {
  7. counts = img;
  8. accessor = counts.randomAccess();
  9. resetCounters();
  10. }

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

  1. @Override
  2. public RandomAccess< LabelingType< T > > randomAccess()
  3. {
  4. final RandomAccess< I > rndAccess = img.randomAccess();
  5. return new LabelingConvertedRandomAccess< I, T >( rndAccess, generation, mapping );
  6. }

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

  1. /**
  2. * Construct an n-dimensional counter using a provided {@code Img<LongType>} to
  3. * store counts.
  4. */
  5. public DiscreteFrequencyDistribution( final Img< LongType > img )
  6. {
  7. counts = img;
  8. accessor = counts.randomAccess();
  9. resetCounters();
  10. }

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

  1. /**
  2. * Convenience helper to access single pixels
  3. */
  4. protected < T extends RealType< T >> float get( final Img< T > image, final int[] pos )
  5. {
  6. final RandomAccess< T > cursor = image.randomAccess();
  7. cursor.setPosition( pos );
  8. final float result = cursor.get().getRealFloat();
  9. return result;
  10. }

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

  1. @Test
  2. public void testRandomAccess()
  3. {
  4. final RandomAccess< UnsignedByteType > a = img.randomAccess();
  5. final long[] pos = new long[] { 28, 30, 5, 5, 12 };
  6. final long[] dist = new long[] { 2, 3, 4, 2, 1 };
  7. testlocalize( a, pos );
  8. testfwd( a, pos );
  9. testbck( a, pos );
  10. testmove( a, pos, 3 );
  11. testmove( a, pos, dist );
  12. }

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

  1. @Test
  2. public void testLoopLine()
  3. {
  4. // setup
  5. final Img< IntType > img = ArrayImgs.ints( 1, 1, 5 );
  6. final RandomAccess< IntType > ra = img.randomAccess();
  7. // process
  8. final Runnable loop = LoopUtils.createLineLoop( ra, img.dimension( 2 ), 2,
  9. () -> ra.get().set( 42 ) );
  10. loop.run();
  11. // test
  12. img.forEach( value -> assertEquals( 42, value.get() ) );
  13. }

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

  1. public void copyWithSourceIteration( final Img< IntType > srcImg, final Img< IntType > dstImg )
  2. {
  3. final int[] pos = new int[ dimensions.length ];
  4. final Cursor< IntType > src = srcImg.localizingCursor();
  5. final RandomAccess< IntType > dst = dstImg.randomAccess();
  6. while ( src.hasNext() )
  7. {
  8. src.fwd();
  9. src.localize( pos );
  10. dst.setPosition( pos );
  11. dst.get().set( src.get() );
  12. }
  13. }

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

  1. @Test
  2. public void testCopy() {
  3. ops.run(ConvertIIs.class, out, in,
  4. new CopyRealTypes<ShortType, ByteType>());
  5. final Cursor<ShortType> c = in.localizingCursor();
  6. final RandomAccess<ByteType> ra = out.randomAccess();
  7. while (c.hasNext()) {
  8. final short value = c.next().get();
  9. ra.setPosition(c);
  10. assertEquals(copy(value), ra.get().get());
  11. }
  12. }

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

  1. @Test
  2. public void testNormalizeScale() {
  3. ops.run(ConvertIIs.class, out, in,
  4. ops.op(NormalizeScaleRealTypes.class, out.firstElement(), in.firstElement()));
  5. final Cursor<ShortType> c = in.localizingCursor();
  6. final RandomAccess<ByteType> ra = out.randomAccess();
  7. while (c.hasNext()) {
  8. final short value = c.next().get();
  9. ra.setPosition(c);
  10. assertEquals(normalizeScale(value), ra.get().get());
  11. }
  12. }

相关文章