public class Convolve extends Object
Supported types are UnsignedByteType, UnsignedShortType,
UnsignedIntType, ByteType, ShortType, IntType, LongType, FloatType, DoubleType).
For T other than DoubleType or FloatType, the input
will be converted to float/double for computation and the result converted
back to T. To avoid unnecessary conversions, if you want the result
as FloatType then you should explicitly convert to FloatType
before applying the convolve operator.
This code:
RandomAccessible< UnsignedByteType > input;
BlockSupplier< FloatType > convolved = BlockSupplier.of( input )
.andThen( Convert.convert( new FloatType() ) )
.andThen( Convolve.convolve( kernels ) );
avoids loss of precision and is more efficient than
RandomAccessible< UnsignedByteType > input;
BlockSupplier< FloatType > convolved = BlockSupplier.of( input )
.andThen( Convolve.convolve( kernels ) )
.andThen( Convert.convert( new FloatType() ) );
| Constructor and Description |
|---|
Convolve() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends net.imglib2.type.NativeType<T>> |
createOperator(T type,
ComputationType computationType,
ClampType clampType,
Kernel1D[] kernels)
Create a
UnaryBlockOperator to convolve with the given kernels. |
static <T extends net.imglib2.type.NativeType<T>> |
gauss(ComputationType computationType,
double... sigma)
Convolve blocks of the standard ImgLib2
RealTypes with a Gaussian kernel. |
static <T extends net.imglib2.type.NativeType<T>> |
gauss(double... sigma)
Convolve blocks of the standard ImgLib2
RealTypes with a Gaussian kernel. |
public static <T extends net.imglib2.type.NativeType<T>> Function<BlockSupplier<T>,UnaryBlockOperator<T,T>> gauss(double... sigma)
RealTypes with a Gaussian kernel.
Precision for intermediate values is chosen as to represent the
input/output type without loss of precision. That is, FLOAT for
u8, i8, u16, i16, i32, f32, and otherwise DOUBLE for u32, i64,
f64.
The returned factory function creates an operator matching the
type and dimensionality of a given input BlockSupplier<T>.
T - the input/output typesigma - sigmas in each dimension. if the image has fewer or more dimensions
than values given, values will be truncated or the final value
repeated as necessary.UnaryBlockOperator to convolve blocks of type Tpublic static <T extends net.imglib2.type.NativeType<T>> Function<BlockSupplier<T>,UnaryBlockOperator<T,T>> gauss(ComputationType computationType, double... sigma)
RealTypes with a Gaussian kernel.
The returned factory function creates an operator matching the
type and dimensionality of a given input BlockSupplier<T>.
T - the input/output typecomputationType - specifies in which precision intermediate values should be
computed. For AUTO, the type that can represent the
input/output type without loss of precision is picked. That is,
FLOAT for u8, i8, u16, i16, i32, f32, and otherwise DOUBLE for u32, i64, f64.sigma - sigmas in each dimension. if the image has fewer or more dimensions
than values given, values will be truncated or the final value
repeated as necessary.UnaryBlockOperator to convolve blocks of type Tpublic static <T extends net.imglib2.type.NativeType<T>> UnaryBlockOperator<T,T> createOperator(T type, ComputationType computationType, ClampType clampType, Kernel1D[] kernels)
UnaryBlockOperator to convolve with the given kernels.
kernels.length must match the dimensionality of the input images.
If kernels[d]==null, the convolution for dimension d is
skipped (equivalent to convolution with the kernel {1}).
Supported types are UnsignedByteType, UnsignedShortType,
UnsignedIntType, ByteType, ShortType, IntType, LongType, FloatType, DoubleType).
T - the input/output typetype - instance of the input typecomputationType - specifies in which precision intermediate values should be
computed. For AUTO, the type that can represent the
input/output type without loss of precision is picked. That is,
FLOAT for u8, i8, u16, i16, i32, f32, and otherwise DOUBLE for u32, i64, f64.kernels - kernel to apply in each dimensionUnaryBlockOperator to downsample blocks of type TCopyright © 2009–2025 ImgLib2. All rights reserved.