net.imglib2.view.Views.iterable()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中net.imglib2.view.Views.iterable()方法的一些代码示例,展示了Views.iterable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Views.iterable()方法的具体详情如下:
包路径:net.imglib2.view.Views
类名称:Views
方法名:iterable

Views.iterable介绍

[英]Return an IterableInterval. If the passed RandomAccessibleInterval is already an IterableIntervalthen it is returned directly (this is the case for Img). If not, then an IterableRandomAccessibleInterval is created.
[中]返回一个IterableInterval。如果传递的RandomAccessibleInterval已经是ITerableInterval,则直接返回(Img就是这种情况)。如果没有,则创建一个iTerableLandmaccessibleInterval。

代码示例

代码示例来源:origin: net.imagej/imagej-common

@SuppressWarnings("unchecked")
@Override
public <T> T convert(final Object src, final Class<T> dest) {
  return (T) Views.iterable((RandomAccessibleInterval<T>) src);
}

代码示例来源:origin: net.imglib2/imglib2-algorithm-fft

final public static <T extends ComplexType<T>> void complexConjugate(
    final RandomAccessibleInterval<T> complexData)
  {
    for (final T type : Views.iterable(complexData))
      type.complexConjugate();
  }
}

代码示例来源:origin: net.imagej/imagej-deprecated

@Override
protected void initRegionGrowing( RandomAccessibleInterval< LabelingType< L > > srcImg )
{
  m_seedLabCur = Views.iterable( srcImg ).localizingCursor();
}

代码示例来源:origin: net.imagej/imagej-common

@Override
public DataRange getDefaultRandomAccessRange(
  final RandomAccessibleInterval<? extends RealType<?>> interval)
{
  final IterableInterval<? extends RealType<?>> newInterval =
    Views.iterable(interval);
  return getDefaultIntervalRange(newInterval);
}

代码示例来源:origin: net.imglib2/imglib2-algorithms

@Override
public < T > IterableInterval< Neighborhood< T >> neighborhoodsSafe( final RandomAccessibleInterval< T > source )
{
  return Views.iterable( neighborhoodsRandomAccessible( source ) );
}

代码示例来源:origin: net.imglib2/imglib2-algorithm

public ImgSourceIterableDirect( final RandomAccessibleInterval< O > rai )
{
  this.rai = rai;
  this.it = Views.iterable( rai ).iterator();
  this.ra = rai.randomAccess();
}

代码示例来源:origin: net.imglib2/imglib2-algorithm

public ImgSourceIterable( final O scrap, final Converter< I, O > converter, final RandomAccessibleInterval< I > rai )
{
  this.rai = rai;
  this.it = Views.iterable( rai ).iterator();
  this.ra = rai.randomAccess();
  this.converter = converter;
  this.scrap = scrap;
}

代码示例来源:origin: sc.fiji/Colocalisation_Analysis

/**
 * Create a new mask image with a defined size and preset content.
 */
public static RandomAccessibleInterval<BitType> createMask(long[] dim, boolean val) {
  RandomAccessibleInterval<BitType> mask = createMask(dim);
  
  for (BitType t : Views.iterable(mask))
    t.set(val);
  
  return mask;
}

代码示例来源:origin: net.imglib2/imglib2

/**
 * Randomizes the content of the given image.
 * @return Reference to the given image
 */
public < I extends RandomAccessibleInterval< T >, T >
I randomize( final I image )
{
  final T type = Util.getTypeFromInterval( image );
  Views.iterable( image ).forEach( randomSetter( type ) );
  return image;
}

代码示例来源:origin: net.imglib2/imglib2-roi

public ImgLabeling( final RandomAccessibleInterval< I > img )
{
  super( img );
  indexAccessible = img;
  indexIterable = Views.iterable( img );
  subIterable = indexIterable instanceof SubIntervalIterable;
  generation = new ModCount();
  mapping = new LabelingMapping< T >( indexIterable.firstElement() );
}

代码示例来源:origin: net.imagej/imagej-deprecated

/**
 * {@inheritDoc}
 */
@Override
protected void initRegionGrowing( final RandomAccessibleInterval<T> src )
{
  srcCur = Views.iterable(src).localizingCursor();
  srcRA = src.randomAccess();
  m_labelNumber = m_synchronizer.aquireNewLabelNumber();
}

代码示例来源:origin: imglib/imglib2

/**
 * Randomizes the content of the given image.
 * @return Reference to the given image
 */
public < I extends RandomAccessibleInterval< T >, T >
I randomize( final I image )
{
  final T type = Util.getTypeFromInterval( image );
  Views.iterable( image ).forEach( randomSetter( type ) );
  return image;
}

代码示例来源:origin: sc.fiji/bigdataviewer-core

@Override
public boolean map( final boolean clearUntouchedTargetPixels )
{
  final StopWatch stopWatch = new StopWatch();
  stopWatch.start();
  if ( clearUntouchedTargetPixels )
    for ( final T t : Views.iterable( target ) )
      t.setZero();
  lastFrameRenderNanoTime = stopWatch.nanoTime();
  return true;
}

代码示例来源:origin: net.imagej/imagej-common

private static <T> IterableInterval<T> iterableInterval(
  final RealRandomAccessibleRealInterval<T> realInterval)
{
  final RandomAccessibleOnRealRandomAccessible<T> raster =
    Views.raster(realInterval);
  final IntervalView<T> interval =
    Views.interval(raster, findMin(realInterval), findMax(realInterval));
  return Views.iterable(interval);
}

代码示例来源:origin: net.imglib2/imglib2-algorithm

private static < T extends RealType< T >, U extends ComplexType< U > > RandomAccessibleInterval< U > calculateEigenValuesImpl(
    final RandomAccessibleInterval< T > tensor,
    final RandomAccessibleInterval< U > eigenvalues,
    final EigenValues< T, U > ev )
{
  final Cursor< RealComposite< T > > m = Views.iterable( Views.collapseReal( tensor ) ).cursor();
  final Cursor< NumericComposite< U > > e = Views.iterable( Views.collapseNumeric( eigenvalues ) ).cursor();
  while ( m.hasNext() )
    ev.compute( m.next(), e.next() );
  return eigenvalues;
}

代码示例来源:origin: net.preibisch/multiview-reconstruction

@SuppressWarnings("unchecked")
  public static < T extends RealType< T > > RandomAccessibleInterval< FloatType > getFloatRAI( final RandomAccessibleInterval< T > input )
  {
    if ( FloatType.class.isInstance( Views.iterable( input ).cursor().next() ) )
      return (RandomAccessibleInterval< FloatType >)input;
    else
      return new ConvertedRandomAccessibleInterval< T, FloatType >( input, new RealFloatConverter< T >(),  new FloatType() );
  }
}

代码示例来源: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: sc.fiji/Colocalisation_Analysis

@Override
public void execute(DataContainer<T> container)
  throws MissingPreconditionException
{
  RandomAccessible<T> img1 = container.getSourceImage1();
  RandomAccessible<T> img2 = container.getSourceImage2();
  RandomAccessibleInterval<BitType> mask = container.getMask();
  TwinCursor<T> cursor = new TwinCursor<T>(img1.randomAccess(),
      img2.randomAccess(), Views.iterable(mask).localizingCursor());
  tau = calculateMergeSort(cursor);
}

代码示例来源:origin: imglib/imglib2

private void assertSum( final RandomAccessibleInterval< IntType > sum )
{
  final Cursor< IntType > a = Views.iterable( imageA ).cursor();
  final Cursor< IntType > b = Views.iterable( imageB ).cursor();
  final Cursor< IntType > s = Views.iterable( sum ).cursor();
  while ( s.hasNext() )
    assertEquals( s.next().get(), a.next().get() + b.next().get() );
}

代码示例来源:origin: imglib/imglib2

@Test
public void constantRandomAccessibleInterval()
{
  final int nDim = 5;
  final Random rng = new Random( 100 );
  final long[] dims = LongStream.generate( () -> rng.nextInt( 5 ) + 1 ).limit( nDim ).toArray();
  final IntType constVal = new IntType( 123 );
  final RandomAccessibleInterval< IntType > randomAccessibleInterval = ConstantUtils.constantRandomAccessibleInterval( constVal, new FinalInterval( dims ) );
  Assert.assertArrayEquals( dims, Intervals.dimensionsAsLongArray( randomAccessibleInterval ) );
  Assert.assertArrayEquals( new long[ nDim ], Intervals.minAsLongArray( randomAccessibleInterval ) );
  Views.iterable( randomAccessibleInterval ).forEach( p -> Assert.assertTrue( constVal.valueEquals( constVal ) ) );
}

相关文章