ImageDev

RichardsonLucyDeconvolution

Restores a microscopy image with the Richardson-Lucy deconvolution.

Access to parameter description

This command is experimental, his signature may be modified between now and his final version.

This algorithm performs a fixed number of deconvolution steps using the Richardson Lucy deconvolution method which aims to remove the blur induced by the optical system, modelized by a Point Spread Function (PSF).

The process begins with an initial estimate of the output image, which is iteratively refined. At each iteration, the algorithm compares the convolution of the current estimate with the input PSF and updates the estimate accordingly.

The convolution can be performed either with a spatial or a frequency mode. When the size of the PSF is quite small (e.g., a 9x9x9 image in 3D), the spatial mode is faster to compute. However, the frequency mode is almost invariant with the PSF size and thus can be faster with high PSF (e.g., a 51x51x51 image in 3D). In any case, the frequency mode is much more memory consuming since it requires several 32-bit intermediate images to computes Fast Fourier Transforms (FFT). The threshold PSF size for having better performances between spatial and frequency modes depends on several criteria such as the input image size, type, and the used hardware (processor speed, number of threads, available RAM). It needs to be determined empirically.

The deconvolution can be performed on spectal images but need a spectral PSF to work properly.

<b> Figure 1.</b> Spatial and frequency mode time depending on the kernel size. (Done on a 1038x1038x30 image with 10 iterations with an Intel(R) Core(TM) i7-13850HX with 28 logicals processors).
Figure 1. Spatial and frequency mode time depending on the kernel size. (Done on a 1038x1038x30 image with 10 iterations with an Intel(R) Core(TM) i7-13850HX with 28 logicals processors).


References

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > richardsonLucyDeconvolution( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputPsfImage, uint32_t numberOfIterations, RichardsonLucyDeconvolution::InitialEstimate initialEstimate, RichardsonLucyDeconvolution::FilterMode filterMode, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
richardson_lucy_deconvolution(input_image: idt.ImageType,
                              input_psf_image: idt.ImageType,
                              number_of_iterations: int = 10,
                              initial_estimate: RichardsonLucyDeconvolution.InitialEstimate = RichardsonLucyDeconvolution.InitialEstimate.CONSTANT,
                              filter_mode: RichardsonLucyDeconvolution.FilterMode = RichardsonLucyDeconvolution.FilterMode.SPATIAL,
                              output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
RichardsonLucyDeconvolution( IOLink.ImageView inputImage,
                             IOLink.ImageView inputPsfImage,
                             UInt32 numberOfIterations = 10,
                             RichardsonLucyDeconvolution.InitialEstimate initialEstimate = ImageDev.RichardsonLucyDeconvolution.InitialEstimate.CONSTANT,
                             RichardsonLucyDeconvolution.FilterMode filterMode = ImageDev.RichardsonLucyDeconvolution.FilterMode.SPATIAL,
                             IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputPsfImage
The point spread function (PSF) that models the degradation filter. The PSF is passed as an image. Image Binary, Label, Grayscale or Multispectral nullptr
input
numberOfIterations
The number of iterations performed. UInt32 [1, 1000] 10
input
initialEstimate
The initial estimate of the deconvolution algorithm. If CONSTANT is chosen, a constant image is used initially. Often, this yields smoother results than the second option, namely input data.
CONSTANT Use a constant image as the initial estimate.
INPUT_IMAGE Use the input image as the initial estimate.
Enumeration CONSTANT
input
filterMode
The algorithm implementation used to perform the convolution.
SPATIAL The computation is performed applying a classic sliding window. Using this mode can provide a faster computation time, for small kernel image size.
FREQUENCY The computation is performed by a multiplication in the Fourier domain. Using this mode provides a constant computation time, independent from the kernel image size.
Enumeration SPATIAL
output
outputImage
The output image. The output image characteristics are forced to the same as the input image. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
input
input_psf_image
The point spread function (PSF) that models the degradation filter. The PSF is passed as an image. image Binary, Label, Grayscale or Multispectral None
input
number_of_iterations
The number of iterations performed. uint32 [1, 1000] 10
input
initial_estimate
The initial estimate of the deconvolution algorithm. If CONSTANT is chosen, a constant image is used initially. Often, this yields smoother results than the second option, namely input data.
CONSTANT Use a constant image as the initial estimate.
INPUT_IMAGE Use the input image as the initial estimate.
enumeration CONSTANT
input
filter_mode
The algorithm implementation used to perform the convolution.
SPATIAL The computation is performed applying a classic sliding window. Using this mode can provide a faster computation time, for small kernel image size.
FREQUENCY The computation is performed by a multiplication in the Fourier domain. Using this mode provides a constant computation time, independent from the kernel image size.
enumeration SPATIAL
output
output_image
The output image. The output image characteristics are forced to the same as the input image. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
input
inputPsfImage
The point spread function (PSF) that models the degradation filter. The PSF is passed as an image. Image Binary, Label, Grayscale or Multispectral null
input
numberOfIterations
The number of iterations performed. UInt32 [1, 1000] 10
input
initialEstimate
The initial estimate of the deconvolution algorithm. If CONSTANT is chosen, a constant image is used initially. Often, this yields smoother results than the second option, namely input data.
CONSTANT Use a constant image as the initial estimate.
INPUT_IMAGE Use the input image as the initial estimate.
Enumeration CONSTANT
input
filterMode
The algorithm implementation used to perform the convolution.
SPATIAL The computation is performed applying a classic sliding window. Using this mode can provide a faster computation time, for small kernel image size.
FREQUENCY The computation is performed by a multiplication in the Fourier domain. Using this mode provides a constant computation time, independent from the kernel image size.
Enumeration SPATIAL
output
outputImage
The output image. The output image characteristics are forced to the same as the input image. Image null

Object Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto kernel_2d = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "kernel_2d.vip" );

RichardsonLucyDeconvolution richardsonLucyDeconvolutionAlgo;
richardsonLucyDeconvolutionAlgo.setInputImage( polystyrene );
richardsonLucyDeconvolutionAlgo.setInputPsfImage( kernel_2d );
richardsonLucyDeconvolutionAlgo.setNumberOfIterations( 5 );
richardsonLucyDeconvolutionAlgo.setInitialEstimate( RichardsonLucyDeconvolution::InitialEstimate::CONSTANT );
richardsonLucyDeconvolutionAlgo.setFilterMode( RichardsonLucyDeconvolution::FilterMode::SPATIAL );
richardsonLucyDeconvolutionAlgo.execute();

std::cout << "outputImage:" << richardsonLucyDeconvolutionAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
kernel_2d = imagedev.read_vip_image(imagedev_data.get_image_path("kernel_2d.vip"))

richardson_lucy_deconvolution_algo = imagedev.RichardsonLucyDeconvolution()
richardson_lucy_deconvolution_algo.input_image = polystyrene
richardson_lucy_deconvolution_algo.input_psf_image = kernel_2d
richardson_lucy_deconvolution_algo.number_of_iterations = 5
richardson_lucy_deconvolution_algo.initial_estimate = imagedev.RichardsonLucyDeconvolution.CONSTANT
richardson_lucy_deconvolution_algo.filter_mode = imagedev.RichardsonLucyDeconvolution.SPATIAL
richardson_lucy_deconvolution_algo.execute()

print("output_image:", str(richardson_lucy_deconvolution_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView kernel_2d = Data.ReadVipImage( @"Data/images/kernel_2d.vip" );

RichardsonLucyDeconvolution richardsonLucyDeconvolutionAlgo = new RichardsonLucyDeconvolution
{
    inputImage = polystyrene,
    inputPsfImage = kernel_2d,
    numberOfIterations = 5,
    initialEstimate = RichardsonLucyDeconvolution.InitialEstimate.CONSTANT,
    filterMode = RichardsonLucyDeconvolution.FilterMode.SPATIAL
};
richardsonLucyDeconvolutionAlgo.Execute();

Console.WriteLine( "outputImage:" + richardsonLucyDeconvolutionAlgo.outputImage.ToString() );

Function Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto kernel_2d = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "kernel_2d.vip" );

auto result = richardsonLucyDeconvolution( polystyrene, kernel_2d, 5, RichardsonLucyDeconvolution::InitialEstimate::CONSTANT, RichardsonLucyDeconvolution::FilterMode::SPATIAL );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
kernel_2d = imagedev.read_vip_image(imagedev_data.get_image_path("kernel_2d.vip"))

result = imagedev.richardson_lucy_deconvolution(polystyrene, kernel_2d, 5, imagedev.RichardsonLucyDeconvolution.CONSTANT, imagedev.RichardsonLucyDeconvolution.SPATIAL)

print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView kernel_2d = Data.ReadVipImage( @"Data/images/kernel_2d.vip" );

IOLink.ImageView result = Processing.RichardsonLucyDeconvolution( polystyrene, kernel_2d, 5, RichardsonLucyDeconvolution.InitialEstimate.CONSTANT, RichardsonLucyDeconvolution.FilterMode.SPATIAL );

Console.WriteLine( "outputImage:" + result.ToString() );





© 2025 Thermo Fisher Scientific Inc. All rights reserved.