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

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

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

Views.extendBorder介绍

[英]Extend a RandomAccessibleInterval with an out-of-bounds strategy to repeat border pixels.
[中]使用越界策略扩展随机可访问的Interval,以重复边界像素。

代码示例

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

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

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

public static <T> RandomAccessible<T> deinterval(
  RandomAccessibleInterval<T> input)
{
  return Views.extendBorder(input);
}

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

/**
 * Expand a RandomAccessibleInterval as specified by border. source will be
 * extended with the border value.
 *
 * @param source
 *            the interval to expand.
 * @return Expansion of the {@link RandomAccessibleInterval} source as
 *         specified by border.
 */
public static < T > IntervalView< T > expandBorder( final RandomAccessibleInterval< T > source, final long... border )
{
  return interval( extendBorder( source ), Intervals.expand( source, border ) );
}

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

/**
 * Expand a RandomAccessibleInterval as specified by border. source will be
 * extended with the border value.
 *
 * @param source
 *            the interval to expand.
 * @return Expansion of the {@link RandomAccessibleInterval} source as
 *         specified by border.
 */
public static < T > IntervalView< T > expandBorder( final RandomAccessibleInterval< T > source, final long... border )
{
  return interval( extendBorder( source ), Intervals.expand( source, border ) );
}

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

private RandomAccessible<BitType> constantImg(final int numDims) {
  final long[] dims = new long[numDims];
  Arrays.fill(dims, 1);
  final ArrayImg<BitType, LongArray> bitImg = ArrayImgs.bits(dims);
  bitImg.setLinkedType(new BitType(bitImg));
  bitImg.cursor().next().set(true);
  return Views.extendBorder(bitImg);
}

代码示例来源:origin: sc.fiji/TrakEM2_

public LinearIntensityMap( final RandomAccessibleInterval< T > source, final InterpolatorFactory< RealComposite< T >, RandomAccessible< RealComposite< T > > > interpolatorFactory )
{
  this.interpolatorFactory = interpolatorFactory;
  final CompositeIntervalView< T, RealComposite< T > > collapsedSource = Views.collapseReal( source );
  dimensions = new FinalInterval( collapsedSource );
  final double[] shift = new double[ dimensions.numDimensions() ];
  for ( int d = 0; d < shift.length; ++d )
    shift[ d ] = 0.5;
  translation = new Translation( shift );
  final RandomAccessible< RealComposite< T > > extendedCollapsedSource = Views.extendBorder( collapsedSource );
  coefficients = Views.interpolate( extendedCollapsedSource, interpolatorFactory );
}

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

/**
 * Removes leading 0s from integral image after composite creation.
 *
 * @param input Input RAI (can be a RAI of Composite)
 * @return An extended and cropped version of input
 */
private <T> RandomAccessibleInterval<T> removeLeadingZeros(
  final RandomAccessibleInterval<T> input)
{
  // Remove 0s from integralImg by shifting its interval by +1
  final long[] min = Intervals.minAsLongArray(input);
  final long[] max = Intervals.maxAsLongArray(input);
  for (int d = 0; d < input.numDimensions(); ++d) {
    int correctedSpan = getShape().getSpan() - 1;
    min[d] += (1 + correctedSpan);
    max[d] -= correctedSpan;
  }
  // Define the Interval on the infinite random accessibles
  final FinalInterval interval = new FinalInterval(min, max);
  final RandomAccessibleInterval<T> extendedImg = Views.offsetInterval(Views
    .extendBorder(input), interval);
  return extendedImg;
}

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

public static final ImagePlus makeEmptyImagePlus(final int width, final int height, final int nslices, final int nframes, final double[] calibration) {
  final RandomAccessible< UnsignedByteType > randomAccessible = Views.extendBorder( ArrayImgs.unsignedBytes( new long[] { 1, 1, 1, 1 } ) );
  final Interval interval = new FinalInterval( width, height, nslices, nframes );
  final RandomAccessibleInterval< UnsignedByteType > view = Views.interval( randomAccessible, interval );
  final ImagePlus imp = ImageJFunctions.wrap(view, "blank");
  imp.getCalibration().pixelWidth = calibration[0];
  imp.getCalibration().pixelHeight = calibration[1];
  imp.getCalibration().pixelDepth = calibration[2];
  imp.setDimensions(1, nslices, nframes);
  imp.setOpenAsHyperStack(true);
  return imp;
}

代码示例来源:origin: sc.fiji/TrackMate_

public static final ImagePlus makeEmptyImagePlus(final int width, final int height, final int nslices, final int nframes, final double[] calibration) {
  final RandomAccessible< UnsignedByteType > randomAccessible = Views.extendBorder( ArrayImgs.unsignedBytes( new long[] { 1, 1, 1, 1 } ) );
  final Interval interval = new FinalInterval( width, height, nslices, nframes );
  final RandomAccessibleInterval< UnsignedByteType > view = Views.interval( randomAccessible, interval );
  final ImagePlus imp = ImageJFunctions.wrap(view, "blank");
  imp.getCalibration().pixelWidth = calibration[0];
  imp.getCalibration().pixelHeight = calibration[1];
  imp.getCalibration().pixelDepth = calibration[2];
  imp.setDimensions(1, nslices, nframes);
  imp.setOpenAsHyperStack(true);
  return imp;
}

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

static class LoopBackImageLoader extends Hdf5ImageLoader
{
  private LoopBackImageLoader( final IHDF5Reader existingHdf5Reader, final AbstractSequenceDescription< ?, ?, ? > sequenceDescription )
  {
    super( null, existingHdf5Reader, null, sequenceDescription, false );
  }
  static LoopBackImageLoader create( final IHDF5Reader existingHdf5Reader, final int timepointIdPartition, final int setupIdPartition, final Dimensions imageDimensions )
  {
    final HashMap< Integer, TimePoint > timepoints = new HashMap<>();
    timepoints.put( timepointIdPartition, new TimePoint( timepointIdPartition ) );
    final HashMap< Integer, BasicViewSetup > setups = new HashMap<>();
    setups.put( setupIdPartition, new BasicViewSetup( setupIdPartition, null, imageDimensions, null ) );
    final SequenceDescriptionMinimal seq = new SequenceDescriptionMinimal( new TimePoints( timepoints ), setups, null, null );
    return new LoopBackImageLoader( existingHdf5Reader, seq );
  }
}

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

return new FlatFieldCorrectedRandomAccessibleInterval<>(outputType, sourceImg, Views.interval( constantBright, sourceImg ), Views.interval( Views.extendBorder( darkImg ), intervalDark ) );
  return new FlatFieldCorrectedRandomAccessibleInterval<>(outputType, sourceImg, Views.interval( Views.extendBorder( brightImg ), intervalBright ), Views.interval( constantDark, sourceImg ) );
return new FlatFieldCorrectedRandomAccessibleInterval<>(outputType, sourceImg, Views.interval( Views.extendBorder( brightImg ), intervalBright ), Views.interval( Views.extendBorder( darkImg ), intervalDark ) );

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

/**
 * {@link RandomAccessibleInterval} with same sice as target is returned
 * 
 * @param src
 *            {@link RandomAccessibleInterval} to be adjusted
 * @param target
 *            {@link Interval} describing the resulting sizes
 * @return Adjusted {@link RandomAccessibleInterval}
 */
public static <T> RandomAccessibleInterval<T> synchronizeDimensionality(
    final RandomAccessibleInterval<T> src, final Interval target) {
  RandomAccessibleInterval<T> res = src;
  // Check direction of conversion
  if (intervalEquals(src, target))
    return res;
  // adjust dimensions
  if (res.numDimensions() < target.numDimensions()) {
    for (int d = res.numDimensions(); d < target.numDimensions(); d++) {
      res = Views.addDimension(res, target.min(d), target.max(d));
    }
  } else {
    for (int d = res.numDimensions() - 1; d >= target.numDimensions(); --d)
      res = Views.hyperSlice(res, d, 0);
  }
  long[] resDims = new long[res.numDimensions()];
  res.dimensions(resDims);
  return Views.interval(Views.extendBorder(res), target);
}

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

/**
 * {@link RandomAccessibleInterval} with same sice as target is returned
 * 
 * @param src
 *            {@link RandomAccessibleInterval} to be adjusted
 * @param target
 *            {@link Interval} describing the resulting sizes
 * @return Adjusted {@link RandomAccessibleInterval}
 */
public static <T> RandomAccessibleInterval<T> synchronizeDimensionality(
    final RandomAccessibleInterval<T> src, final Interval target) {
  RandomAccessibleInterval<T> res = src;
  // Check direction of conversion
  if (intervalEquals(src, target))
    return res;
  // adjust dimensions
  if (res.numDimensions() < target.numDimensions()) {
    for (int d = res.numDimensions(); d < target.numDimensions(); d++) {
      res = Views.addDimension(res, target.min(d), target.max(d));
    }
  } else {
    for (int d = res.numDimensions() - 1; d >= target.numDimensions(); --d)
      res = Views.hyperSlice(res, d, 0);
  }
  long[] resDims = new long[res.numDimensions()];
  res.dimensions(resDims);
  return Views.interval(Views.extendBorder(res), target);
}

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

final RandomAccessible<BitType> ra1 = Views.extendBorder(buffer);
final RandomAccessible<BitType> ra2 = Views.extendBorder(output);
RandomAccessible<BitType> currRa = Views.extendBorder(input);

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

HessianMatrix.calculateMatrix(Views.extendBorder(input), gaussian,
  gradient, hessian, new OutOfBoundsBorderFactory<>(), nThreads, es,
  sigma);

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

croppedSourceImg = Views.zeroMin( Views.interval( Views.extendBorder( sourceImg ), sourceInterval ) );
croppedSourceTransform.set(
  1, 0, 0, sourceInterval.min( 0 ),

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

final RandomAccess< T > randomAccess = Views.extendBorder( input ).randomAccess();

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

@Test
public void extendBorderTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
  OutOfBounds<DoubleType> il2 = Views.extendBorder(img).randomAccess();
  OutOfBounds<DoubleType> opr = ops.transform().extendBorderView(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);
}

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

Views.extendBorder(Views.interval(resRndAccessible, target)),
target);

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

Views.extendBorder(Views.interval(resRndAccessible, target)),
target);

相关文章