net.imglib2.Dimensions类的使用及代码示例

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

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

Dimensions介绍

[英]Defines an extent in n-dimensional discrete space.
[中]在n维离散空间中定义范围。

代码示例

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

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

代码示例来源: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.preibisch/multiview-reconstruction

final long[] dim = new long[dimAccu.numDimensions()];
dimAccu.dimensions( dim );
dim[2] += dimNew.dimension( 2 );
dimensionGroupedMap.put( key, new ValuePair<>(new FinalDimensions( dim ), dimensionGroupedMap.get( key ).getB() ) );

代码示例来源:origin: imagej/imagej-ops

/**
 * Calculates padding size size for real to complex FFT
 * 
 * @param fast if true calculate size for fast FFT
 * @param inputDimensions original real dimensions
 * @return padded real dimensions
 */
public static Dimensions getPaddedInputDimensionsRealToComplex(
  final boolean fast, final Dimensions inputDimensions)
{
  final long[] paddedSize = new long[inputDimensions.numDimensions()];
  final long[] fftSize = new long[inputDimensions.numDimensions()];
  dimensionsRealToComplex(fast, inputDimensions, paddedSize, fftSize);
  return new FinalDimensions(paddedSize);
}

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

subdivisions.add( subdiv_16_16_16 );
setup.getSize().dimensions( size );
long maxSize = 0;
for ( int d = 0; d < 3; ++d )

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

final long dim0 = op.dimension( m_dimIndex0 );
for ( Queue< T > q : m_kernel )
op.dimensions( dim );
dim[ m_dimIndex0 ] = 1;

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

public static List< AffineTransform3D > generateRegularGrid(RegularTranslationParameters params, Dimensions dims)
{
  
  final ArrayList< AffineTransform3D > transforms = new ArrayList<>();
  int nTiles = prod(params.nSteps);
  for (int i = 0; i < nTiles; ++i)
    transforms.add(new AffineTransform3D());
  
  int modulo = 1;
  for (int i = 0; i < params.nDimensions; ++i)
  {
    int d = params.dimensionOrder[i];
    double moveSize = (1.0 - params.overlaps[d]) * dims.dimension( d );			
    
    
    moveD(transforms, d, moveSize, modulo, params.nSteps[d], params.alternating[d], params.increasing[d]);
    modulo *= params.nSteps[d];
    
  }
  
  //transforms.forEach( ( t ) -> System.out.println( Util.printCoordinates( t.getTranslation() ))) ;
  return transforms;
}

代码示例来源:origin: imagej/imagej-ops

/**
 * Calculates complex FFT size for real to complex FFT
 * 
 * @param fast if true calculate size for fast FFT
 * @param inputDimensions original real dimensions
 * @return complex FFT dimensions
 */
public static Dimensions getFFTDimensionsRealToComplex(final boolean fast,
  final Dimensions inputDimensions)
{
  final long[] paddedSize = new long[inputDimensions.numDimensions()];
  final long[] fftSize = new long[inputDimensions.numDimensions()];
  dimensionsRealToComplex(fast, inputDimensions, paddedSize, fftSize);
  return new FinalDimensions(fftSize);
}

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

private K binaryop( ConnectedType type, final K r, final K op, final boolean erode, final int count )
  r.dimensions( dim );
  switch ( r.numDimensions() )

代码示例来源: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-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.preibisch/multiview-reconstruction

private static Translation3D getCenterTranslation(Collection<Translation3D> translations, Dimensions size)
{
  final int n = translations.iterator().next().numDimensions();
  double[] centerTranslation = new double[n];
  int count = 0;
  for (final Translation3D t : translations)
  {
    for (int d = 0; d<n; d++)
      centerTranslation[d] += t.getTranslation( d );
    count++;
  }
  for (int d = 0; d<n; d++)
  {
    centerTranslation[d] /= count;
    centerTranslation[d] += size.dimension( d ) / 2;
    centerTranslation[d] *= -1;
  }
  return new Translation3D( centerTranslation );
  
}

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

public static BoundingBox getBoundingBox( final Dimensions dims, final AffineTransform3D transform )
{
  final RealInterval interval = getBoundingBoxReal( dims, transform );
  final int[] minInt = new int[ 3 ];
  final int[] maxInt = new int[ 3 ];
  for ( int d = 0; d < dims.numDimensions(); ++d )
  {
    minInt[ d ] = (int)Math.round( interval.realMin( d ) ) - 1;
    maxInt[ d ] = (int)Math.round( interval.realMax( d ) ) + 1;
  }
  return new BoundingBox( minInt, maxInt );
}

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

FloodFill< BitType, K > ff = new FloodFill< BitType, K >( m_connectedType );
long[] dim = new long[ r.numDimensions() ];
r.dimensions( dim );
Cursor< BitType > rc = r.cursor();
Cursor< BitType > opc = op.localizingCursor();

代码示例来源: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-script

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

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

@Override
public long[][] calculate(Dimensions inputDimensions) {
  long[][] size = new long[2][];
  size[0] = new long[inputDimensions.numDimensions()];
  size[1] = new long[inputDimensions.numDimensions()];
  if (fast && forward) {
    FFTMethods.dimensionsRealToComplexFast(inputDimensions, size[0], size[1]);
  }
  else if (!fast && forward) {
    FFTMethods.dimensionsRealToComplexSmall(inputDimensions, size[0],
      size[1]);
  }
  if (fast && !forward) {
    FFTMethods.dimensionsComplexToRealFast(inputDimensions, size[0], size[1]);
  }
  else if (!fast && !forward) {
    FFTMethods.dimensionsComplexToRealSmall(inputDimensions, size[0],
      size[1]);
  }
  return size;
}

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

@SuppressWarnings("unchecked")
public <T extends RealType< T > & NativeType< T >> RandomAccessibleInterval< T > createVirtual(
    final IFormatReader reader,
    final File file,
    final int series,
    final int channel,
    final int timepoint,
    T type,
    Dimensions dim) throws IncompatibleTypeException
{
  setReaderFileAndSeriesIfNecessary( reader, file, series );
  final boolean isLittleEndian = reader.isLittleEndian();		
  final long[] dims = new long[]{reader.getSizeX(), reader.getSizeY(), reader.getSizeZ()};
  if (dim != null)
    dim.dimensions( dims );
  final int pixelType = reader.getPixelType();
  if (pixelType == FormatTools.UINT8)
    return new VirtualRandomAccessibleIntervalLOCI< T >( reader, file, dims, series, channel, timepoint, type == null ? (T) new UnsignedByteType() : type, (t, buf, i) -> {t.setReal( (int) buf[i] & 0xff);} );
  else if (pixelType == FormatTools.UINT16)
    return new VirtualRandomAccessibleIntervalLOCI< T >( reader, file, dims, series, channel, timepoint, type == null ? (T) new UnsignedShortType() : type, (t, buf, i) -> {t.setReal( LegacyStackImgLoaderLOCI.getShortValueInt( buf, i*2, isLittleEndian ) );} );
  else if (pixelType == FormatTools.INT16)
    return new VirtualRandomAccessibleIntervalLOCI< T >( reader, file, dims, series, channel, timepoint, type == null ? (T) new ShortType() : type, (t, buf, i) -> {t.setReal( LegacyStackImgLoaderLOCI.getShortValue( buf, i*2, isLittleEndian ) );} );
  else if (pixelType == FormatTools.UINT32)
    return new VirtualRandomAccessibleIntervalLOCI< T >( reader, file, dims, series, channel, timepoint, type == null ? (T) new UnsignedIntType() : type, (t, buf, i) -> {t.setReal( LegacyStackImgLoaderLOCI.getIntValue( buf, i*4, isLittleEndian ) );} );
  else if (pixelType == FormatTools.FLOAT)
    return new VirtualRandomAccessibleIntervalLOCI< T >( reader, file, dims, series, channel, timepoint, type == null ? (T) new FloatType() : type, (t, buf, i) -> {t.setReal( LegacyStackImgLoaderLOCI.getFloatValue( buf, i*4, isLittleEndian ) );} );
  else
    throw new IncompatibleTypeException( this, "cannot create virtual image for this pixel type" );
}

相关文章