[Insight-users] about BMP write and read

Yixun Liu yxliu at fudan.edu.cn
Tue Aug 8 03:52:06 EDT 2006


Hi,

I read a dicom series(short type) and use RescaleIntensityImageFilter to change pixel type from short to  unsigned char. At last save it to BMP format. I get a series of BMP files with bit deep 8. Now I want to read this BMP series I did as below,


typedef itk::ImageSeriesReader< ImageType_Short>  ReaderType_Short;
 ReaderType_Short::Pointer reader = ReaderType_Short::New();//itk

     nameGenerator->SetStartIndex(startIndex );
     nameGenerator->SetEndIndex( endIndex );
     nameGenerator->SetIncrementIndex( incrementIndex );
     nameGenerator->SetSeriesFormat(files);
     reader->SetImageIO( itk::BMPImageIO::New() );
     reader->SetFileNames( nameGenerator->GetFileNames()); 

However, exception was thown. Does BMPImageIO only support RGB format(bit deep 24) instead of index (bit deep 8)format?


ITKSoftwareGuide Says that "Note that when reading and writing images, the pixel type of the
image is not necessarily the same as the pixel type stored in the file"
So, another question, if I read a series of files using pixel type of short, now I want to save it to , e.g., png format. Assume PNG format support two pixel types, short and unsigned char. Which format ITK will save it to?

Regards,

Yixun Liu






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060808/b3a4f8c6/attachment.htm


More information about the Insight-users mailing list