本文整理了Java中net.imglib2.view.Views.extendValue()
方法的一些代码示例,展示了Views.extendValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Views.extendValue()
方法的具体详情如下:
包路径:net.imglib2.view.Views
类名称:Views
方法名:extendValue
[英]Extend a RandomAccessibleInterval with a constant-value out-of-bounds strategy.
[中]使用常数值越界策略扩展RandomAccessibleInterval。
代码示例来源:origin: imagej/imagej-ops
@Override
public ExtendedRandomAccessibleInterval<T, F> calculate(F input) {
return Views.extendValue(input, value);
}
代码示例来源:origin: net.imglib2/imglib2-script
/** Infinitely extend the domain of the image with {@param value}. */
public Extend(final RandomAccessibleInterval<T> img, final Number value) {
super(Views.interval(Views.extendValue(img, AlgorithmUtil.type(img, value.doubleValue())), img));
}
代码示例来源:origin: net.imglib2/imglib2-algorithms-gpl
public void setKernel( final RandomAccessibleInterval< R > kernel )
{
this.kernel = Views.extendValue( kernel, Util.getTypeFromInterval( kernel ).createVariable() );
this.kernelInterval = kernel;
this.fftKernel = null;
}
代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl
public void setKernel( final RandomAccessibleInterval< R > kernel )
{
this.kernel = Views.extendValue( kernel, Util.getTypeFromInterval( kernel ).createVariable() );
this.kernelInterval = kernel;
this.fftKernel = null;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public void setKernel( final RandomAccessibleInterval< R > kernel )
{
this.kernel = Views.extendValue( kernel, Util.getTypeFromInterval( kernel ).createVariable() );
this.kernelInterval = kernel;
this.fftKernel = null;
}
代码示例来源:origin: net.imglib2/imglib2
/**
* Expand a RandomAccessibleInterval as specified by border. source will be
* extended with a constant value specified by the caller.
*
* @param source
* the interval to expand.
* @param t
* Constant extension of source.
* @return Expansion of the {@link RandomAccessibleInterval} source as
* specified by t and border.
*/
public static < T extends Type< T > > IntervalView< T > expandValue( final RandomAccessibleInterval< T > source, final T t, final long... border )
{
return interval( extendValue( source, t ), Intervals.expand( source, border ) );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm-fft
final public static < R extends RealType< R > > Img< ComplexFloatType > realToComplex( final RandomAccessibleInterval< R > input, final ImgFactory< ComplexFloatType > factory )
{
return realToComplex( Views.extendValue( input, Util.getTypeFromInterval( input ).createVariable() ), input, factory, new ComplexFloatType(), Runtime.getRuntime().availableProcessors() );
}
代码示例来源: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: imagej/imagej-ops
@Override
public void compute(final RandomAccessibleInterval<T> in1,
final List<Shape> in2, final IterableInterval<T> out)
{
final Img<T> buffer = imgCreator.calculate(out);
dilateComputer.compute(in1, in2, buffer);
erodeComputer.compute(Views.interval(Views.extendValue(buffer, maxVal),
out), in2, out);
}
}
代码示例来源:origin: imagej/imagej-ops
@Override
public void compute(final RandomAccessibleInterval<T> in1,
final List<Shape> in2, final IterableInterval<T> out)
{
final Img<T> buffer = imgCreator.calculate(out);
erodeComputer.compute(in1, in2, buffer);
dilateComputer.compute(Views.interval(Views.extendValue(buffer, minVal),
out), in2, out);
}
}
代码示例来源:origin: imagej/imagej-ops
private ExtendedRandomAccessibleInterval<B, RandomAccessibleInterval<B>>
extendInterval(RandomAccessibleInterval<B> interval)
{
final B type = Util.getTypeFromInterval(interval).createVariable();
type.set(in2());
return Views.extendValue(interval, type);
}
代码示例来源:origin: net.imglib2/imglib2-algorithms-gpl
final public static < R extends RealType< R > > Img< ComplexFloatType > realToComplex( final RandomAccessibleInterval< R > input, final ImgFactory< ComplexFloatType > factory )
{
return realToComplex( Views.extendValue( input, Util.getTypeFromInterval( input ).createVariable() ), input, factory, new ComplexFloatType() );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm-fft
final public static < R extends RealType< R > > Img< ComplexFloatType > realToComplex( final RandomAccessibleInterval< R > input, final ImgFactory< ComplexFloatType > factory, final int numThreads )
{
return realToComplex( Views.extendValue( input, Util.getTypeFromInterval( input ).createVariable() ), input, factory, new ComplexFloatType(), numThreads );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm-fft
final public static < R extends RealType< R > > Img< ComplexFloatType > realToComplex( final RandomAccessibleInterval< R > input, final ImgFactory< ComplexFloatType > factory, final ExecutorService service )
{
return realToComplex( Views.extendValue( input, Util.getTypeFromInterval( input ).createVariable() ), input, factory, new ComplexFloatType(), service );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public Img< ComplexFloatType > getKernel1FFT()
{
if ( fftKernel1 == null )
{
if ( service == null )
throw new RuntimeException( "getKernel1FFT can only be called after calling init().");
final long[] min = new long[ kernel1.numDimensions() ];
final long[] max = new long[ kernel1.numDimensions() ];
final Pair< Interval, Interval > fftIntervals = FFTConvolution.setupFFTs( new FinalInterval( Util.int2long( blockSize ) ), kernel1, min, max );
fftKernel1 = FFTConvolution.computeKernelFFT( fftIntervals.getB(), min, max, false, Views.extendValue( kernel1, new FloatType() ), new ArrayImgFactory< ComplexFloatType >(), service );
}
return fftKernel1;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public Img< ComplexFloatType > getKernel2FFT()
{
if ( fftKernel2 == null )
{
if ( service == null )
throw new RuntimeException( "getKernel2FFT can only be called after calling init().");
final long[] min = new long[ kernel2.numDimensions() ];
final long[] max = new long[ kernel2.numDimensions() ];
final Pair< Interval, Interval > fftIntervals = FFTConvolution.setupFFTs( new FinalInterval( Util.int2long( blockSize ) ), kernel2, min, max );
fftKernel2 = FFTConvolution.computeKernelFFT( fftIntervals.getB(), min, max, false, Views.extendValue( kernel2, new FloatType() ), new ArrayImgFactory< ComplexFloatType >(), service );
}
return fftKernel2;
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
protected < T extends BooleanType< T > > Img< T > calculate( final Img< T > source )
{
final Img< T > target = source.factory().create( source );
final T extendedVal = source.firstElement().createVariable();
extendedVal.set( getExtendedValue() );
final ExtendedRandomAccessibleInterval< T, Img< T > > extended = Views.extendValue( source, extendedVal );
calculate( extended, target );
return target;
}
代码示例来源:origin: net.imglib2/imglib2-script
public <R extends RealType<R>> Paste(
final RandomAccessibleInterval<T> source,
final IterableRealInterval<R> target,
final long[] offset) throws Exception {
this.background = AlgorithmUtil.type(source, 0);
this.a = new ImageFunction<T>(new RandomAccessibleIntervalImgProxy<T>(
Views.interval(
Views.offset(Views.extendValue(source, background), offset),
new FinalInterval(Util.intervalDimensions(target)))));
this.b = new ImageFunction<R>(target);
}
代码示例来源:origin: imglib/imglib2
private static void testExtendBoolean(
final long[] dims,
final boolean insideValue,
final boolean extension ) {
final RandomAccessibleInterval< BitType > rai = ArrayImgs.bits( dims );
Views.iterable( rai ).forEach( px -> px.set( insideValue ) );
testValueExtended(
Views.extendValue( rai, extension ),
rai,
Intervals.expand( rai, 1 ),
new BitType( insideValue ),
new BitType( extension ) );
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void extendValueTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
OutOfBounds<DoubleType> il2 = Views.extendValue(img, new DoubleType(0)).randomAccess();
OutOfBounds<DoubleType> opr = ops.transform().extendValueView(img, new DoubleType(0)).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);
}
内容来源于网络,如有侵权,请联系作者删除!