net.imglib2.util.Util.createGaussianKernel1DDouble()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(107)

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

Util.createGaussianKernel1DDouble介绍

[英]This method creates a gaussian kernel
[中]

代码示例

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

/**
 * Compute the Gaussian Kernel for all dimensions
 */
protected void computeKernel()
{
  for ( int d = 0; d < numDimensions; ++d )
    this.kernel[ d ] = Util.createGaussianKernel1DDouble( sigma[ d ], true );
}

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

/**
 * Compute the Gaussian Kernel for all dimensions
 */
protected void computeKernel()
{
  for ( int d = 0; d < numDimensions; ++d )
    this.kernel[ d ] = Util.createGaussianKernel1DDouble( sigma[ d ], true );		
}

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

public static float[][] getCUDAKernels( final double[] sigma, final int[] supportedKernelSizes )
{
  final int n = sigma.length;
  
  final double[][] kernels = new double[ n ][];
  int maxLength = -1;
  
  for ( int d = 0; d < n; ++d )
  {
    kernels[ d ] = Util.createGaussianKernel1DDouble( sigma[ d ], true );
    maxLength = Math.max( maxLength, kernels[ d ].length );
  }
  int size = Integer.MAX_VALUE;
  for ( final int s : supportedKernelSizes )
    if ( maxLength <= s )
      size = Math.min( s,  size );
  if ( size == Integer.MAX_VALUE )
  {
    System.out.println( "Kernel bigger than maximally supported size. Quitting." );
    return null;
  }
  final float[][] kernelsCUDA = new float[ kernels.length ][];
  for ( int d = 0; d < kernels.length; ++d )
    kernelsCUDA[ d ] = getFloatKernelPadded( kernels[ d ], size );
  
  return kernelsCUDA;
}

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

@Override
public RandomAccessibleInterval<T> calculate(double[] input) {
  final double[] sigmaPixels = new double[input.length];
  final long[] dims = new long[input.length];
  final double[][] kernelArrays = new double[input.length][];
  for (int d = 0; d < input.length; d++) {
    sigmaPixels[d] = input[d];
    dims[d] = Math.max(3, (2 * (int) (3 * sigmaPixels[d] + 0.5) + 1));
    kernelArrays[d] = Util.createGaussianKernel1DDouble(sigmaPixels[d], true);
  }
  final RandomAccessibleInterval<T> out = createOp.calculate(new FinalInterval(
    dims));
  final Cursor<T> cursor = Views.iterable(out).cursor();
  while (cursor.hasNext()) {
    cursor.fwd();
    double result = 1.0f;
    for (int d = 0; d < input.length; d++) {
      result *= kernelArrays[d][cursor.getIntPosition(d)];
    }
    cursor.get().setReal(result);
  }
  return out;
}

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

final private static Img< FloatType > createGaussianKernel( final double[] sigmas )
{
  final int numDimensions = sigmas.length;
  final long[] imageSize = new long[ numDimensions ];
  final double[][] kernel = new double[ numDimensions ][];
  for ( int d = 0; d < numDimensions; ++d )
  {
    kernel[ d ] = Util.createGaussianKernel1DDouble( sigmas[ d ], true );
    imageSize[ d ] = kernel[ d ].length;
  }
  final Img< FloatType > kernelImg = ArrayImgs.floats( imageSize );
  final Cursor< FloatType > cursor = kernelImg.localizingCursor();
  final int[] position = new int[ numDimensions ];
  while ( cursor.hasNext() )
  {
    cursor.fwd();
    cursor.localize( position );
    double value = 1;
    for ( int d = 0; d < numDimensions; ++d )
      value *= kernel[ d ][ position[ d ] ];
    cursor.get().set( ( float ) value );
  }
  return kernelImg;
}

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

kernel[ d ] = Util.createGaussianKernel1DDouble( sigmas[ d ], true );
imageSize[ d ] = kernel[ d ].length;

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

final public static Img< FloatType > createGaussianKernel( final ImgFactory< FloatType > factory, final double[] sigmas )
{
  final int numDimensions = sigmas.length;
  final int[] imageSize = new int[ numDimensions ];
  final double[][] kernel = new double[ numDimensions ][];
  for ( int d = 0; d < numDimensions; ++d )
  {
    kernel[ d ] = Util.createGaussianKernel1DDouble( sigmas[ d ], true );
    imageSize[ d ] = kernel[ d ].length;
  }
  final Img< FloatType > kernelImg = factory.create( imageSize, new FloatType() );
  final Cursor< FloatType > cursor = kernelImg.localizingCursor();
  final int[] position = new int[ numDimensions ];
  while ( cursor.hasNext() )
  {
    cursor.fwd();
    cursor.localize( position );
    double value = 1;
    for ( int d = 0; d < numDimensions; ++d )
      value *= kernel[ d ][ position[ d ] ];
    cursor.get().set( ( float ) value );
  }
  return kernelImg;
}

相关文章