本文整理汇总了Java中net.imglib2.Cursor.jumpFwd方法的典型用法代码示例。如果您正苦于以下问题:Java Cursor.jumpFwd方法的具体用法?Java Cursor.jumpFwd怎么用?Java Cursor.jumpFwd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.Cursor
的用法示例。
在下文中一共展示了Cursor.jumpFwd方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import net.imglib2.Cursor; //导入方法依赖的package包/类
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 int startIndex,
final int stepSize, final int numSteps)
{
if (numSteps <= 0) return;
final Cursor<I1> aCursor = a.localizingCursor();
final Cursor<I2> bCursor = b.cursor();
final RandomAccess<O> cAccess = c.randomAccess();
for (int ctr = 0; ctr < numSteps; ctr++) {
final int m = ctr == 0 ? startIndex + 1 : stepSize;
aCursor.jumpFwd(m);
bCursor.jumpFwd(m);
cAccess.setPosition(aCursor);
op.compute(aCursor.get(), bCursor.get(), cAccess.get());
}
}
示例2: call
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public String call() throws Exception
{
final NLinearInterpolatorFactory< FloatType > f = new NLinearInterpolatorFactory< FloatType >();
// make the interpolators and get the transformations
final RealRandomAccess< FloatType > ir = Views.interpolate( Views.extendMirrorSingle( img ), f ).realRandomAccess();
final RealRandomAccess< FloatType > wr = blending.realRandomAccess();
final Cursor< FloatType > cursor = Views.iterable( transformedImg ).localizingCursor();
final Cursor< FloatType > cursorW = Views.iterable( weightImg ).cursor();
final float[] s = new float[ 3 ];
final float[] t = new float[ 3 ];
cursor.jumpFwd( portion.getStartPosition() );
cursorW.jumpFwd( portion.getStartPosition() );
for ( int j = 0; j < portion.getLoopSize(); ++j )
loop( cursor, cursorW, ir, wr, transform, s, t, offsetX, offsetY, offsetZ, imgSizeX, imgSizeY, imgSizeZ );
return portion + " finished successfully (transform input & precompute weights).";
}
示例3: inplace
import net.imglib2.Cursor; //导入方法依赖的package包/类
public static <I, O extends I> void inplace(final IterableInterval<O> arg,
final UnaryInplaceOp<I, O> op, final int startIndex, final int stepSize,
final int numSteps)
{
if (numSteps <= 0) return;
final Cursor<O> argCursor = arg.cursor();
for (int ctr = 0; ctr < numSteps; ctr++) {
argCursor.jumpFwd(ctr == 0 ? startIndex + 1 : stepSize);
op.mutate(argCursor.get());
}
}
示例4: copy
import net.imglib2.Cursor; //导入方法依赖的package包/类
private static final void copy( final long start, final long loopSize, final RandomAccessible< FloatType > source, final RandomAccessibleInterval< FloatType > block, final long[] offset )
{
final int numDimensions = source.numDimensions();
final Cursor< FloatType > cursor = Views.iterable( block ).localizingCursor();
// define where we will query the RandomAccess on the source
// (we say it is the entire block, although it is just a part of it,
// but which part depends on the underlying container)
final long[] min = new long[ numDimensions ];
final long[] max = new long[ numDimensions ];
for ( int d = 0; d < numDimensions; ++d )
{
min[ d ] = offset[ d ];
max[ d ] = offset[ d ] + block.dimension( d ) - 1;
}
final RandomAccess< FloatType > randomAccess = source.randomAccess( new FinalInterval( min, max ) );
cursor.jumpFwd( start );
final long[] tmp = new long[ numDimensions ];
for ( long l = 0; l < loopSize; ++l )
{
cursor.fwd();
cursor.localize( tmp );
for ( int d = 0; d < numDimensions; ++d )
tmp[ d ] += offset[ d ];
randomAccess.setPosition( tmp );
cursor.get().set( randomAccess.get() );
}
}
示例5: call
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public String call() throws Exception
{
// make the blending and get the transformations
final RealRandomAccess< FloatType > wr = blending.realRandomAccess();
final Cursor< FloatType > cursorO = Views.iterable( overlapImg ).localizingCursor();
final Cursor< FloatType > cursorB = Views.iterable( blendingImg ).cursor();
final float[] s = new float[ 3 ];
final float[] t = new float[ 3 ];
cursorO.jumpFwd( portion.getStartPosition() );
cursorB.jumpFwd( portion.getStartPosition() );
for ( int j = 0; j < portion.getLoopSize(); ++j )
{
// move img cursor forward any get the value (saves one access)
final FloatType o = cursorO.next();
cursorO.localize( s );
// move weight cursor forward and get the value
final FloatType b = cursorB.next();
s[ 0 ] += offsetX;
s[ 1 ] += offsetY;
s[ 2 ] += offsetZ;
transform.applyInverse( t, s );
// compute weights in any part of the image (the border can be negative!)
wr.setPosition( t );
o.set( o.get() + 1 );
b.set( wr.get() );
}
return portion + " finished successfully (visualize weights).";
}
示例6: call
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public String call() throws Exception
{
// make the interpolators and get the transformations
final RealRandomAccess< T > r = Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess();
final int[] imgSize = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };
final Cursor< T > cursor = fusedImg.localizingCursor();
final float[] s = new float[ 3 ];
final float[] t = new float[ 3 ];
cursor.jumpFwd( portion.getStartPosition() );
for ( int j = 0; j < portion.getLoopSize(); ++j )
{
// move img cursor forward any get the value (saves one access)
final T v = cursor.next();
cursor.localize( s );
if ( doDownSampling )
{
s[ 0 ] *= downSampling;
s[ 1 ] *= downSampling;
s[ 2 ] *= downSampling;
}
s[ 0 ] += bb.min( 0 );
s[ 1 ] += bb.min( 1 );
s[ 2 ] += bb.min( 2 );
transform.applyInverse( t, s );
if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSize[ 0 ], imgSize[ 1 ], imgSize[ 2 ] ) )
{
r.setPosition( t );
v.setReal( r.get().getRealFloat() );
}
}
return portion + " finished successfully (individual fusion, no weights).";
}
示例7: call
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public String call() throws Exception
{
final int numViews = imgs.size();
// make the interpolators, weights and get the transformations
final ArrayList< RealRandomAccess< T > > interpolators = new ArrayList< RealRandomAccess< T > >( numViews );
final ArrayList< RealRandomAccess< FloatType > > weightAccess = new ArrayList< RealRandomAccess< FloatType > >();
final int[][] imgSizes = new int[ numViews ][ 3 ];
for ( int i = 0; i < numViews; ++i )
{
final RandomAccessibleInterval< T > img = imgs.get( i );
imgSizes[ i ] = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };
interpolators.add( Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess() );
weightAccess.add( weights.get( i ).realRandomAccess() );
}
final Cursor< T > cursor = fusedImg.localizingCursor();
final Cursor< FloatType > cursorW = weightImg.cursor();
final float[] s = new float[ 3 ];
final float[] t = new float[ 3 ];
cursor.jumpFwd( portion.getStartPosition() );
cursorW.jumpFwd( portion.getStartPosition() );
for ( int j = 0; j < portion.getLoopSize(); ++j )
{
// move img cursor forward any get the value (saves one access)
final T v = cursor.next();
cursor.localize( s );
// move weight cursor forward and get the value
final FloatType w = cursorW.next();
if ( doDownSampling )
{
s[ 0 ] *= downSampling;
s[ 1 ] *= downSampling;
s[ 2 ] *= downSampling;
}
s[ 0 ] += bb.min( 0 );
s[ 1 ] += bb.min( 1 );
s[ 2 ] += bb.min( 2 );
double sum = 0;
double sumW = 0;
for ( int i = 0; i < numViews; ++i )
{
transforms[ i ].applyInverse( t, s );
if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSizes[ i ][ 0 ], imgSizes[ i ][ 1 ], imgSizes[ i ][ 2 ] ) )
{
final RealRandomAccess< T > r = interpolators.get( i );
r.setPosition( t );
final RealRandomAccess< FloatType > weight = weightAccess.get( i );
weight.setPosition( t );
final double w1 = weight.get().get();
sum += r.get().getRealDouble() * w1;
sumW += w1;
}
}
if ( sumW > 0 )
{
v.setReal( v.getRealFloat() + sum );
w.set( w.get() + (float)sumW );
}
}
return portion + " finished successfully (one weight).";
}
示例8: call
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public String call() throws Exception
{
final int numViews = imgs.size();
// make the interpolators and get the transformations
final ArrayList< RealRandomAccess< T > > interpolators = new ArrayList< RealRandomAccess< T > >( numViews );
final int[][] imgSizes = new int[ numViews ][ 3 ];
for ( int i = 0; i < numViews; ++i )
{
final RandomAccessibleInterval< T > img = imgs.get( i );
imgSizes[ i ] = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };
interpolators.add( Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess() );
}
final Cursor< T > cursor = fusedImg.localizingCursor();
final Cursor< FloatType > cursorW = weightImg.cursor();
final float[] s = new float[ 3 ];
final float[] t = new float[ 3 ];
cursor.jumpFwd( portion.getStartPosition() );
cursorW.jumpFwd( portion.getStartPosition() );
for ( int j = 0; j < portion.getLoopSize(); ++j )
{
// move img cursor forward any get the value (saves one access)
final T v = cursor.next();
cursor.localize( s );
// move weight cursor forward and get the value
final FloatType w = cursorW.next();
if ( doDownSampling )
{
s[ 0 ] *= downSampling;
s[ 1 ] *= downSampling;
s[ 2 ] *= downSampling;
}
s[ 0 ] += bb.min( 0 );
s[ 1 ] += bb.min( 1 );
s[ 2 ] += bb.min( 2 );
double sum = 0;
int sumW = 0;
for ( int i = 0; i < numViews; ++i )
{
transforms[ i ].applyInverse( t, s );
if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSizes[ i ][ 0 ], imgSizes[ i ][ 1 ], imgSizes[ i ][ 2 ] ) )
{
final RealRandomAccess< T > r = interpolators.get( i );
r.setPosition( t );
sum += r.get().getRealDouble();
++sumW;
}
}
if ( sumW > 0 )
{
v.setReal( v.getRealFloat() + sum );
w.set( w.get() + sumW );
}
}
return portion + " finished successfully (no weights).";
}
示例9: call
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public String call() throws Exception
{
final int numViews = imgs.size();
// make the interpolators, weights and get the transformations
final ArrayList< RealRandomAccess< T > > interpolators = new ArrayList< RealRandomAccess< T > >( numViews );
final ArrayList< RealRandomAccess< FloatType > > weightAccess = new ArrayList< RealRandomAccess< FloatType > >();
final int[][] imgSizes = new int[ numViews ][ 3 ];
for ( int i = 0; i < numViews; ++i )
{
final RandomAccessibleInterval< T > img = imgs.get( i );
imgSizes[ i ] = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };
interpolators.add( Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess() );
weightAccess.add( weights.get( i ).realRandomAccess() );
}
final Cursor< T > cursor = fusedImg.localizingCursor();
final float[] s = new float[ 3 ];
final float[] t = new float[ 3 ];
cursor.jumpFwd( portion.getStartPosition() );
for ( int j = 0; j < portion.getLoopSize(); ++j )
{
// move img cursor forward any get the value (saves one access)
final T v = cursor.next();
cursor.localize( s );
if ( doDownSampling )
{
s[ 0 ] *= downSampling;
s[ 1 ] *= downSampling;
s[ 2 ] *= downSampling;
}
s[ 0 ] += bb.min( 0 );
s[ 1 ] += bb.min( 1 );
s[ 2 ] += bb.min( 2 );
double sum = 0;
double sumW = 0;
for ( int i = 0; i < numViews; ++i )
{
transforms[ i ].applyInverse( t, s );
if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSizes[ i ][ 0 ], imgSizes[ i ][ 1 ], imgSizes[ i ][ 2 ] ) )
{
final RealRandomAccess< T > r = interpolators.get( i );
r.setPosition( t );
final RealRandomAccess< FloatType > weight = weightAccess.get( i );
weight.setPosition( t );
final double w = weight.get().get();
sum += r.get().getRealDouble() * w;
sumW += w;
}
}
if ( sumW > 0 )
v.setReal( sum / sumW );
}
return portion + " finished successfully (one weight).";
}
示例10: setToStart
import net.imglib2.Cursor; //导入方法依赖的package包/类
public static void setToStart(final Cursor<?> c, int startIndex) {
c.reset();
c.jumpFwd(startIndex + 1);
}