本文整理了Java中net.imglib2.util.Util.getTypeFromInterval()
方法的一些代码示例,展示了Util.getTypeFromInterval()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getTypeFromInterval()
方法的具体详情如下:
包路径:net.imglib2.util.Util
类名称:Util
方法名:getTypeFromInterval
[英]Gets an instance of T from the RandomAccessibleInterval by querying the value at the min coordinate
[中]通过查询最小坐标处的值,从RandomAccessibleInterval获取T的实例
代码示例来源:origin: net.imagej/imagej-common
private <T> ImgFactory<T> imgFactory(
final RandomAccessibleInterval<T> rai)
{
final T type = Util.getTypeFromInterval(rai);
return Util.getSuitableImgFactory(rai, type);
}
}
代码示例来源:origin: scijava/scijava-jupyter-kernel
private <T extends RealType<T>> boolean isNarrowType(
final RandomAccessibleInterval<T> source) {
return Util.getTypeFromInterval(source).getBitsPerPixel() <= 8;
}
}
代码示例来源:origin: net.imglib2/imglib2-ij
public ImageJVirtualStackUnsignedShort( RandomAccessibleInterval< S > source, Converter< S, UnsignedShortType > converter )
{
super( source, converter, new UnsignedShortType(), ImagePlus.GRAY16 );
int maxDisplay = (1 << 16) - 1;
final S s = Util.getTypeFromInterval( source );
if ( BitType.class.isInstance( s ) )
maxDisplay = 1;
else if ( Unsigned12BitType.class.isInstance( s ) )
maxDisplay = 4095;
imageProcessor.setMinAndMax( 0, maxDisplay );
}
}
代码示例来源:origin: net.imagej/imagej-common
public static boolean isBoolType(final RandomAccessible<?> ra) {
if (ra instanceof Interval) return Util.getTypeFromInterval(
(RandomAccessibleInterval<?>) ra) instanceof BoolType;
return ra.randomAccess().get() instanceof BoolType;
}
代码示例来源: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: imagej/imagej-ops
@SuppressWarnings("unchecked")
@Override
public RandomAccessibleInterval<RealType<?>> createOutput(
final RandomAccessibleInterval<I> input)
{
// Create integral image
if (Util.getTypeFromInterval(input) instanceof IntegerType) {
return createLongRAI.calculate(input);
}
return createDoubleRAI.calculate(input);
}
代码示例来源:origin: imglib/imglib2
/**
* Randomizes the content of the given image.
* @return Reference to the given image
*/
public < I extends RandomAccessibleInterval< T >, T >
I randomize( final I image )
{
final T type = Util.getTypeFromInterval( image );
Views.iterable( image ).forEach( randomSetter( type ) );
return image;
}
代码示例来源:origin: net.imglib2/imglib2
/**
* Randomizes the content of the given image.
* @return Reference to the given image
*/
public < I extends RandomAccessibleInterval< T >, T >
I randomize( final I image )
{
final T type = Util.getTypeFromInterval( image );
Views.iterable( image ).forEach( randomSetter( type ) );
return image;
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
private static < T extends NumericType< T > > void convolveNumericType( final double[][] halfkernels,
final RandomAccessible< T > source, final RandomAccessibleInterval< T > target, final ExecutorService service )
{
final T type = Util.getTypeFromInterval( target );
final ConvolverFactory< T, T > convfac = ConvolverNumericType.factory( type );
convolve( halfkernels, source, target, convfac, convfac, convfac, convfac, new ListImgFactory<>( type ), service );
}
代码示例来源:origin: net.imglib2/imglib2-algorithms
private static < T extends NumericType< T > > void convolveNumericType( final double[][] halfkernels,
final RandomAccessible< T > source, final RandomAccessibleInterval< T > target, final int numThreads )
{
final T type = Util.getTypeFromInterval( target );
final ConvolverFactory< T, T > convfac = ConvolverNumericType.factory( type );
convolve( halfkernels, source, target, convfac, convfac, convfac, convfac, new ListImgFactory< T >(), type, numThreads );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
@SuppressWarnings( "unchecked" )
public DogComputationType(
final RandomAccessible< ? > input,
final Interval interval )
{
final Object t = Util.getTypeFromInterval( Views.interval( input, interval ) );
if ( t instanceof DoubleType )
type = ( F ) new DoubleType();
else
type = ( F ) new FloatType();
}
代码示例来源: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-algorithm
private static < T extends NumericType< T > & NativeType< T > > void convolveNativeType( final double[][] halfkernels,
final RandomAccessible< T > source, final RandomAccessibleInterval< T > target, final ExecutorService service )
{
final T type = Util.getTypeFromInterval( target );
final ConvolverFactory< T, T > convfac;
if ( canUseBufferedConvolver( target, halfkernels ) )
convfac = ConvolverNativeTypeBuffered.factory( type );
else
convfac = ConvolverNativeType.factory( type );
final ImgFactory< T > imgfac = getImgFactory( target, halfkernels, type );
convolve( halfkernels, source, target, convfac, convfac, convfac, convfac, imgfac, service );
}
代码示例来源:origin: net.imglib2/imglib2-algorithms
private static < T extends NumericType< T > & NativeType< T > > void convolveNativeType( final double[][] halfkernels,
final RandomAccessible< T > source, final RandomAccessibleInterval< T > target, final int numThreads )
{
final T type = Util.getTypeFromInterval( target );
final ConvolverFactory< T, T > convfac;
if ( canUseBufferedConvolver( target, halfkernels ) )
convfac = ConvolverNativeTypeBuffered.factory( type );
else
convfac = ConvolverNativeType.factory( type );
final ImgFactory< T > imgfac = getImgFactory( target, halfkernels, type );
convolve( halfkernels, source, target, convfac, convfac, convfac, convfac, imgfac, type, numThreads );
}
代码示例来源:origin: imagej/imagej-ops
@Override
@SuppressWarnings("unchecked")
public O calculate(final I input) {
if (obf == null) {
obf = new OutOfBoundsConstantValueFactory<>(
Util.getTypeFromInterval(input).createVariable());
}
Interval inputInterval = paddingIntervalCentered.calculate(input,
paddedDimensions);
return (O) Views.interval(Views.extend(input, obf), inputInterval);
}
}
代码示例来源:origin: imagej/imagej-ops
@SuppressWarnings("unchecked")
@Override
public void initialize() {
stdOp = Functions.unary(ops(), Ops.Stats.StdDev.class, RealType.class,
Iterable.class);
histOp = Functions.unary(ops(), HistogramCreate.class, Histogram1d.class,
Iterable.class, histogramSize);
imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
Img.class, in(), Util.getTypeFromInterval(in()));
}
代码示例来源:origin: imagej/imagej-ops
@Override
public void initialize() {
closeComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Close.class, out(),
in1(), in2());
if (out() == null) setOutput(createOutput());
final T type = Util.getTypeFromInterval(in1());
subtractor = Inplaces.binary1(ops(), Ops.Map.class, out(), in(), Inplaces
.binary1(ops(), Ops.Math.Subtract.class, type, type));
}
代码示例来源:origin: imagej/imagej-ops
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
minVal = Util.getTypeFromInterval(in()).createVariable();
minVal.setReal(minVal.getMinValue());
imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
Img.class, in(), minVal.createVariable());
erodeComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Erode.class, out(),
in1(), in2(), false);
dilateComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Dilate.class, out(),
in1(), in2(), false);
}
内容来源于网络,如有侵权,请联系作者删除!