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

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

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

Img.numDimensions介绍

暂无

代码示例

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

@Override
public int numDimensions()
{
  return counts.numDimensions();
}

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

/**
 * Instantiate a 2D gaussian peak fitter that will operate on the given image. 
 * It is important that the image has a 0 background for this class to 
 * operate properly. 
 */
public GaussianPeakFitterND(final Img<T> image) {
  this.image = image;
  this.ndims = image.numDimensions();
}

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

@Override
public int numDimensions()
{
  return counts.numDimensions();
}

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

public PickImagePeaks(final Img<T> inputImage) {
  image = inputImage;
  pTime = 0;
  peakLocList = new ArrayList<long[]>();
  peakImage = null;
  suppressAxis = new double[inputImage.numDimensions()];
  Arrays.fill(suppressAxis, 0);
  suppressSum = 0;
}

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

public FloydSteinbergDithering( final Img<T> img, final float ditheringThreshold )
{
  this.img = img;
  this.dim = Util.intervalDimensions(img);
  this.tmp1 = new long[img.numDimensions()];
  this.tmp2 = new long[img.numDimensions()];
  this.errorDiffusionKernel = createErrorDiffusionKernel( img.numDimensions() );
  
  this.ditheringThreshold = ditheringThreshold;
}

代码示例来源: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.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.imglib2/imglib2-algorithms-legacy

/** Calls the DifferenceOfGaussianOld constructor with the given sigmas copied into double[] arrays,
 * one entry per {@param img} dimension. */
public DifferenceOfGaussianOld( final Img<A> img, final ImgFactory<FloatType> factory,
    final OutOfBoundsFactory<FloatType, RandomAccessibleInterval<FloatType>> outOfBoundsFactory,
    final double sigma1, final double sigma2, final double minPeakValue, final double normalizationFactor )
{
  this( img, factory, outOfBoundsFactory, asArray(img.numDimensions(), sigma1),
      asArray(img.numDimensions(), sigma2), minPeakValue, normalizationFactor );
}

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

/**
 * @param image - The {@link Img} to mirror
 * @param dimension - The axis to mirror (e.g. 0->x-Axis->horizontally, 1->y-axis->vertically)
 */
public MirrorImage( final Img<T> image, final int dimension )
{
  this.image = image;
  this.dimension = dimension;
  this.numDimensions = image.numDimensions();
  
  setNumThreads();
}

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

/** Calls the DifferenceOfGaussian constructor with the given sigmas copied into double[] arrays,
 * one entry per {@param img} dimension. */
public DifferenceOfGaussian( final Img<A> img, final ImgFactory<A> factory,
    final OutOfBoundsFactory<A, RandomAccessibleInterval<A>> outOfBoundsFactory,
    final double sigma1, final double sigma2, final double minPeakValue, final double normalizationFactor )
{
  this( img, factory, outOfBoundsFactory, asArray(img.numDimensions(), sigma1),
      asArray(img.numDimensions(), sigma2), minPeakValue, normalizationFactor );
}

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

public SubpixelLocalization( final Img<T> laPlacian, final List<DifferenceOfGaussianPeak<T>> peaks )
{
  setNumThreads();
  this.laPlacian = laPlacian;
  this.peaks = peaks;
  this.allowedToMoveInDim = new boolean[ laPlacian.numDimensions() ];
  
  // principally one can move in any dimension
  for ( int d = 0; d < allowedToMoveInDim.length; ++d )
    allowedToMoveInDim[ d ] = true;
  
  this.doubleArrayFactory = new ArrayImgFactory<DoubleType>();
}

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

public static < T extends RealType< T > > void removeMinProjections( final Img< T > psf )
{
  for ( int d = 0; d < psf.numDimensions(); ++d )
  {
    final Img< T > minProjection = PSFCombination.computeProjection( psf, d, false );
    subtractProjection( psf, minProjection, d );
  }
}

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

/**
 * Calculate an image signature
 * 
 * The image signature are 1st and 2nd order moments of the intensity and
 * the coordinates.
 */
protected < T extends RealType< T >> float[] signature( final Img< T > image )
{
  final float[] result = new float[ ( image.numDimensions() + 1 ) * 2 ];
  signature( image, result );
  return result;
}

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

private ImgPlus<UnsignedByteType> splitColorChannels(ImgPlus<ARGBType> input) {
  Img<ARGBType> colored = input.getImg();
  RandomAccessibleInterval<UnsignedByteType> colorStack = Views.stack(
      Converters.argbChannel( colored, 1 ),
      Converters.argbChannel( colored, 2 ),
      Converters.argbChannel( colored, 3 ) );
  ImgPlus<UnsignedByteType> result = new ImgPlus<>(ImgView.wrap(colorStack, new PlanarImgFactory<>()), input.getName());
  int lastAxis = colored.numDimensions();
  for (int i = 0; i < lastAxis; i++) result.setAxis(input.axis(i).copy(), i);
  result.setAxis(new DefaultLinearAxis(Axes.CHANNEL), lastAxis);
  return ImgPlusViews.moveAxis(result, lastAxis, 2);
}

相关文章