本文整理汇总了Java中net.imglib2.view.IntervalView.cursor方法的典型用法代码示例。如果您正苦于以下问题:Java IntervalView.cursor方法的具体用法?Java IntervalView.cursor怎么用?Java IntervalView.cursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.view.IntervalView
的用法示例。
在下文中一共展示了IntervalView.cursor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: permuteCoordinatesInverseOfDimensionTest
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
@Test
public void permuteCoordinatesInverseOfDimensionTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType());
Cursor<DoubleType> c = img.cursor();
Random r = new Random();
while (c.hasNext()) {
c.next().set(r.nextDouble());
}
IntervalView<DoubleType> out = Views.permuteCoordinateInverse(img, new int[]{0, 1}, 1);
Cursor<DoubleType> il2 = out.cursor();
RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1}, 1).randomAccess();
while (il2.hasNext()) {
il2.next();
opr.setPosition(il2);
assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
}
示例2: testIntervalPermuteCoordinates
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
@Test
public void testIntervalPermuteCoordinates() {
Img<DoubleType> img = ArrayImgs.doubles(2, 2);
Cursor<DoubleType> c = img.cursor();
Random r = new Random();
while (c.hasNext()) {
c.next().set(r.nextDouble());
}
IntervalView<DoubleType> expected = Views.permuteCoordinates(img, new int[]{0, 1});
Cursor<DoubleType> e = expected.cursor();
RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesView(img, new int[]{0, 1});
RandomAccess<DoubleType> actualRA = actual.randomAccess();
while (e.hasNext()) {
e.next();
actualRA.setPosition(e);
assertEquals(e.get().get(), actualRA.get().get(), 1e-10);
}
assertTrue(Intervals.equals(expected, actual));
}
示例3: testIntervalPermuteDimensionCoordinates
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
@Test
public void testIntervalPermuteDimensionCoordinates() {
Img<DoubleType> img = ArrayImgs.doubles(2, 2);
Cursor<DoubleType> c = img.cursor();
Random r = new Random();
while (c.hasNext()) {
c.next().set(r.nextDouble());
}
IntervalView<DoubleType> expected = Views.permuteCoordinates(img, new int[]{0, 1}, 1);
Cursor<DoubleType> e = expected.cursor();
RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}, 1);
RandomAccess<DoubleType> actualRA = actual.randomAccess();
while (e.hasNext()) {
e.next();
actualRA.setPosition(e);
assertEquals(e.get().get(), actualRA.get().get(), 1e-10);
}
assertTrue(Intervals.equals(expected, actual));
}
示例4: testIntervalPermuteInverseCoordinates
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
@Test
public void testIntervalPermuteInverseCoordinates() {
Img<DoubleType> img = ArrayImgs.doubles(2, 2);
Cursor<DoubleType> c = img.cursor();
Random r = new Random();
while (c.hasNext()) {
c.next().set(r.nextDouble());
}
IntervalView<DoubleType> expected = Views.permuteCoordinatesInverse(img, new int[]{0, 1});
Cursor<DoubleType> e = expected.cursor();
RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1});
RandomAccess<DoubleType> actualRA = actual.randomAccess();
while (e.hasNext()) {
e.next();
actualRA.setPosition(e);
assertEquals(e.get().get(), actualRA.get().get(), 1e-10);
}
assertTrue(Intervals.equals(expected, actual));
}
示例5: testIntervalPermuteInverseDimensionCoordinates
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
@Test
public void testIntervalPermuteInverseDimensionCoordinates() {
Img<DoubleType> img = ArrayImgs.doubles(2, 2);
Cursor<DoubleType> c = img.cursor();
Random r = new Random();
while (c.hasNext()) {
c.next().set(r.nextDouble());
}
IntervalView<DoubleType> expected = Views.permuteCoordinateInverse(img, new int[]{0, 1}, 1);
Cursor<DoubleType> e = expected.cursor();
RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1}, 1);
RandomAccess<DoubleType> actualRA = actual.randomAccess();
while (e.hasNext()) {
e.next();
actualRA.setPosition(e);
assertEquals(e.get().get(), actualRA.get().get(), 1e-10);
}
assertTrue(Intervals.equals(expected, actual));
}
示例6: writeMask
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
private void writeMask( final GrowingStoreRandomAccessibleSingletonAccess< BitType > tmpFill, final AffineTransform3D tf, final long label )
{
final IntervalView< BitType > tmpFillInterval = Views.interval( tmpFill, tmpFill.getIntervalOfSizeOfStore() );
final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels = new AccessBoxRandomAccessible<>(
Views.extendValue(
paintedLabels,
new LongType( Label.TRANSPARENT ) ) );
final AffineRandomAccessible< LongType, AffineGet > transformedPaintedLabels =
RealViews.affine(
Views.interpolate(
accessTrackingExtendedPaintedLabels,
new NearestNeighborInterpolatorFactory<>() ),
tf );
final MixedTransformView< LongType > hyperSlice = Views.hyperSlice( Views.raster( transformedPaintedLabels ), 2, 0 );
final net.imglib2.Cursor< BitType > s = tmpFillInterval.cursor();
final net.imglib2.Cursor< LongType > t = Views.interval( hyperSlice, tmpFillInterval ).cursor();
while ( s.hasNext() )
{
t.fwd();
if ( s.next().get() )
t.get().set( label );
}
dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
}
示例7: isAnyBackground
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
/** Checks if any element in the neighbourhood is background */
private boolean isAnyBackground(final IntervalView<B> neighbourhood) {
final Cursor<B> cursor = neighbourhood.cursor();
while (cursor.hasNext()) {
cursor.fwd();
if (!cursor.get().get()) {
return true;
}
}
return false;
}
示例8: estimate
import net.imglib2.view.IntervalView; //导入方法依赖的package包/类
@Override
protected RandomAccessibleInterval< double[] > estimate( final int size )
{
{
final ArrayRandomAccess< DoubleType > ra = summedMeasurements.randomAccess();
for ( int n = 0; n < nSamples.length; ++n )
{
ra.setPosition( n, 0 );
final double[] ns = nSamples[ n ];
for ( int r = 0; r < ns.length; ++r )
{
ra.setPosition( r, 1 );
ra.get().mul( 1.0 / ns[ r ] );
}
}
}
final CompositeIntervalView< DoubleType, RealComposite< DoubleType > > collapsed =
Views.collapseReal( summedMeasurements );
final RealRandomAccessible< RealComposite< DoubleType > > interpolated =
Views.interpolate( Views.extendBorder( collapsed ), new NLinearInterpolatorFactory<>() );
final FinalInterval fi = new FinalInterval( size );
final IntervalView< RealComposite< DoubleType > > transformed =
Views.interval( Views.raster( RealViews.transformReal( interpolated, scaleAndTranslation ) ), fi );
final Cursor< RealComposite< DoubleType > > t = transformed.cursor();
final ArrayList< double[] > list = new ArrayList<>();
for ( int n = 0; n < size; ++n )
{
final RealComposite< DoubleType > c = t.next();
final double[] target = new double[ nSamples[ 0 ].length ];
target[ 0 ] = -1;
for ( int i = 1; i < target.length; ++i )
target[ i ] = -c.get( i ).get();
list.add( target );
}
return new ListImg<>( list, list.size() );
}