FrequencyFilterMask example for C++ 5.0 and later

int MaxXHarmonic,MaxYHarmonic;

ILEADRasterProcess* m_pRasterProc= NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&m_pRasterProc);

ILEADRaster* m_pNoisyRaster= NULL;
CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&m_pNoisyRaster);

ILEADRaster* m_pMaskRaster= NULL;
CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&m_pMaskRaster);

ILEADRasterIO* m_pRasterIO= NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&m_pRasterIO);


MaxXHarmonic = m_LeadRasterView.GetRaster().GetBitmapWidth() / 4;
MaxYHarmonic = m_LeadRasterView.GetRaster().GetBitmapHeight()/ 2;

m_pRasterProc->InitFourierTransformation(m_LeadRasterView.GetRaster());
m_pRasterIO->Load(m_pNoisyRaster, "c:\\NoisyXRay.CMP", 0, 0, 1);

/* Load the mask bitmap, keeping the bits per pixel of the file*/
m_pRasterIO->Load (m_pMaskRaster, "c:\\NoisyMask.CMP", 0, 0, 1);

m_pRasterProc->DiscreteFourierTransformation(m_pNoisyRaster, 
                                          0, 
                                          0, 
                                          0, 
                                          0, 
                                          DFT_DFT |
                                          DFT_GRAY);

/* filter frequencies*/
m_pRasterProc->FrequencyFilterMask(m_pMaskRaster, true);

/* apply inverse DFT
 After this call, the image should be clean*/
m_pRasterProc->DiscreteFourierTransformation(m_pNoisyRaster, 
                                          0, 
                                          0, 
                                          0, 
                                          0, 
                                          DFT_IDFT |
                                          DFT_ALL |
                                          DFT_IDFT_SCL);
m_pRasterProc->FreeFourierTransformation();

m_pMaskRaster->Release();
m_pNoisyRaster->Release();
m_pRasterIO->Release();
m_pRasterProc->Release();