net.imglib2.img.Img.size()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(216)

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

Img.size介绍

暂无

代码示例

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

@Override
public long size()
{
  return counts.size();
}

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

@Override
public long size()
{
  return counts.size();
}

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

@Override
public long size() {
  return img.size();
}

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

@Override
public long size() {
  return img.size();
}

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

public RegionMean(Img<T> img, RandomAccess<T> ra, long span) {
  super(img, ra, span);
  this.size = img.size();
}

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

@Override
public long size() {
  return img.size();
}

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

@Override
public long size() {
  return img.size();
}

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

static private final int computeBits(final Img<?> img) {
  // What bit depth is necessary to represent the count of pixels in img?
  double nBits = Math.log10(img.size()) / Math.log10(2);
  if (0 != nBits % 2) nBits += 1;
  return (int) nBits;
}

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

/**
 * Set all pixels in target to 100% transparent zero, and mask to all
 * Integer.MAX_VALUE.
 */
public void clearMask()
{
  Arrays.fill( maskArray, 0, ( int ) mask.size(), Byte.MAX_VALUE );
  numInvalidLevels = sources.size();
}

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

protected long numPixels()
  {
    if ( accurate )
    {
      long size = 1;
      for ( int d = 0; d < img.numDimensions(); ++d )
        size *= img.dimension( d ) + Util.createGaussianKernel1DDouble( sigma[ d ], false ).length - 1;
      return size;
    }
    else
    {
      return img.size();
    }
  }
}

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

protected static ImgFactory< ComplexFloatType > getFFTFactory( final Img< ? extends RealType< ? > > img )
{
  try
  {
    return img.factory().imgFactory( new ComplexFloatType() );
  }
  catch ( final IncompatibleTypeException e )
  {
    if ( img.size() > Integer.MAX_VALUE / 2 )
      return new CellImgFactory< ComplexFloatType >( 1024 );
    return new ArrayImgFactory< ComplexFloatType >();
  }
}

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

protected static ImgFactory< ComplexFloatType > getFFTFactory( final Img< ? extends RealType< ? > > img )
  {
    try 
    {
      return img.factory().imgFactory( new ComplexFloatType() );
    } 
    catch (IncompatibleTypeException e) 
    {
      if ( img.size() > Integer.MAX_VALUE / 2 )
        return new CellImgFactory<ComplexFloatType>( 1024 );
      return new ArrayImgFactory< ComplexFloatType >();
    }
  }
}

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

/**
 * Determine the smallest type that will correctly store the sums.
 * For {@link Img} whose type has integer precision, the largest type is {@link LongType}.
 * For {@link Img} whose type has floating-point precision, the largest type is {@link DoubleType}.
 * 
 * @param img The input {@link Img}.
 * @return
 */
static public final <R extends RealType<R>, T extends NativeType<T> & NumericType<T>> T computeSmallestType(final Img<R> img) {
  final R type = img.firstElement();
  final long maxSum = (long) (img.size() * (Math.pow(2, type.getBitsPerPixel()) -1));
  T smallest = chooseSmallestType(type, maxSum);
  if (null != smallest) return smallest;
  // Else, slow way: sum all values and determine the smallest type
  final RealSum sum = new RealSum();
  for (final R r : img) sum.add(r.getRealDouble());
  smallest = chooseSmallestType(type, sum.getSum());
  if (null != smallest) return smallest;
  throw new UnsupportedOperationException("Target image is too large!");
}

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

private static float[] createReference( final Img< FloatType > img )
{
  // use a random number generator
  final Random rnd = new Random( 1241234 );
  // create reference array
  final float[] reference = new float[ ( int ) img.size() ];
  // iterate over image and reference array and fill with data
  final Cursor< FloatType > cursor = img.cursor();
  int i = 0;
  while ( cursor.hasNext() )
  {
    cursor.fwd();
    final float value = rnd.nextFloat();
    reference[ i++ ] = value;
    cursor.get().set( value );
  }
  return reference;
}

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

protected static ImgFactory< ComplexFloatType > getFFTFactory( final Img< ? extends RealType< ? > > img )
{
  try
  {
    return img.factory().imgFactory( new ComplexFloatType() );
  }
  catch ( final IncompatibleTypeException e )
  {
    if ( img.size() > Integer.MAX_VALUE / 2 )
      return new CellImgFactory<>( new ComplexFloatType(), 1024 );
    return new ArrayImgFactory<>( new ComplexFloatType() );
  }
}

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

int[] getImgAsInts( final Img< IntType > img )
{
  final RandomAccess< IntType > a = img.randomAccess();
  final int N = ( int ) img.size();
  final int[] data = new int[ N ];
  final long[] dim = new long[ img.numDimensions() ];
  final long[] pos = new long[ img.numDimensions() ];
  img.dimensions( dim );
  for ( int i = 0; i < N; ++i )
  {
    IntervalIndexer.indexToPosition( i, dim, pos );
    a.setPosition( pos );
    data[ i ] = a.get().get();
  }
  return data;
}

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

static int[] getImgAsInts( final Img< IntType > img )
{
  final RandomAccess< IntType > a = img.randomAccess();
  final int N = ( int ) img.size();
  final int[] data = new int[ N ];
  final long[] dim = new long[ img.numDimensions() ];
  final long[] pos = new long[ img.numDimensions() ];
  img.dimensions( dim );
  for ( int i = 0; i < N; ++i )
  {
    IntervalIndexer.indexToPosition( i, dim, pos );
    a.setPosition( pos );
    data[ i ] = a.get().get();
  }
  return data;
}

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

int[] getImgAsInts( final Img< IntType > img )
{
  final RandomAccess< IntType > a = img.randomAccess();
  final int N = ( int ) img.size();
  final int[] data = new int[ N ];
  final long[] dim = new long[ img.numDimensions() ];
  final long[] pos = new long[ img.numDimensions() ];
  img.dimensions( dim );
  for ( int i = 0; i < N; ++i )
  {
    IntervalIndexer.indexToPosition( i, dim, pos );
    a.setPosition( pos );
    data[ i ] = a.get().get();
  }
  return data;
}

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

int[] getImgAsInts( final Img< IntType > img )
{
  final RandomAccess< IntType > a = img.randomAccess();
  final int N = ( int ) img.size();
  final int[] data = new int[ N ];
  final long[] dim = new long[ img.numDimensions() ];
  final long[] pos = new long[ img.numDimensions() ];
  img.dimensions( dim );
  for ( int i = 0; i < N; ++i )
  {
    IntervalIndexer.indexToPosition( i, dim, pos );
    a.setPosition( pos );
    data[ i ] = a.get().get();
  }
  return data;
}

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

int[] getImgAsInts( final Img< IntType > img )
{
  final RandomAccess< IntType > a = img.randomAccess();
  final int N = ( int ) img.size();
  final int[] data = new int[ N ];
  final long[] dim = new long[ img.numDimensions() ];
  final long[] pos = new long[ img.numDimensions() ];
  img.dimensions( dim );
  for ( int i = 0; i < N; ++i )
  {
    IntervalIndexer.indexToPosition( i, dim, pos );
    a.setPosition( pos );
    data[ i ] = a.get().get();
  }
  return data;
}

相关文章