FrequencyFilterMask example for Visual Basic

Dim RasterProc As New LEADRasterProcess
Dim NoisyRaster As New LEADRaster
Dim MaskRaster As New LEADRaster
Dim RasterIO As New LEADRasterIO
Dim MaxXHarmonic As Integer
Dim MaxYHarmonic As Integer

MaxXHarmonic = LEADRasterView1.Raster.BitmapWidth / 4
MaxYHarmonic = LEADRasterView1.Raster.BitmapHeight / 2

RasterProc.InitFourierTransformation LEADRasterView1.Raster
RasterIO.Load NoisyRaster, "c:\NoisyXRay.CMP", 0, 0, 1
' Load the mask bitmap, keeping the bits per pixel of the file
RasterIO.Load MaskRaster, "c:\NoisyMask.CMP", 0, 0, 1

RasterProc.DiscreteFourierTransformation NoisyRaster, _
                                          0, _
                                          0, _
                                          0, _
                                          0, _
                                          DFT_DFT Or _
                                          DFT_GRAY

' filter frequencies
RasterProc.FrequencyFilterMask MaskRaster, True

' apply inverse DFT
' After this call, the image should be clean
RasterProc.DiscreteFourierTransformation NoisyRaster, _
                                          0, _
                                          0, _
                                          0, _
                                          0, _
                                          DFT_IDFT Or _
                                          DFT_ALL Or _
                                          DFT_IDFT_SCL
RasterProc.FreeFourierTransformation