net.imglib2.Dimensions.numDimensions()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(108)

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

Dimensions.numDimensions介绍

暂无

代码示例

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

private static long planeCount(final Dimensions dims) {
  if (dims.numDimensions() < 2) return 0;
  if (dims.numDimensions() == 2) return 1;
  long count = 1;
  for (int i = 2; i < dims.numDimensions(); i++)
    count *= dims.dimension(i);
  return count;
}

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

private static long[] dimensions( final Dimensions img )
  {
    final long[] dimensions = new long[ img.numDimensions() ];
    img.dimensions( dimensions );
    return dimensions;
  }
}

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

/**
 * Creates an Interval with the boundaries [0, dimensions-1]
 * 
 * @param dimensions
 *            - the size of the interval
 */
public AbstractInterval( final Dimensions dimensions )
{
  this( dimensions.numDimensions() );
  for ( int d = 0; d < n; ++d )
    this.max[ d ] = dimensions.dimension( d ) - 1;
}

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

/**
 * Gets the dimensions of a {@link Dimensions}.
 */
public static long[] getDims(final Dimensions dimensions) {
  final long[] dims = new long[dimensions.numDimensions()];
  dimensions.dimensions(dims);
  return dims;
}

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

/**
 * Gets the dimensions of a {@link Dimensions}.
 * 
 * @deprecated Use {@link net.imglib2.util.Intervals#dimensionsAsLongArray}
 *             instead.
 */
@Deprecated
public static long[] getDims(final Dimensions dimensions) {
  final long[] dims = new long[dimensions.numDimensions()];
  dimensions.dimensions(dims);
  return dims;
}

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

private static long[] dims(Dimensions d) {
  final long[] dims = new long[d.numDimensions()];
  d.dimensions(dims);
  return dims;
}

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

static boolean canUseBufferedConvolver( final Dimensions targetsize, final double[][] halfkernels )
{
  final int n = targetsize.numDimensions();
  for ( int d = 0; d < n; ++d )
    if ( targetsize.dimension( d ) + 4 * halfkernels[ d ].length - 4 > Integer.MAX_VALUE )
      return false;
  return true;
}

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

static boolean canUseBufferedConvolver( final Dimensions targetsize, final double[][] halfkernels )
{
  final int n = targetsize.numDimensions();
  for( int d = 0; d < n; ++d )
    if ( targetsize.dimension( d ) + 4 * halfkernels[ d ].length - 4 > Integer.MAX_VALUE )
      return false;
  return true;
}

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

/**
 * Computes the supported dimensionality of an input dataset (of complex numbers) for a forward/inverse FFT of the entire dataset AS FAST AS POSSIBLE
 * 
 * @param inputDimensions - the dimensions of the input
 * @param paddedDimensions - the required dimensions of the input/output (computed)
 */
final static public void dimensionsComplexToComplexFast( final Dimensions inputDimensions, final long[] paddedDimensions )
{
  for ( int d = 0; d < inputDimensions.numDimensions(); ++d )
    paddedDimensions[ d ] = FftComplex.nfftFast( (int)inputDimensions.dimension( d ) );
}

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

/**
 * Computes the supported dimensionality of an input dataset (of complex numbers) for a forward/inverse FFT of the entire dataset AS SMALL AS POSSIBLE
 * 
 * @param inputDimensions - the dimensions of the input
 * @param paddedDimensions - the required dimensions of the input/output (computed)
 */
final static public void dimensionsComplexToComplexSmall( final Dimensions inputDimensions, final long[] paddedDimensions )
{
  for ( int d = 0; d < inputDimensions.numDimensions(); ++d )
    paddedDimensions[ d ] = FftComplex.nfftSmall( (int)inputDimensions.dimension( d ) );
}

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

/**
 * Create an {@code Img<T>} with the specified {@code dimensions}.
 *
 * @return new image with the specified {@code dimensions}.
 */
public Img< T > create( final Dimensions dimensions )
{
  final long[] size = new long[ dimensions.numDimensions() ];
  dimensions.dimensions( size );
  return create( size );
}

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

@Override
public Dataset create(final Dimensions dimensions) {
  final long[] size = new long[dimensions.numDimensions()];
  dimensions.dimensions(size);
  return create(size);
}

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

static long[][] getTempImageDimensions( final Dimensions targetsize, final double[][] halfkernels )
{
  final int n = targetsize.numDimensions();
  final long[][] tmpdims = new long[ n ][];
  tmpdims[ n - 1 ] = new long[ n ];
  targetsize.dimensions( tmpdims[ n - 1 ] );
  for ( int d = n - 2; d >= 0; --d )
  {
    tmpdims[ d ] = tmpdims[ d + 1 ].clone();
    tmpdims[ d ][ d + 1 ] += 2 * halfkernels[ d + 1 ].length - 2;
  }
  return tmpdims;
}

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

@Deprecated
public Img< T > create( final Dimensions dim, final T type )
{
  final long[] size = new long[ dim.numDimensions() ];
  dim.dimensions( size );
  cache( type );
  return create( size, type );
}

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

static boolean canUseArrayImgFactory( final Dimensions targetsize, final double[][] halfkernels )
{
  final int n = targetsize.numDimensions();
  long size = targetsize.dimension( 0 );
  for ( int d = 1; d < n; ++d )
    size *= targetsize.dimension( d ) + 2 * halfkernels[ d ].length;
  return size <= Integer.MAX_VALUE;
}

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

final static public long positionToIndex( final Localizable position, final Dimensions dimensions )
{
  final int maxDim = dimensions.numDimensions() - 1;
  long i = position.getLongPosition( maxDim );
  for ( int d = maxDim - 1; d >= 0; --d )
    i = i * dimensions.dimension( d ) + position.getLongPosition( d );
  return i;
}

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

static < T extends NativeType< T > > ImgFactory< T > getImgFactory( final Dimensions targetsize, final double[][] halfkernels, final T type )
  {
    if ( canUseArrayImgFactory( targetsize, halfkernels ) )
      return new ArrayImgFactory< T >();
    final int cellSize = ( int ) Math.pow( Integer.MAX_VALUE / type.getEntitiesPerPixel(), 1.0 / targetsize.numDimensions() );
    return new CellImgFactory< T >( cellSize );
  }
}

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

static < T extends NativeType< T > > ImgFactory< T > getImgFactory( final Dimensions targetsize, final double[][] halfkernels, final T type )
{
  if ( canUseArrayImgFactory( targetsize, halfkernels ) )
    return new ArrayImgFactory<>( type );
  final int cellSize = ( int ) Math.pow( Integer.MAX_VALUE / type.getEntitiesPerPixel().getRatio(), 1.0 / targetsize.numDimensions() );
  return new CellImgFactory<>( type, cellSize );
}

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

final static public void indexToPosition( long index, final Dimensions dimensions, final Positionable position )
{
  final int maxDim = dimensions.numDimensions() - 1;
  for ( int d = 0; d < maxDim; ++d )
  {
    final long j = index / dimensions.dimension( d );
    position.setPosition( index - j * dimensions.dimension( d ), d );
    index = j;
  }
  position.setPosition( index, maxDim );
}

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

final static public void indexToPosition( long index, final Dimensions dimensions, final Positionable position )
{
  final int maxDim = dimensions.numDimensions() - 1;
  for ( int d = 0; d < maxDim; ++d )
  {
    final long j = index / dimensions.dimension( d );
    position.setPosition( index - j * dimensions.dimension( d ), d );
    index = j;
  }
  position.setPosition( index, maxDim );
}

相关文章