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

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

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

Dimensions.dimension介绍

[英]Get the number of pixels in a given dimension d.
[中]获取给定维度d中的像素数。

代码示例

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

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-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-algorithms-gpl

/**
 * A helper method to test if padding is actually necessary
 * 
 * @param interval - the dimensions of a dataset
 * @param padded - the dimensions of a dataset
 * @return true if the dimensions are equal, otherwise false
 */
final public static boolean dimensionsEqual( final Dimensions interval, final Dimensions padded )
{
  for ( int d = 0; d < interval.numDimensions(); ++d )
    if ( interval.dimension( d ) != padded.dimension( d ) )
      return false;
  
  return true;
}

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

public static RealInterval getBoundingBoxReal( final Dimensions dims, final AffineTransform3D transform )
  {
    final double[] min = new double[]{ 0, 0, 0 };
    final double[] max = new double[]{
        dims.dimension( 0 ) - 1,
        dims.dimension( 1 ) - 1,
        dims.dimension( 2 ) - 1 };

    return transform.estimateBounds( new FinalRealInterval( min, max ) );
  }
}

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

/**
 * Compute the number of elements contained in an (integer) {@link Interval}
 * .
 * 
 * @return number of elements in {@code interval}.
 */
public static long numElements( final Dimensions interval )
{
  long numPixels = interval.dimension( 0 );
  final int n = interval.numDimensions();
  for ( int d = 1; d < n; ++d )
    numPixels *= interval.dimension( d );
  return numPixels;
}

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

/**
 * Compute the number of elements contained in an (integer) {@link Interval}
 * .
 * 
 * @return number of elements in {@code interval}.
 */
public static long numElements( final Dimensions interval )
{
  long numPixels = interval.dimension( 0 );
  final int n = interval.numDimensions();
  for ( int d = 1; d < n; ++d )
    numPixels *= interval.dimension( d );
  return numPixels;
}

代码示例来源: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-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: imglib/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: imagej/imagej-ops

private static int[] blockSize(final Dimensions image,
  final Dimensions psfSize)
{
  if (psfSize != null) return Intervals.dimensionsAsIntArray(psfSize);
  final int[] blockSize = new int[image.numDimensions()];
  for (int d = 0; d < blockSize.length; d++) {
    final long size = (long) Math.floor(Math.sqrt(image.dimension(d)));
    if (size > Integer.MAX_VALUE) {
      throw new IllegalArgumentException("Image dimension #" + d +
        " is too large: " + image.dimension(d));
    }
    blockSize[d] = (int) size;
  }
  return blockSize;
}

代码示例来源: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 );
}

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

/**
 * Computes the supported dimensionality of an input dataset (of real numbers) for a forward FFT of the entire dataset AS SMALL AS POSSIBLE
 * 
 * @param inputDimensions - the dimensions of the real-valued input
 * @param paddedDimensions - the required dimensions of the real-valued input (computed)
 * @param fftDimensions - the dimensions of the complex-valued fft after the fast fourier transform (computed), i.e. which dimensions are required for the output
 */
final static public void dimensionsRealToComplexSmall( final Dimensions inputDimensions, final long[] paddedDimensions, final long[] fftDimensions )
{
  paddedDimensions[ 0 ] = FftReal.nfftSmall( (int)inputDimensions.dimension( 0 ) );
  fftDimensions[ 0 ] = ( paddedDimensions[ 0 ]  / 2 + 1 );
  
  for ( int d = 1; d < inputDimensions.numDimensions(); ++d )
    fftDimensions[ d ] = paddedDimensions[ d ] = FftComplex.nfftSmall( (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 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.preibisch/multiview-reconstruction

@Override
protected void loadMetaData( ViewId view )
{
  final BasicViewDescription< ? > vd = sd.getViewDescriptions().get( view );
  final Dimensions d = vd.getViewSetup().getSize();
  final VoxelDimensions dv = vd.getViewSetup().getVoxelSize();
  updateMetaDataCache( view, (int)d.dimension( 0 ), (int)d.dimension( 1 ), (int)d.dimension( 2 ), dv.dimension( 0 ), dv.dimension( 1 ), dv.dimension( 2 ) );
}

代码示例来源: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.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: imglib/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;
}

相关文章