本文整理汇总了Java中net.imglib2.RandomAccessibleInterval.randomAccess方法的典型用法代码示例。如果您正苦于以下问题:Java RandomAccessibleInterval.randomAccess方法的具体用法?Java RandomAccessibleInterval.randomAccess怎么用?Java RandomAccessibleInterval.randomAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.RandomAccessibleInterval
的用法示例。
在下文中一共展示了RandomAccessibleInterval.randomAccess方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copy
import net.imglib2.RandomAccessibleInterval; //导入方法依赖的package包/类
private static <T extends RealType<T>> void copy(
final RandomAccessibleInterval<T> source,
final IterableInterval<T> dest)
{
final RandomAccess<T> sourceAccess = source.randomAccess();
final Cursor<T> destCursor = dest.localizingCursor();
while (destCursor.hasNext()) {
destCursor.fwd();
sourceAccess.setPosition(destCursor);
destCursor.get().set(sourceAccess.get());
}
}
示例2: sampleIntercepts
import net.imglib2.RandomAccessibleInterval; //导入方法依赖的package包/类
private static <B extends BooleanType<B>> long sampleIntercepts(
final RandomAccessibleInterval<B> interval, final Section section,
final double increment, final Random random)
{
// Add a random offset so that sampling doesn't always start from the same
// plane
final double startT = section.tMin + random.nextDouble() * increment;
if (startT > section.tMax) {
return -1;
}
final Vector3d samplePoint = new Vector3d(section.direction);
samplePoint.scale(startT);
samplePoint.add(section.origin);
final Vector3d gap = new Vector3d(section.direction);
gap.scale(increment);
long intercepts = 0;
long samples = 0;
final RandomAccess<B> access = interval.randomAccess();
boolean previous = sampleVoxel(access, samplePoint);
final long iterations = (long) Math.ceil((section.tMax - startT) /
increment);
for (long i = 0; i < iterations; i++) {
final boolean current = sampleVoxel(access, samplePoint);
if (current != previous) {
intercepts++;
}
previous = current;
samplePoint.add(gap);
samples++;
}
return samples >= 2 ? intercepts : -1;
}
示例3: computeInverseHessian
import net.imglib2.RandomAccessibleInterval; //导入方法依赖的package包/类
/**
* Compute the inverse Hessian matrix from the the steepest descent images.
* @param descent descent image
* @param <T> pixel type
* @return Hessian
*/
public static <T extends RealType< T >> double[][] computeInverseHessian(
final RandomAccessibleInterval< T > descent)
{
final int n = descent.numDimensions() - 1;
final int numParameters = (int) descent.dimension( n );
final long[] dim = new long[n + 1];
descent.dimensions( dim );
dim[n] = 1;
final LocalizingIntervalIterator pos = new LocalizingIntervalIterator( dim );
final RandomAccess< T > r = descent.randomAccess();
final double[] deriv = new double[numParameters];
final double[][] H = new double[numParameters][numParameters];
while ( pos.hasNext() )
{
pos.fwd();
r.setPosition( pos );
for ( int p = 0; p < numParameters; ++p )
{
deriv[p] = r.get().getRealDouble();
r.fwd( n );
}
for ( int i = 0; i < numParameters; ++i )
for ( int j = 0; j < numParameters; ++j )
H[i][j] += deriv[i] * deriv[j];
}
return new Matrix( H ).inverse().getArray();
}
示例4: copyRealImage
import net.imglib2.RandomAccessibleInterval; //导入方法依赖的package包/类
public static <T extends RealType<T>, S extends RealType<S>> void copyRealImage(IterableInterval<T> source, RandomAccessibleInterval<S> dest) {
RandomAccess<S> destRA = dest.randomAccess();
Cursor<T> srcC = source.cursor();
while (srcC.hasNext()){
srcC.fwd();
destRA.setPosition(srcC);
destRA.get().setReal(srcC.get().getRealDouble());
}
}
示例5: createNewStoreAndCopyOldContents
import net.imglib2.RandomAccessibleInterval; //导入方法依赖的package包/类
private synchronized void createNewStoreAndCopyOldContents()
{
RandomAccessibleInterval< T > newStore = this.factory.createStore( this.min, this.max, t );
Cursor< T > cursor = Views.iterable( this.store ).cursor();
RandomAccess< T > access = newStore.randomAccess();
while ( cursor.hasNext() )
{
T val = cursor.next();
access.setPosition( cursor );
access.get().set( val );
}
this.store = newStore;
}
示例6: createNewStoreAndCopyOldContents
import net.imglib2.RandomAccessibleInterval; //导入方法依赖的package包/类
private void createNewStoreAndCopyOldContents()
{
RandomAccessibleInterval< T > newStore = this.factory.createStore( this.min, this.max, t );
Cursor< T > cursor = Views.iterable( this.store ).cursor();
RandomAccess< T > access = newStore.randomAccess();
while ( cursor.hasNext() )
{
T val = cursor.next();
access.setPosition( cursor );
access.get().set( val );
}
this.store = newStore;
}