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

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

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

Img.dimension介绍

暂无

代码示例

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

@Override
public long dimension( final int d )
{
  return counts.dimension( d );
}

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

@Override
public long dimension( final int d )
{
  return counts.dimension( d );
}

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

@Override
public boolean hasNext()
{
  return k < op.dimension( m_projectionDim ) - 1;
}

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

@Override
public boolean hasNext()
{
  return k < op.dimension( m_projectionDim ) - 1;
}

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

@Override
public long dimension(final int d) {
  return img.dimension(d);
}

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

@Override
public long dimension(final int d) {
  return img.dimension(d);
}

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

/** The dimensions of the integral image are always +1 from the integrated image. */
protected static final boolean isIntegerDivision(Img<?> integralImg, Img<?> scaled) {
  for ( int d = 0; d < scaled.numDimensions(); ++d )
    if ( 0 != (integralImg.dimension( d ) -1) % scaled.dimension( d ) )
      return false;
  
  return true;
}

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

public Bandpass( final Img<T> img, final int beginRadius, final int endRadius )
{
  this.img = img;		
  this.inPlace = false;
  this.bandPass = true;
  this.beginRadius = beginRadius;
  this.endRadius = endRadius;
  
  this.origin = new long[ img.numDimensions() ];
  
  this.origin[ 0 ] = img.dimension( 0 ) - 1;
  for ( int d = 1; d < this.origin.length; ++d )
    origin[ d ] = img.dimension( d ) / 2;
}

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

private final long inside(final long pos, final int d) {
  // TODO isn't this dimensions[d], without the -1?
  return Math.min(integralHistogram.dimension(d) -1, Math.max(0, pos));
}

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

static private final long[] asDimArray(final Img<?> img, final Number scale) {
  final long[] dim = new long[img.numDimensions()];
  final double s = scale.doubleValue();
  for (int i=0; i<dim.length; i++) {
    dim[i] = (int)((img.dimension(i) * s) + 0.5);
  }
  return dim;
}

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

static private final long[] dimensions(final Img<?> img) {
  final long[] ds = new long[img.numDimensions()];
  for (int d=0; d<ds.length; ++d) {
    ds[d] = img.dimension(d) + 1;
  }
  return ds;
}

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

protected static int[] getMaxDim( final Img<?> image1, final Img<?> image2 )
{
  final int[] maxDim = new int[ image1.numDimensions() ];
  
  for ( int d = 0; d < image1.numDimensions(); ++d )
    maxDim[ d ] = (int) Math.max( image1.dimension( d ), image2.dimension( d ) );
  
  return maxDim;
}

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

public static < T extends RealType< T > > Img< T > computeMaxProjectionPSF( final Img< T > avg )
{
  int minDim = -1;
  long minDimSize = Long.MAX_VALUE;
  for ( int d = 0; d < avg.numDimensions(); ++d )
    if ( avg.dimension( d ) < minDimSize )
    {
      minDimSize = avg.dimension( d );
      minDim = d;
    }
  return computeProjection( avg, minDim, true );
}

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

public static FloatProcessor toProcessor( final Img< ? extends RealType< ? > > img )
{
  final FloatProcessor fp = new FloatProcessor( (int)img.dimension( 0 ), (int)img.dimension( 1 ) );
  final float[] array = (float[])fp.getPixels();
  final Cursor< ? extends RealType< ? > > c = img.cursor();
  
  for ( int i = 0; i < array.length; ++ i)
    array[ i ] = c.next().getRealFloat();
  return fp;
}

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

public void setDownSamplingFactor( final float factor )
{
  newSize = new long[ input.numDimensions() ];
  scaling = new float[ input.numDimensions() ];
  
  for ( int d = 0; d < input.numDimensions(); ++d )
  {
    newSize[ d ] = Util.round( input.dimension(d) * factor );
    scaling[ d ] = 1.0f / factor;
  }
}
public void setNewSize( final long[] newSize ) { this.newSize = newSize.clone(); }

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

@Override
public RandomAccessibleInterval< UnsignedShortType > getImage( final ViewId view )
{
  final long[] dim = new long[ sb.getImgs().get( view.getViewSetupId() ).numDimensions() ];
  for ( int d = 0; d < dim.length; ++d )
    dim[ d ] = sb.getImgs().get( view.getViewSetupId() ).dimension( d );
  final Img< UnsignedShortType > img = ArrayImgs.unsignedShorts( dim );
  final Cursor< FloatType > in = sb.getImgs().get( view.getViewSetupId() ).cursor();
  final Cursor< UnsignedShortType > out = img.cursor();
  while ( in.hasNext() )
    out.next().set( Math.round( in.next().get() ) );
  return img;
}

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

private void generateByteTestImgs(int size) {
  if (in != null && in.dimension(0) == size) return;
  if (size > 1024) {
    assumeTrue(expensiveTestsEnabled);
  }
  in = generateByteArrayTestImg(true, size, size);
  out = generateByteArrayTestImg(false, size, size);
}

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

private void placeSphereInCenter(Img<FloatType> img) {
  final Point center = new Point(img.numDimensions());
  for (int d = 0; d < img.numDimensions(); d++)
    center.setPosition(img.dimension(d) / 2, d);
  HyperSphere<FloatType> hyperSphere = new HyperSphere<>(img, center, 2);
  for (final FloatType value : hyperSphere) {
    value.setReal(1);
  }
}

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

private void placeSphereInCenter(Img<FloatType> img) {

    final Point center = new Point(img.numDimensions());

    for (int d = 0; d < img.numDimensions(); d++)
      center.setPosition(img.dimension(d) / 2, d);

    HyperSphere<FloatType> hyperSphere = new HyperSphere<>(img, center, 30);

    for (final FloatType value : hyperSphere) {
      value.setReal(1);
    }
  }
}

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

@Test
public void testLoopLine()
{
  // setup
  final Img< IntType > img = ArrayImgs.ints( 1, 1, 5 );
  final RandomAccess< IntType > ra = img.randomAccess();
  // process
  final Runnable loop = LoopUtils.createLineLoop( ra, img.dimension( 2 ), 2,
      () -> ra.get().set( 42 ) );
  loop.run();
  // test
  img.forEach( value -> assertEquals( 42, value.get() ) );
}

相关文章