[Insight-users] Re: Problem with png files

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 24 22:48:42 EDT 2005


Hi Xavier,

The ITK writer and readers will use the pixel type
that you specify when you instantiate the ImageType
that you pass to the ImageFileReader<> and to the
ImageFileWriter<>.

If you want to use 8-bits images, then simply do

    typedef itk::Image< unsigned char, 2 > ImageType;
    typedef itk::ImageFileWriter< ImageType > WriterType;
    typedef itk::ImageFileReader< ImageType > ReaderType;


Please, read the ITK Software Guide

     http://www.itk.org/ItkSoftwareGuide.pdf

in particular the chapter on

     "Reading and Writing Images"

all this is explained in detail in that chapter.



Regards,


    Luis


-----------------
BATY Xavier wrote:
> Hello again,
> 
> I just found that my problem came from the fact that cameraman.png is  8-bit
> depth image (uchar?) and cameraman2.png is a 16-bits depth image (ushort).
> 
> is ITK use 16-bits depth by default?
> and if so, can I set ITK to use 8-bits depth instead.
> 
> 
> ----- Original Message ----- 
> From: "BATY Xavier" <xavier.baty at univ-angers.fr>
> To: <insight-users at itk.org>
> Sent: Monday, October 24, 2005 9:38 AM
> Subject: Problem with png files
> 
> 
> 
>>Hello,
>>
>>I have a problem with png files.
>>I tried the example ImageReadWrite.cxx given with ITK (latest cvs done on
>>Thursday, 20th october)
>>with the image cameraman.png (see the image at http://xavbat.free.fr).
>>
>>I tried to write this image in a file named cameraman2.png and all I got
> 
> is
> 
>>a black square (see the image at http://xavbat.free.fr).
>>
>>I use a Fedora core 3 based Linux.
>>
>>Can anybody help me to solve this problem? I had the same problem saving
> 
> in
> 
>>tiff format but not in mhd format.
>>
>>thanks
>>Xav
>>
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 



More information about the Insight-users mailing list