[Insight-users] FFTImageFilter

Ming Chao mingchao2005 at gmail.com
Thu Aug 5 13:21:04 EDT 2010


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 athttp://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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100805/2ca58678/attachment.htm>


More information about the Insight-users mailing list