[Insight-users] Urgent question about Examples/Filtering/FFTImageFilterFourierDomainFiltering.cxx.

Luis Ibanez luis.ibanez at kitware.com
Sun Apr 6 08:28:22 EDT 2008



Hi Jim,


1) BMP does not support pixel type float or double.
    This is not an ITK limitation, is a limitation
    of the BMP file format:
    http://en.wikipedia.org/wiki/BMP_file_format


2) PNG does not support pixel type float or double.
    This is not an ITK limitation, is a limitation
    of the BMP file format:
    http://en.wikipedia.org/wiki/PNG_file_format


3) You don't need to resort to VTK in order to
    save images of pixel type float or double.
    You can do so with the fileformats listed
    in my previous email, and for which there
    is currently support in ITK.

4) Depending on what you want to do with the
    output of the FFT filter, you can simply
    cast-and-rescale the pixels of the output
    image, by using the RescaleIntensityImageFilter.

    You can follow the examples:


     Insight/Examples/Filtering/
         FFTDirectInverse.cxx
         FFTDirectInverse2.cxx
         FFTImageFilter.cxx
         FFTImageFilterFourierDomainFiltering.cxx


     E.g. lines 259-268 of FFTImageFilter.cxx.


     The output image will "look like" the real
     or imaginary part of FFT computed from the
     input image. The values however will be
     rescaled.



     This will prevent you from doing things like
     verifying the transformation by running an
     inverse transform.




   Regards,


       Luis


-----------------
Jim Stott wrote:
> Hi Luis,
>  
> Thanks for the prompt answer!
>  
> I noticed that VnlFFT only deals with float or double data. I am 
> wondering, within the domain of ITK, without resorting to VTK, whether I 
> can write the output from VnlFFT filter to BMP or PNG files. Is that 
> possible that I can cast the float or doulbe output from VnlFFT filter 
> to unsigned char before writing.
>  
> My objective is simple, just input a bmp file and save the filtered 
> image to another bmp file.
>  
> Thanks and have a nice Sunday!
>  
> Jim
>  
>  
>  
> 
> 
>  
> On Sat, Apr 5, 2008 at 11:27 PM, Luis Ibanez <luis.ibanez at kitware.com 
> <mailto:luis.ibanez at kitware.com>> wrote:
> 
> 
>     Hi Jim,
> 
>     In order to save images with pixel type float or double
>     you should consider using:
> 
> 
>         a) MetaImage   .mhd
>         b) VTK         .vtk
>         c) Nrrd        .nrrd
>         d) Nifti       .hdr
> 
> 
>     Please see the FAQ in the Wiki for a list of the
>     file formats supported in ITK:
> 
>        http://www.itk.org/Wiki/Itk_FAQ
> 
> 
> 
> 
>     Regards,
> 
> 
>        Luis
> 
> 
> 
>     ------------------
>     Jim Stott wrote:
> 
>         Dear all,
>          I am a new user and in a hurry to use ITK for a project.
>          After I compiled FFTImageFilterFourierDomainFiltering.cxx, I
>         tried to run it. I intend to save the result image to a BMP or
>         PNG file. The error message suggests that "BMPImageIO supports
>         unsigned char only". I read the ITK user mannual about this
>         example (page 256, 6.10.2), it doesn't mention anything about
>         what image format you can save to.
>          Is that because the output of VnlFFT filter cannot be processed
>         by ImageFileWriter? If this is the case, how can I change code
>         in order to save the result image to a BMP or other image formats.
>          Many thank!
>          The following is the error message
>          
>         filter.exe  input.bmp  mask.bmp  result.bmp ( This is my command
>         line input.)
> 
>          
>         Error writing the real image:
> 
>          
>         itk::ExceptionObject (0131EC58)
> 
>         Location: "void __thiscall itk::BMPImageIO::Write(const void *)"
> 
>         File: ..\..\..\InsightToolkit-3.4.0\Code\IO\itkBMPImageIO.cxx
> 
>         Line: 650
> 
>         Description: itk::ERROR: BMPImageIO(01823740): BMPImageIO
>         supports unsigned char only
> 
> 
>         ------------------------------------------------------------------------
> 
>         _______________________________________________
>         Insight-users mailing list
>         Insight-users at itk.org <mailto:Insight-users at itk.org>
>         http://www.itk.org/mailman/listinfo/insight-users
> 
> 


More information about the Insight-users mailing list