[Insight-users] FFTImageFilter

Ming Chao mingchao2005 at gmail.com
Wed Aug 4 15:11:54 EDT 2010


I checked the complex image FFT created from the input image was fine. Also
I checked the real and imaginary parts in floating point format,
respectively. They both are fine. The problem started to happen when
rescaling the real/imaginary image into an interger-type image. Here is part
of the rescaling code:

  typedef unsigned char WritePixelType;
  typedef itk::Image< WritePixelType, Dimension > WriteImageType;

  typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType >
RescaleFilterType;

  RescaleFilterType::Pointer intensityRescaler = RescaleFilterType::New();
  intensityRescaler->SetOutputMinimum(  0  );
  intensityRescaler->SetOutputMaximum( 255 );

  intensityRescaler->SetInput( realFilter->GetOutput() );

  typedef itk::ImageFileWriter< WriteImageType > WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetFileName( argv[2] );
  writer->SetInput( intensityRescaler->GetOutput() );

  try
    {
writer->Update();
    }
  catch( itk::ExceptionObject & excp )
    {
std::cerr << "Error writing the real image: " << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
    }

  typedef itk::ImageRegionConstIterator< WriteImageType > ConstIteratorType;
  WriteImageType::Pointer RealImage = intensityRescaler->GetOutput();
  ConstIteratorType in( RealImage, RealImage->GetRequestedRegion() );

  for ( in.GoToBegin(); !in.IsAtEnd(); ++in )
  {
  std::cout << in.Get() << std::endl;
  }




More information about the Insight-users mailing list