[Insight-users] I have a problem With FFT in ITK

vahid taimouri v_taimouri at yahoo.com
Tue Jul 18 10:53:26 EDT 2006


Hi all
  I tried to use FFT to build an ideal lowpass filter
  But I think FFT doesn't work correctly,
  Also I applied the FFT to an image and then the inverse FFT to its result
  But surprisingly it didn't retrieve my image!!!
   
  I added my codes here, please guild to solve this problem
  Thanks
   
   void main()
  {  
 char InputImageName[30] = "Inputimage.bmp";
 char OutputImageName[30] = "OutputImage.bmp";
   
   typedef itk::Image< unsigned char, 2 > InputImageType;
 typedef itk::Image< unsigned char, 2 > OutputImageType;
   
   typedef itk::Image< float, 2 > InputFilterType;
 typedef itk::Image< float, 2 > OutputFilterType;
   
   typedef itk::ImageFileReader< InputImageType > ReaderType;
 typedef itk::RescaleIntensityImageFilter<InputImageType, InputFilterType > RescaleFilterType;
   typedef itk::VnlFFTRealToComplexConjugateImageFilter< float, 2 > FFTFilterType;
 typedef itk::VnlFFTComplexConjugateToRealImageFilter< float, 2 > IFFTFilterType;
 typedef itk::RescaleIntensityImageFilter<InputFilterType, OutputImageType > RescaleFilterType;
   typedef itk::ImageFileWriter< OutputImageType > WriterType;
   ReaderType::Pointer reader = ReaderType::New();
 InputRescaleFilterType::Pointer inputintensityrescaler = InputRescaleFilterType::New();
 FFTFilterType::Pointer fftFilter = FFTFilterType::New(); 
 IFFTFilterType::Pointer fftInverseFilter = IFFTFilterType::New();
 OutputRescaleFilterType::Pointer outputintensityrescaler = OutputRescaleFilterType::New();
 WriterType::Pointer writer = WriterType::New();
   
   Inputintensityrescaler->SetOutputMinimum(  0  );
 Inputintensityrescaler->SetOutputMaximum( 255 );
 
 Outputintensityrescaler->SetOutputMinimum(  0  );
 Outputintensityrescaler->SetOutputMaximum( 255 );
   
   reader->SetFileName( InputImageName );
 writer->SetFileName( OutputImageName );
 reader->Update();
   
   inputintensityrescaler->SetInput( reader->GetOutput() );
 fftFilter->SetInput( inputintensityrescaler->GetOutput() );
 fftFilter->Update();
   
   fftInverseFilter->SetInput( fftFilter->GetOutput() );
   
   typedef itk::FlipImageFilter< InputFilterType > FlipperType;
   FlipperType::Pointer flipper = FlipperType::New();
   bool fliparray[2] = {true,true};
   FlipperType::FlipAxesArrayType flipAxes( fliparray );
   flipper->SetFlipAxes(flipAxes);
   flipper->SetInput(fftInverseFilter->GetOutput());
  
 
   Outputintensityrescaler->SetInput( flipper->GetOutput() );
  
 writer->SetInput(Outputintensityrescaler->GetOutput());
 writer->Update();
}

 		
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060718/a0f8c251/attachment-0001.html


More information about the Insight-users mailing list