本文整理了Java中net.imglib2.img.Img.cursor()
方法的一些代码示例,展示了Img.cursor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Img.cursor()
方法的具体详情如下:
包路径:net.imglib2.img.Img
类名称:Img
方法名:cursor
暂无
代码示例来源:origin: imglib/imglib2
@Override
public Cursor< LongType > cursor()
{
return counts.cursor();
}
代码示例来源:origin: net.imglib2/imglib2
@Override
public Cursor< LongType > cursor()
{
return counts.cursor();
}
代码示例来源:origin: net.imglib2/imglib2-roi
@Override
public Cursor< LabelingType< T > > cursor()
{
final Cursor< I > c = img.cursor();
return new LabelingConvertedCursor< I, T >( c, generation, mapping );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl
final public static void multiplyComplex( final Img< ComplexFloatType > img, final Img< ComplexFloatType > kernel )
{
final Cursor< ComplexFloatType > cursorA = img.cursor();
final Cursor< ComplexFloatType > cursorB = kernel.cursor();
while ( cursorA.hasNext() )
cursorA.next().mul( cursorB.next() );
}
代码示例来源:origin: net.imagej/imagej-deprecated
private static < O extends RealType< O >> void fillImage( Img< O > img )
{
Random rng = new Random();
Cursor< O > cursor = img.cursor();
while ( cursor.hasNext() )
{
double value = 256 * rng.nextDouble();
cursor.next().setReal( value );
}
}
}
代码示例来源:origin: net.imglib2/imglib2-script
/** Execute the given {@link OutputAlgorithm} and prepare a cursor to deliver
* its pixel values one by one in successive calls to {@code eval()}. */
public Process(final OutputAlgorithm<Img<? extends RealType<?>>> algorithm) throws Exception {
execute(algorithm);
this.img = algorithm.getResult();
this.c = this.img.cursor();
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public static void addTo( final Img< FloatType > img1, final Img< FloatType > img2 )
{
final Cursor< FloatType > c1 = img1.cursor();
final Cursor< FloatType > c2 = img2.cursor();
while ( c1.hasNext() )
c1.next().add( c2.next() );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
final public static void multiplyComplex( final Img< ComplexFloatType > img, final Img< ComplexFloatType > kernel )
{
final Cursor< ComplexFloatType > cursorA = img.cursor();
final Cursor< ComplexFloatType > cursorB = kernel.cursor();
while ( cursorA.hasNext() )
cursorA.next().mul( cursorB.next() );
}
代码示例来源:origin: net.imglib2/imglib2
/**
* Resets all frequency counts to zero.
*/
public void resetCounters()
{
final Cursor< LongType > cursor = counts.cursor();
while ( cursor.hasNext() )
{
cursor.next().setZero();
}
totalValues = 0;
}
代码示例来源:origin: imglib/imglib2
/**
* Resets all frequency counts to zero.
*/
public void resetCounters()
{
final Cursor< LongType > cursor = counts.cursor();
while ( cursor.hasNext() )
{
cursor.next().setZero();
}
totalValues = 0;
}
代码示例来源:origin: net.imglib2/imglib2-algorithms-legacy
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() );
}
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public static FloatProcessor toProcessor( final Img< ? extends RealType< ? > > img )
{
final FloatProcessor fp = new FloatProcessor( (int)img.dimension( 0 ), (int)img.dimension( 1 ) );
final float[] array = (float[])fp.getPixels();
final Cursor< ? extends RealType< ? > > c = img.cursor();
for ( int i = 0; i < array.length; ++ i)
array[ i ] = c.next().getRealFloat();
return fp;
}
代码示例来源:origin: imglib/imglib2
public void copyWithIterationBoth( final Img< IntType > srcImg, final Img< IntType > dstImg )
{
final Cursor< IntType > src = srcImg.cursor();
final Cursor< IntType > dst = dstImg.cursor();
while ( src.hasNext() )
{
dst.next().set( src.next().get() );
}
}
代码示例来源:origin: sc.fiji/bigdataviewer-core
@Override
public Void call() throws Exception
{
final Cursor< UnsignedShortType > in = Views.iterable( ushortImg ).cursor();
final Cursor< FloatType > out = floatImg.cursor();
in.jumpFwd( startPosition );
out.jumpFwd( startPosition );
for ( long j = 0; j < loopSize; ++j )
out.next().set( in.next().getRealFloat() );
return null;
}
} );
代码示例来源:origin: imagej/imagej-ops
@Test
public void copyRAIWithOutputTest() {
final Img<UnsignedByteType> output = input.factory().create(input, input
.firstElement());
ops.run(CopyRAI.class, output, input);
final Cursor<UnsignedByteType> inc = input.cursor();
final Cursor<UnsignedByteType> outc = output.cursor();
while (inc.hasNext()) {
assertEquals(inc.next().get(), outc.next().get());
}
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void testJoin2Inplaces() {
final Op op = ops.op(DefaultJoin2Inplaces.class, in, inplaceOp, inplaceOp);
op.run();
// test
final Cursor<ByteType> c = in.cursor();
while (c.hasNext()) {
assertEquals(2, c.next().get());
}
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void testJoinComputerAndInplace() {
final Op op =
ops.op(DefaultJoinComputerAndInplace.class, out, in, computerOp,
inplaceOp);
op.run();
// test
final Cursor<ByteType> c = out.cursor();
while (c.hasNext()) {
assertEquals(2, c.next().get());
}
}
代码示例来源:origin: imagej/imagej-ops
@Test(expected = IllegalArgumentException.class)
public void testTooManyDimensions() {
final byte[] data = { 2, 2, 2, 2, 2, 2, 2, 2 };
final Img<ByteType> in = ArrayImgs.bytes(data, 2, 2);
final Img<ByteType> out = generateByteArrayTestImg(false, 2, 2, 2);
ops.run(DefaultBilateral.class, out, in, 15, 5, 2);
final byte[] expected = { 2, 2, 2, 2, 2, 2, 2, 2 };
Cursor<ByteType> cout = out.cursor();
for (int i = 0; i < expected.length; i++) {
assertEquals(cout.next().get(), expected[i]);
}
}
代码示例来源:origin: imagej/imagej-ops
@Test(expected = IllegalArgumentException.class)
public void testMismatchedDimensions() {
final byte[] data = { 1, 1, 1, 1, 1, 1 };
final Img<ByteType> in = ArrayImgs.bytes(data, 2, 3);
final Img<ByteType> out = generateByteArrayTestImg(false, 3, 2);
ops.run(DefaultBilateral.class, out, in, 15, 5, 2);
final byte[] expected = { 1, 1, 1, 1, 1, 1 };
Cursor<ByteType> cout = out.cursor();
for (int i = 0; i < expected.length; i++) {
assertEquals(cout.next().get(), expected[i]);
}
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void testFillHoles() {
Img<BitType> result = ops.create().img(imgWithHoles);
ops.morphology().fillHoles(result, imgWithHoles, new DiamondShape(1));
Cursor<BitType> resultC = result.cursor();
final BitType one = new BitType(true);
while (resultC.hasNext()) {
assertEquals(one, resultC.next());
}
}
内容来源于网络,如有侵权,请联系作者删除!