Refine search
// this build of options is taken from the original method // aggregate(pipe) to have same behaviour AggregationOptions options = AggregationOptions.builder() .outputMode(AggregationOptions.OutputMode.INLINE) .build(); Cursor cursor = collection.aggregate(pipe,options); while (cursor.hasNext() ) { DBObject obj = cursor.next(); //... }
public static final < T extends RealType< T > > void readBytes( final byte[] b, final Cursor< T > cursor, final int width ) { while( cursor.hasNext() ) { cursor.fwd(); // otherwise the position is off below cursor.get().setReal( b[ cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ] & 0xff ); } }
public static <I1, I2, O> void map(final IterableInterval<I1> a, final IterableInterval<I2> b, final RandomAccessibleInterval<O> c, final BinaryComputerOp<I1, I2, O> op) { final Cursor<I1> aCursor = a.localizingCursor(); final Cursor<I2> bCursor = b.cursor(); final RandomAccess<O> cAccess = c.randomAccess(); while (aCursor.hasNext()) { aCursor.fwd(); cAccess.setPosition(aCursor); op.compute(aCursor.get(), bCursor.next(), cAccess.get()); } }
protected void mapSingle( final RandomAccess< A > sourceRandomAccess, final Converter< A, ARGBType > conv ) { final Cursor< ARGBType > targetCursor = target.localizingCursor(); while ( targetCursor.hasNext() ) { targetCursor.fwd(); sourceRandomAccess.setPosition( targetCursor.getLongPosition( 0 ), 0 ); sourceRandomAccess.setPosition( targetCursor.getLongPosition( 1 ), 1 ); conv.convert( sourceRandomAccess.get(), targetCursor.get() ); } } }
@Override public void compute(final IterableInterval<I> input, final O output) { double moment01 = 0; final Cursor<I> cur = input.localizingCursor(); while (cur.hasNext()) { cur.fwd(); double y = cur.getDoublePosition(1); double val = cur.get().getRealDouble(); moment01 += y * val; } output.setReal(moment01); } }
@Before public void setUp() { final long[] dimension = new long[] { 10, 10, 10 }; img = new ArrayImgFactory<>( new UnsignedByteType() ).create( dimension ); final Cursor< UnsignedByteType > inCursor = img.localizingCursor(); while ( inCursor.hasNext() ) { // set with plane position inCursor.next().set( inCursor.getIntPosition( 2 ) ); } }
public static final < T extends RealType< T > > void readUnsignedInts( final byte[] b, final Cursor< T > cursor, final int width, final boolean isLittleEndian ) { while( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( LegacyStackImgLoaderLOCI.getIntValue( b, ( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) * 4, isLittleEndian ) ); } }
public static <I1, I2, O> void map(final IterableInterval<I1> a, final RandomAccessibleInterval<I2> b, final IterableInterval<O> c, final BinaryComputerOp<I1, I2, O> op) { final Cursor<I1> aCursor = a.localizingCursor(); final RandomAccess<I2> bAccess = b.randomAccess(); final Cursor<O> cCursor = c.cursor(); while (aCursor.hasNext()) { aCursor.fwd(); bAccess.setPosition(aCursor); op.compute(aCursor.get(), bAccess.get(), cCursor.next()); } }
protected void mapSingle( final RandomAccess< A > sourceRandomAccess, final Converter< A, ARGBType > conv ) { final Cursor< ARGBType > targetCursor = target.localizingCursor(); while ( targetCursor.hasNext() ) { targetCursor.fwd(); sourceRandomAccess.setPosition( targetCursor.getLongPosition( 0 ), 0 ); sourceRandomAccess.setPosition( targetCursor.getLongPosition( 1 ), 1 ); conv.convert( sourceRandomAccess.get(), targetCursor.get() ); } } }
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); } }
public void testPositionToIndex( final RandomAccessibleInterval< ? > interval ) { final long[] pos = new long[ dim.length ]; final long[] min = Intervals.minAsLongArray( interval ); for ( final Cursor< ? > cursor = Views.flatIterable( interval ).localizingCursor(); cursor.hasNext(); ) { cursor.fwd(); cursor.localize( pos ); Assert.assertEquals( IntervalIndexer.positionWithOffsetToIndex( pos, dim, min ), IntervalIndexer.positionToIndexForInterval( cursor, interval ) ); } }
protected void multiplyInPlace( final Img<ComplexFloatType> fftImage1, final Img<ComplexFloatType> fftImage2 ) { final Cursor<ComplexFloatType> cursor1 = fftImage1.cursor(); final Cursor<ComplexFloatType> cursor2 = fftImage2.cursor(); while ( cursor1.hasNext() ) { cursor1.fwd(); cursor2.fwd(); cursor1.get().mul( cursor2.get() ); } }
public static final < T extends RealType< T > > void readUnsignedShorts( final byte[] b, final Cursor< T > cursor, final int width, final boolean isLittleEndian ) { while( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( LegacyStackImgLoaderLOCI.getShortValueInt( b, ( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) * 2, isLittleEndian ) ); } }