public class KernelConvolverFactory extends Object implements LineConvolverFactory<NumericType<?>>
SeparableKernelConvolution
as LineConvolverFactory
for convolution. ClassCopyProvider
is used to create copies of the
byte code of the actual convolvers. This improves their performance, as the
JIT can optimize the byte code to the individual use cases.
The actual convolvers that are used (depending on the pixel type) are:
DoubleConvolverRealType
, FloatConvolverRealType
,
ConvolverNativeType
, ConvolverNumericType
.
Constructor and Description |
---|
KernelConvolverFactory(Kernel1D kernel) |
Modifier and Type | Method and Description |
---|---|
long |
getBorderAfter()
When doing a convolution, a neighborhood of a pixel needs to be known.
|
long |
getBorderBefore()
When doing a convolution, a neighborhood of a pixel needs to be known.
|
Runnable |
getConvolver(RandomAccess<? extends NumericType<?>> in,
RandomAccess<? extends NumericType<?>> out,
int d,
long lineLength)
The
Runnable returned by this method is responsible for
convolving on line of the image. |
NumericType<?> |
preferredSourceType(NumericType<?> targetType) |
public KernelConvolverFactory(Kernel1D kernel)
public long getBorderBefore()
LineConvolverFactory
getBorderBefore
in interface LineConvolverFactory<NumericType<?>>
public long getBorderAfter()
LineConvolverFactory
getBorderAfter
in interface LineConvolverFactory<NumericType<?>>
public Runnable getConvolver(RandomAccess<? extends NumericType<?>> in, RandomAccess<? extends NumericType<?>> out, int d, long lineLength)
LineConvolverFactory
Runnable
returned by this method is responsible for
convolving on line of the image. But it will be reused. After the first
line is convolved. The RandomAccess
es are moved to the start of
the next line. And the Runnable is executed again.
LineConvolution
works with multiple threads.
LineConvolverFactory.getConvolver(net.imglib2.RandomAccess<? extends T>, net.imglib2.RandomAccess<? extends T>, int, long)
is called once per thread, and the returned
Runnable
is exclusively used in one thread.getConvolver
in interface LineConvolverFactory<NumericType<?>>
in
- RandomAccess
, that is positioned on the start of the
line of the input image.out
- RandomAccess
, that is positioned on the start of the
line of the output image.d
- Dimension in which the line should go.lineLength
- Length of the output line in pixels.Runnable
that will read a line of the input image,
convolve it, and write the result to the output image. (Input
line length should be getBorderBefore() + lineLength +
getBorderAfter())public NumericType<?> preferredSourceType(NumericType<?> targetType)
preferredSourceType
in interface LineConvolverFactory<NumericType<?>>
Copyright © 2015–2022 ImgLib2. All rights reserved.