net.imglib2.view.Views.extendMirrorSingle()方法的使用及代码示例

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

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

Views.extendMirrorSingle介绍

[英]Extend a RandomAccessibleInterval with a mirroring out-of-bounds strategy. Boundary pixels are not repeated. Note that this requires that all dimensions of the source (F source) must be > 1.
[中]使用镜像越界策略扩展可随机访问的范围。边界像素不会重复。请注意,这要求震源(F震源)的所有维度都必须大于1。

代码示例

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

public void setImg( final RandomAccessibleInterval< R > img )
{
  this.img = Views.extendMirrorSingle( img );
  this.imgInterval = img;
  this.fftImg = null;
}

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

public void setImg( final RandomAccessibleInterval< R > img )
{
  this.img = Views.extendMirrorSingle( img );
  this.imgInterval = img;
  this.fftImg = null;
}

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

@Override
  public ExtendedRandomAccessibleInterval<T, F> calculate(F input) {
    return Views.extendMirrorSingle(input);
  }
}

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

public void setImg( final RandomAccessibleInterval< R > img )
{
  this.img = Views.extendMirrorSingle( img );
  this.imgInterval = img;
  this.fftImg = null;
}

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

public ExtendMirrorSingle(final RandomAccessibleInterval<T> img) {
  super(Views.interval(Views.extendMirrorSingle(img), img));
}

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

public static enum ExtremaType
{
  /**
   * Bright blobs on dark background.
   */
  MINIMA,
  /**
   * Dark blobs on bright background.
   */
  MAXIMA
}

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

/**
 * Expand a RandomAccessibleInterval as specified by border. Out of bounds
 * pixels will be sampled by mirroring source. Boundary pixels are not
 * repeated. Note that this requires that all dimensions of the source (F
 * source) must be &gt; 1.
 *
 * @param source
 *            the interval to expand.
 * @return Expansion of the {@link RandomAccessibleInterval} source as
 *         specified by border.
 */
public static < T > IntervalView< T > expandMirrorSingle( final RandomAccessibleInterval< T > source, final long... border )
{
  return interval( extendMirrorSingle( source ), Intervals.expand( source, border ) );
}

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

/**
 * Expand a RandomAccessibleInterval as specified by border. Out of bounds
 * pixels will be sampled by mirroring source. Boundary pixels are not
 * repeated. Note that this requires that all dimensions of the source (F
 * source) must be &gt; 1.
 *
 * @param source
 *            the interval to expand.
 * @return Expansion of the {@link RandomAccessibleInterval} source as
 *         specified by border.
 */
public static < T > IntervalView< T > expandMirrorSingle( final RandomAccessibleInterval< T > source, final long... border )
{
  return interval( extendMirrorSingle( source ), Intervals.expand( source, border ) );
}

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

public static double[] computeCenter( final Img< FloatType > i, final double threshold ) throws IncompatibleTypeException
{
  final Img<FloatType> copy = i.copy();
  Gauss3.gauss( 2, Views.extendMirrorSingle( copy ), copy );
  
  return centerofmass( copy, threshold );
}

代码示例来源:origin: fiji/Stitching

public ImageInterpolation( final Img< T > image, final InterpolatorFactory< T, RandomAccessible< T > > interpolatorFactory, final boolean mirror )
{
  this.image = image;
  this.interpolatorFactory = interpolatorFactory;
  if ( mirror )
    this.interpolated = Views.interpolate( Views.extendMirrorSingle( image ), interpolatorFactory );
  else
    this.interpolated = Views.interpolate( Views.extendZero( image ), interpolatorFactory );
}

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

/**
 * Compute a Fourier space based convolution 
 * The image will be extended by mirroring with single boundary, the kernel will be zero-padded.
 * 
 * @param img - the image
 * @param kernel - the convolution kernel
 * @param output - the output
 * @param factory - the {@link ImgFactory} to create the fourier transforms
 */
public FFTConvolution( final RandomAccessibleInterval< R > img, final RandomAccessibleInterval< R > kernel, final RandomAccessibleInterval< R > output, final ImgFactory< ComplexFloatType > factory )
{
  this ( Views.extendMirrorSingle( img ), img, Views.extendValue( kernel, Util.getTypeFromInterval( kernel ).createVariable() ), kernel, output, factory );
}

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

/**
 * Compute a Fourier space based convolution The image will be extended by
 * mirroring with single boundary, the kernel will be zero-padded.
 * 
 * @param img
 *            - the image
 * @param kernel
 *            - the convolution kernel
 * @param output
 *            - the output
 * @param factory
 *            - the {@link ImgFactory} to create the fourier transforms
 * @param service
 *            - service providing threads for multi-threading
 */
public FFTConvolution( final RandomAccessibleInterval< R > img, final RandomAccessibleInterval< R > kernel, final RandomAccessibleInterval< R > output, final ImgFactory< ComplexFloatType > factory, final ExecutorService service )
{
  this( Views.extendMirrorSingle( img ), img, Views.extendValue( kernel, Util.getTypeFromInterval( kernel ).createVariable() ), kernel, output, factory, service );
}

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

public static Img< FloatType > extractLI( final Img< FloatType > img, final long[] dim, final double[] center )
{
  final Img< FloatType > psf = new ArrayImgFactory< FloatType >().create( dim, new FloatType() );
  final ArrayList< RealLocalizable > locations = new ArrayList<>();
  locations.add( new RealPoint( center ) );
  //locations.add( new RealPoint( new double[] { i.dimension( 0 ) / 2, i.dimension( 1 ) / 2, i.dimension( 2 ) / 2 } ) );
  final RealRandomAccessible< FloatType > rra = Views.interpolate( Views.extendMirrorSingle( img ), new NLinearInterpolatorFactory<>() ); 
  PSFExtraction.extractPSFLocal( rra, locations, psf );
  return psf;
}

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

public static Img< FloatType > extractNN( final Img< FloatType > img, final long[] dim, final double[] center )
{
  final Img< FloatType > psf = new ArrayImgFactory< FloatType >().create( dim, new FloatType() );
  final ArrayList< RealLocalizable > locations = new ArrayList<>();
  locations.add( new RealPoint( center ) );
  //locations.add( new RealPoint( new double[] { i.dimension( 0 ) / 2, i.dimension( 1 ) / 2, i.dimension( 2 ) / 2 } ) );
  final RealRandomAccessible< FloatType > rra = Views.interpolate( Views.extendMirrorSingle( img ), new NearestNeighborInterpolatorFactory<>());
  PSFExtraction.extractPSFLocal( rra, locations, psf );
  return psf;
}

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

@Override
public RandomAccessibleInterval<T> calculate(RandomAccessibleInterval<T> input) {
  final long[] newDims = Intervals.dimensionsAsLongArray(in());
  for (int i = 0; i < Math.min(scaleFactors.length, in().numDimensions()); i++) {
    newDims[i] = Math.round(in().dimension(i) * scaleFactors[i]);
  }
  IntervalView<T> interval = Views.interval(Views.raster(RealViews.affineReal(
    Views.interpolate(Views.extendMirrorSingle(input), interpolator),
    new Scale(scaleFactors))), new FinalInterval(newDims));
  return interval;
}

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

/**
 * @see MaxFilterOp
 * @see DefaultMaxFilter
 */
@Test
public void testMaxFilter() {
  ops.run(MaxFilterOp.class, out, in, shape, oobFactory);
  byte max = Byte.MIN_VALUE;
  NeighborhoodsIterableInterval<ByteType> neighborhoods =
    shape.neighborhoods(Views.interval(Views.extendMirrorSingle(in), in));
  for (ByteType t : neighborhoods.firstElement()) {
    max = (byte) Math.max(t.getInteger(), max);
  }
  assertEquals(out.firstElement().get(), max);
}

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

/**
 * @see MinFilterOp
 * @see DefaultMinFilter
 */
@Test
public void testMinFilter() {
  ops.run(MinFilterOp.class, out, in, shape, oobFactory);
  byte min = Byte.MAX_VALUE;
  NeighborhoodsIterableInterval<ByteType> neighborhoods =
    shape.neighborhoods(Views.interval(Views.extendMirrorSingle(in), in));
  for (ByteType t : neighborhoods.firstElement()) {
    min = (byte) Math.min(t.getInteger(), min);
  }
  assertEquals(min, out.firstElement().get());
}

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

/**
 * @see MeanFilterOp
 * @see DefaultMeanFilter
 */
@Test
public void testMeanFilter() {
  ops.run(MeanFilterOp.class, out, in, shape, oobFactory);
  double sum = 0.0;
  NeighborhoodsIterableInterval<ByteType> neighborhoods =
    shape.neighborhoods(Views.interval(Views.extendMirrorSingle(in), in));
  for (ByteType t : neighborhoods.firstElement()) {
    sum += t.getRealDouble();
  }
  assertEquals(Util.round(sum / 9.0), out.firstElement().get());
}

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

/**
 * @see VarianceFilterOp
 * @see DefaultVarianceFilter
 */
@Test
public void testVarianceFilter() {
  ops.run(VarianceFilterOp.class, out, in, shape, oobFactory);
  double sum = 0.0;
  double sumSq = 0.0;
  NeighborhoodsIterableInterval<ByteType> neighborhoods =
    shape.neighborhoods(Views.interval(Views.extendMirrorSingle(in), in));
  for (ByteType t : neighborhoods.firstElement()) {
    sum += t.getRealDouble();
    sumSq += t.getRealDouble()*t.getRealDouble();
  }
  assertEquals((byte)Util.round((sumSq - (sum * sum / 9)) / 8), out.firstElement().get());
}

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

@Test
public void extendMirrorSingleTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
  OutOfBounds<DoubleType> il2 = Views.extendMirrorSingle(img).randomAccess();
  OutOfBounds<DoubleType> opr = ops.transform().extendMirrorSingleView(img).randomAccess();
  il2.setPosition(new int[] { -1, -1 });
  opr.setPosition(new int[] { -1, -1 });
  assertEquals(il2.get().get(), opr.get().get(), 1e-10);
  il2.setPosition(new int[] { 11, 11 });
  opr.setPosition(new int[] { 11, 11 });
  assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}

相关文章