ImageDev

FftSpatialFilter3d

This module filters a 3d image using its FFT magnitude. @BR It is useful for removing periodic noise from an image because periodic objects can be easily extracted in frequency space.

Access to parameter description

The steps of the FFT Filter algorithm are:

The input is copied into a square image. The FFT magnitude will also be a square.
The FFT of the squared input is computed.
The filter is applied on the FFT magnitude.
If needed, the inverse FFT is computed from the filtered FFT magnitude and the original FFT phase.
The result is output with its original size.

Two types of filter are available:
The Periodic Structure Filter: removes periodic structures based on their size.
The Stripe Filter: removes stripes, for example, curtaining effects.

Periodic Structure Filter


Let's consider Figure 1. We want to remove the noise in this image. This noise can be considered a periodic structure, which can be removed using the Periodic Structure Filter.
Figure 1: A noisy image
Figure 1: A noisy image


If we choose to remove the structures sized between 4 and 10 pixels, Figure 2 shows the result of the FFT Filter.
Figure 2: The result of the Periodic Filter: (1) Remove - (2) Keep (the noise is isolated)
Figure 2: The result of the Periodic Filter: (1) Remove - (2) Keep (the noise is isolated)

Remove Stripes


The noise in Figure 1 can also be considered as stripes. The angle of the stripes is about 50 degrees. The result of the FFT Filter is given in Figure 3.
Figure 3: A noisy image
Figure 3: A noisy image

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > fftSpatialFilter3d( std::shared_ptr< iolink::ImageView > inputImage, bool removeStructures, const iolink::Vector2d& structureSize, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
fft_spatial_filter_3d(input_image: idt.ImageType,
                      remove_structures: bool = True,
                      structure_size: Union[Iterable[int], Iterable[float]] = [1, 50],
                      output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
FftSpatialFilter3d( IOLink.ImageView inputImage,
                    bool removeStructures = true,
                    double[] structureSize = null,
                    IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Grayscale or Multispectral nullptr
input
removeStructures
If true, only the structures with a size between the values given by Structure Size parameter will be removed.
If false, only the structures with a size between the values given by Structure Size parameter will be kept.
Bool true
input
structureSize
Specify the structure size values for the periodic filter. Vector2d >=0.1 {1.f, 50.f}
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 Grayscale or Multispectral None
input
remove_structures
If true, only the structures with a size between the values given by Structure Size parameter will be removed.
If false, only the structures with a size between the values given by Structure Size parameter will be kept.
bool True
input
structure_size
Specify the structure size values for the periodic filter. vector2d >=0.1 [1, 50]
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 Grayscale or Multispectral null
input
removeStructures
If true, only the structures with a size between the values given by Structure Size parameter will be removed.
If false, only the structures with a size between the values given by Structure Size parameter will be kept.
Bool true
input
structureSize
Specify the structure size values for the periodic filter. Vector2d >=0.1 {1f, 50f}
output
outputImage
The output image. The output image characteristics are forced to the same as the input image. Image null

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

FftSpatialFilter3d fftSpatialFilter3dAlgo;
fftSpatialFilter3dAlgo.setInputImage( foam );
fftSpatialFilter3dAlgo.setRemoveStructures( true );
fftSpatialFilter3dAlgo.setStructureSize( {1, 50} );
fftSpatialFilter3dAlgo.execute();

std::cout << "outputImage:" << fftSpatialFilter3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

fft_spatial_filter_3d_algo = imagedev.FftSpatialFilter3d()
fft_spatial_filter_3d_algo.input_image = foam
fft_spatial_filter_3d_algo.remove_structures = True
fft_spatial_filter_3d_algo.structure_size = [1, 50]
fft_spatial_filter_3d_algo.execute()

print("output_image:", str(fft_spatial_filter_3d_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

FftSpatialFilter3d fftSpatialFilter3dAlgo = new FftSpatialFilter3d
{
    inputImage = foam,
    removeStructures = true,
    structureSize = new double[]{1, 50}
};
fftSpatialFilter3dAlgo.Execute();

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

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = fftSpatialFilter3d( foam, true, {1, 50} );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.fft_spatial_filter_3d(foam, True, [1, 50])

print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.FftSpatialFilter3d( foam, true, new double[]{1, 50} );

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



© 2026 Thermo Fisher Scientific Inc. All rights reserved.