[Insight-users] FFTImageFilter

Ming Chao mingchao2005 at gmail.com
Mon Aug 9 09:02:43 EDT 2010


Thanks very much to you all for looking into my "problem". Actually you guys
were absolutely correct that there was no "problem" with the sample code. My
"problem" was created when I tried to write the output real/imaginary part
in a binary file. Sorry for the noise.

Ming

On Mon, Aug 9, 2010 at 3:31 AM, Yu, Yang <yang.yu at philips.com> wrote:

>  I copy the code you posted and at least it works fine in my program. I
> think you should pay much attention on the realFilter part. Did you  Update
> the realFilter?
>
>
>
> *From:* insight-users-bounces at itk.org [mailto:
> insight-users-bounces at itk.org] *On Behalf Of *Ming Chao
> *Sent:* 2010 Aug 05 7:21 PM
> *To:* Markus Neuner
> *Cc:* Insight Users
> *Subject:* Re: [Insight-users] FFTImageFilter
>
>
>
> If I changed "WriteImageType" to float/double, the code stopped working b/c
> jpeg only accepts unsigned char/int.
>
> On Thu, Aug 5, 2010 at 3:30 AM, Markus Neuner <neuner.markus at gmx.net>
> wrote:
>
> I just looked at the code in the example and all seems working (at leasts
> for me).
> What do you expect as output?
> Change the "WriteImageType" to float or double and try it again.
> Open the image with paraview, imagej or any other suited image viewer.
> It may be useful to take the log of the real and complex images for a
> better contrast.
>
>
>
> On 04.08.2010 21:45, Ming Chao wrote:
>
> float
>
> On Wed, Aug 4, 2010 at 2:38 PM, Markus Neuner <neuner.markus at gmx.net>
> wrote:
>
> What is the pixel type of "ImageType"?
>
>
>
> On 04.08.2010 21:11, Ming Chao wrote:
>
>  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;
>
>   }
>
>
>
>
>
> From the output I got all zeros....Apparently something wrong with the
> rescaler. Could anybody take a look? Thanks very much,
>
>
>
> Ming
>
>
>
> On Wed, Aug 4, 2010 at 9:35 AM, Ming Chao <mingchao2005 at gmail.com> wrote:
>
> I tried to run FFTImageFilter.cxx to do an FFT of an image. The input image
> is a 512x512, 24 bit thoracic CT image in jpg format. The output of the
> example cxx code are the real and imaginary parts of FFT of the input image.
> However, when I look at the two output images, they are just uniformly
> grey/black, depending on
>
>
>
>   intensityRescaler->SetOutputMinimum(  0  );
>
>   intensityRescaler->SetOutputMaximum( 255 );
>
>
>
> in the code. What did I do wrong? Many thanks,
>
>
>
> Ming
>
>
>
>
>
>
>
> _____________________________________
>
> Powered by www.kitware.com
>
>
>
> Visit other Kitware open-source projects at
>
> http://www.kitware.com/opensource/opensource.html
>
>
>
> Kitware offers ITK Training Courses, for more information visit:
>
> http://www.kitware.com/products/protraining.html
>
>
>
> Please keep messages on-topic and check the ITK FAQ at:
>
> http://www.itk.org/Wiki/ITK_FAQ
>
>
>
> Follow this link to subscribe/unsubscribe:
>
> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
>
>
>
>
> ------------------------------
> The information contained in this message may be confidential and legally
> protected under applicable law. The message is intended solely for the
> addressee(s). If you are not the intended recipient, you are hereby notified
> that any use, forwarding, dissemination, or reproduction of this message is
> strictly prohibited and may be unlawful. If you are not the intended
> recipient, please contact the sender by return e-mail and destroy all copies
> of the original message.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100809/aededffa/attachment-0001.htm>


More information about the Insight-users mailing list