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

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

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

Img.cursor介绍

暂无

代码示例

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

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

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

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

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

  1. @Override
  2. public Cursor< LabelingType< T > > cursor()
  3. {
  4. final Cursor< I > c = img.cursor();
  5. return new LabelingConvertedCursor< I, T >( c, generation, mapping );
  6. }

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

  1. final public static void multiplyComplex( final Img< ComplexFloatType > img, final Img< ComplexFloatType > kernel )
  2. {
  3. final Cursor< ComplexFloatType > cursorA = img.cursor();
  4. final Cursor< ComplexFloatType > cursorB = kernel.cursor();
  5. while ( cursorA.hasNext() )
  6. cursorA.next().mul( cursorB.next() );
  7. }

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

  1. private static < O extends RealType< O >> void fillImage( Img< O > img )
  2. {
  3. Random rng = new Random();
  4. Cursor< O > cursor = img.cursor();
  5. while ( cursor.hasNext() )
  6. {
  7. double value = 256 * rng.nextDouble();
  8. cursor.next().setReal( value );
  9. }
  10. }
  11. }

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

  1. /** Execute the given {@link OutputAlgorithm} and prepare a cursor to deliver
  2. * its pixel values one by one in successive calls to {@code eval()}. */
  3. public Process(final OutputAlgorithm<Img<? extends RealType<?>>> algorithm) throws Exception {
  4. execute(algorithm);
  5. this.img = algorithm.getResult();
  6. this.c = this.img.cursor();
  7. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. public static void addTo( final Img< FloatType > img1, final Img< FloatType > img2 )
  2. {
  3. final Cursor< FloatType > c1 = img1.cursor();
  4. final Cursor< FloatType > c2 = img2.cursor();
  5. while ( c1.hasNext() )
  6. c1.next().add( c2.next() );
  7. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. final public static void multiplyComplex( final Img< ComplexFloatType > img, final Img< ComplexFloatType > kernel )
  2. {
  3. final Cursor< ComplexFloatType > cursorA = img.cursor();
  4. final Cursor< ComplexFloatType > cursorB = kernel.cursor();
  5. while ( cursorA.hasNext() )
  6. cursorA.next().mul( cursorB.next() );
  7. }

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

  1. /**
  2. * Resets all frequency counts to zero.
  3. */
  4. public void resetCounters()
  5. {
  6. final Cursor< LongType > cursor = counts.cursor();
  7. while ( cursor.hasNext() )
  8. {
  9. cursor.next().setZero();
  10. }
  11. totalValues = 0;
  12. }

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

  1. /**
  2. * Resets all frequency counts to zero.
  3. */
  4. public void resetCounters()
  5. {
  6. final Cursor< LongType > cursor = counts.cursor();
  7. while ( cursor.hasNext() )
  8. {
  9. cursor.next().setZero();
  10. }
  11. totalValues = 0;
  12. }

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

  1. protected void multiplyInPlace( final Img<ComplexFloatType> fftImage1, final Img<ComplexFloatType> fftImage2 )
  2. {
  3. final Cursor<ComplexFloatType> cursor1 = fftImage1.cursor();
  4. final Cursor<ComplexFloatType> cursor2 = fftImage2.cursor();
  5. while ( cursor1.hasNext() )
  6. {
  7. cursor1.fwd();
  8. cursor2.fwd();
  9. cursor1.get().mul( cursor2.get() );
  10. }
  11. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. public static FloatProcessor toProcessor( final Img< ? extends RealType< ? > > img )
  2. {
  3. final FloatProcessor fp = new FloatProcessor( (int)img.dimension( 0 ), (int)img.dimension( 1 ) );
  4. final float[] array = (float[])fp.getPixels();
  5. final Cursor< ? extends RealType< ? > > c = img.cursor();
  6. for ( int i = 0; i < array.length; ++ i)
  7. array[ i ] = c.next().getRealFloat();
  8. return fp;
  9. }

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

  1. public void copyWithIterationBoth( final Img< IntType > srcImg, final Img< IntType > dstImg )
  2. {
  3. final Cursor< IntType > src = srcImg.cursor();
  4. final Cursor< IntType > dst = dstImg.cursor();
  5. while ( src.hasNext() )
  6. {
  7. dst.next().set( src.next().get() );
  8. }
  9. }

代码示例来源:origin: sc.fiji/bigdataviewer-core

  1. @Override
  2. public Void call() throws Exception
  3. {
  4. final Cursor< UnsignedShortType > in = Views.iterable( ushortImg ).cursor();
  5. final Cursor< FloatType > out = floatImg.cursor();
  6. in.jumpFwd( startPosition );
  7. out.jumpFwd( startPosition );
  8. for ( long j = 0; j < loopSize; ++j )
  9. out.next().set( in.next().getRealFloat() );
  10. return null;
  11. }
  12. } );

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

  1. @Test
  2. public void copyRAIWithOutputTest() {
  3. final Img<UnsignedByteType> output = input.factory().create(input, input
  4. .firstElement());
  5. ops.run(CopyRAI.class, output, input);
  6. final Cursor<UnsignedByteType> inc = input.cursor();
  7. final Cursor<UnsignedByteType> outc = output.cursor();
  8. while (inc.hasNext()) {
  9. assertEquals(inc.next().get(), outc.next().get());
  10. }
  11. }

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

  1. @Test
  2. public void testJoin2Inplaces() {
  3. final Op op = ops.op(DefaultJoin2Inplaces.class, in, inplaceOp, inplaceOp);
  4. op.run();
  5. // test
  6. final Cursor<ByteType> c = in.cursor();
  7. while (c.hasNext()) {
  8. assertEquals(2, c.next().get());
  9. }
  10. }

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

  1. @Test
  2. public void testJoinComputerAndInplace() {
  3. final Op op =
  4. ops.op(DefaultJoinComputerAndInplace.class, out, in, computerOp,
  5. inplaceOp);
  6. op.run();
  7. // test
  8. final Cursor<ByteType> c = out.cursor();
  9. while (c.hasNext()) {
  10. assertEquals(2, c.next().get());
  11. }
  12. }

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

  1. @Test(expected = IllegalArgumentException.class)
  2. public void testTooManyDimensions() {
  3. final byte[] data = { 2, 2, 2, 2, 2, 2, 2, 2 };
  4. final Img<ByteType> in = ArrayImgs.bytes(data, 2, 2);
  5. final Img<ByteType> out = generateByteArrayTestImg(false, 2, 2, 2);
  6. ops.run(DefaultBilateral.class, out, in, 15, 5, 2);
  7. final byte[] expected = { 2, 2, 2, 2, 2, 2, 2, 2 };
  8. Cursor<ByteType> cout = out.cursor();
  9. for (int i = 0; i < expected.length; i++) {
  10. assertEquals(cout.next().get(), expected[i]);
  11. }
  12. }

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

  1. @Test(expected = IllegalArgumentException.class)
  2. public void testMismatchedDimensions() {
  3. final byte[] data = { 1, 1, 1, 1, 1, 1 };
  4. final Img<ByteType> in = ArrayImgs.bytes(data, 2, 3);
  5. final Img<ByteType> out = generateByteArrayTestImg(false, 3, 2);
  6. ops.run(DefaultBilateral.class, out, in, 15, 5, 2);
  7. final byte[] expected = { 1, 1, 1, 1, 1, 1 };
  8. Cursor<ByteType> cout = out.cursor();
  9. for (int i = 0; i < expected.length; i++) {
  10. assertEquals(cout.next().get(), expected[i]);
  11. }
  12. }

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

  1. @Test
  2. public void testFillHoles() {
  3. Img<BitType> result = ops.create().img(imgWithHoles);
  4. ops.morphology().fillHoles(result, imgWithHoles, new DiamondShape(1));
  5. Cursor<BitType> resultC = result.cursor();
  6. final BitType one = new BitType(true);
  7. while (resultC.hasNext()) {
  8. assertEquals(one, resultC.next());
  9. }
  10. }

相关文章