ImageDev

RadialFrequencyFilter2d

Filters a two-dimensional image by applying a radial background subtraction on the Fourier transform.

Access to parameter description

This algorithm applies a radial background correction in the Fourier domain, then eliminates the high frequencies by applying a circular mask and reverts to the spatial domain. This filter is especially useful for highlighting periodic structures such as crystalline material in high-resolution electron microscope images, as shown in Figure 1.



Figure 1. Input HRTEM image and result of radial frequency filter
This algorithm: The background model can be based on different types of approximation. The model type is defined by the backgroundModel parameter.

The subtraction can be computed in different ways. The subtraction formula is defined by the filterMode parameter.

Reference:
R. Kilaas, "Optimal and near-optimal filters in high-resolution electron microscopy". Journal of Microscopy, 190, pp. 45-51, 1998.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > radialFrequencyFilter2d( std::shared_ptr< iolink::ImageView > inputImage, RadialFrequencyFilter2d::FilterMode filterMode, RadialFrequencyFilter2d::BackgroundModel backgroundModel, bool removeHighFrequencies, double cutoffFrequency, double transitionBand, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
radial_frequency_filter_2d( input_image,
                            filter_mode = RadialFrequencyFilter2d.FilterMode.DIFFERENCE,
                            background_model = RadialFrequencyFilter2d.BackgroundModel.AVERAGE,
                            remove_high_frequencies = True,
                            cutoff_frequency = 0.8,
                            transition_band = 0.05,
                            output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
RadialFrequencyFilter2d( IOLink.ImageView inputImage,
                         RadialFrequencyFilter2d.FilterMode filterMode = ImageDev.RadialFrequencyFilter2d.FilterMode.DIFFERENCE,
                         RadialFrequencyFilter2d.BackgroundModel backgroundModel = ImageDev.RadialFrequencyFilter2d.BackgroundModel.AVERAGE,
                         bool removeHighFrequencies = true,
                         double cutoffFrequency = 0.8,
                         double transitionBand = 0.05,
                         IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name RadialFrequencyFilter2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Its data type can be integer or floating point. Image Grayscale or Multispectral nullptr
input
filterMode
The way to compute the background subtraction in the Fourier domain.
DIFFERENCE The background image B is simply subtracted from the modulus of the Fourier transform |I|.
$|O|=|I|-B$, where $|O|$ is the modulus of the output image.
The negative pixel values are clamped to zero.
WIENER The square of the background image B is subtracted from the square of the modulus of the Fourier transform |I|.
The result of the subtraction is divided by the modulus of the Fourier transform:
$|O|=\frac{|I|^2-B^2}{|I|}$, where $|O|$ is the modulus of the output image.
The negative pixel values are clamped to zero.
Enumeration DIFFERENCE
input
backgroundModel
The way to estimate the background model of the Fourier transform module.
AVERAGE The background is estimated as a radial average of the Fourier transform of the whole image.
POLYNOME The background is estimated by a polynomial fit to the radial average of the Fourier transform of the whole image.
Enumeration AVERAGE
input
removeHighFrequencies
Indicates whether high frequencies outside the cut-off frequency should be removed by a circular mask. This post processing applies a low pass filter and can be useful for removing noise. Bool true
input
cutoffFrequency
Fraction of the Maximum Frequency of the image. A value of 0.5 implies that the circular mask has a diameter equal to the half width of the FFT image. This parameter is ignored if removeHighFrequencies is set to false. It must be a strictly positive value, lower than or equal to 1. Float64 ]0, 1] 0.8
input
transitionBand
Fraction of the cut-off frequency to define the width of the transition band. This parameter is ignored if removeHighFrequencies is set to false. It must be a positive or null value, lower than or equal to 1.

The transition band smoothes the border of the circular mask between [cutoffFrequency*(1 - transitionBand)] and [cutoffFrequency*(1 + transitionBand)].
Float64 [0, 1] 0.05
output
outputImage
The output image. The output image characteristics are forced to the same as the input image. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

RadialFrequencyFilter2d radialFrequencyFilter2dAlgo;
radialFrequencyFilter2dAlgo.setInputImage( polystyrene );
radialFrequencyFilter2dAlgo.setFilterMode( RadialFrequencyFilter2d::FilterMode::DIFFERENCE );
radialFrequencyFilter2dAlgo.setBackgroundModel( RadialFrequencyFilter2d::BackgroundModel::AVERAGE );
radialFrequencyFilter2dAlgo.setRemoveHighFrequencies( true );
radialFrequencyFilter2dAlgo.setCutoffFrequency( 0.8 );
radialFrequencyFilter2dAlgo.setTransitionBand( 0.05 );
radialFrequencyFilter2dAlgo.execute();

std::cout << "outputImage:" << radialFrequencyFilter2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

radial_frequency_filter_2d_algo = imagedev.RadialFrequencyFilter2d()
radial_frequency_filter_2d_algo.input_image = polystyrene
radial_frequency_filter_2d_algo.filter_mode = imagedev.RadialFrequencyFilter2d.DIFFERENCE
radial_frequency_filter_2d_algo.background_model = imagedev.RadialFrequencyFilter2d.AVERAGE
radial_frequency_filter_2d_algo.remove_high_frequencies = True
radial_frequency_filter_2d_algo.cutoff_frequency = 0.8
radial_frequency_filter_2d_algo.transition_band = 0.05
radial_frequency_filter_2d_algo.execute()

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

RadialFrequencyFilter2d radialFrequencyFilter2dAlgo = new RadialFrequencyFilter2d
{
    inputImage = polystyrene,
    filterMode = RadialFrequencyFilter2d.FilterMode.DIFFERENCE,
    backgroundModel = RadialFrequencyFilter2d.BackgroundModel.AVERAGE,
    removeHighFrequencies = true,
    cutoffFrequency = 0.8,
    transitionBand = 0.05
};
radialFrequencyFilter2dAlgo.Execute();

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

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = radialFrequencyFilter2d( polystyrene, RadialFrequencyFilter2d::FilterMode::DIFFERENCE, RadialFrequencyFilter2d::BackgroundModel::AVERAGE, true, 0.8, 0.05 );

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

result = imagedev.radial_frequency_filter_2d( polystyrene, imagedev.RadialFrequencyFilter2d.DIFFERENCE, imagedev.RadialFrequencyFilter2d.AVERAGE, True, 0.8, 0.05 )

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

IOLink.ImageView result = Processing.RadialFrequencyFilter2d( polystyrene, RadialFrequencyFilter2d.FilterMode.DIFFERENCE, RadialFrequencyFilter2d.BackgroundModel.AVERAGE, true, 0.8, 0.05 );

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