@Override public Cursor<T> localizingCursor() { return img.localizingCursor(); }
@Override public Cursor< LongType > localizingCursor() { return counts.localizingCursor(); }
@Override public Cursor< LongType > localizingCursor() { return counts.localizingCursor(); }
@Override public Cursor<T> localizingCursor() { return img.localizingCursor(); }
@Override public Cursor<T> localizingCursor() { return img.localizingCursor(); }
@Override public Cursor< LabelingType< T > > localizingCursor() { final Cursor< I > c = img.localizingCursor(); return new LabelingConvertedCursor< I, T >( c, generation, mapping ); }
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); } }
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()); } }
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 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() ); } }
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() ); } }
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() ); } }
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() ); } }
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() ); } }
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() ); } }
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() ); } }
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() ); } }
@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); } }
@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()); } } }
@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); } }