MantisBT - ITK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0007773 | ITK | public | 2008-10-02 13:50 | 2008-10-03 12:17 | |
Reporter | Johannes Perl | ||||
Assigned To | Bill Lorensen | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Linux | OS | Kubuntu 8.04 | OS Version | Kernel 2.6.24-19 |
Product Version | ITK-3-8 | ||||
Target Version | Fixed in Version | ||||
Resolution Date | |||||
Sprint | |||||
Sprint Status | |||||
Summary | 0007773: bitmap images can not be read as RGB | ||||
Description | Some bitmap images can not be read as RGB images, due to a bug in BMPImageIO. If the bitmap images are read, the single color values get lost and are translated into greyscale values. The problem was already reproduced and investigated by Bill Lorensen. "The BMPImageIO is not properly generating a lookup table when the number of colors == 0. It should generate a lookup table based on the depth of the image." | ||||
Steps To Reproduce | Use the following code and compile it. Then call ./RGBTest 000.bmp with the uploaded image being in the same folder. The output will be: Pixel values from GetRed,GetGreen,GetBlue: Red = 36 Green = 36 Blue = 36 Pixel values: Red = 36 Green = 36 Blue = 36 //file RGBTest.cxx #include "itkImage.h" #include "itkImageFileReader.h" #include "itkRGBPixel.h" int main( int , char * argv[] ) { typedef itk::RGBPixel< unsigned char > PixelType; typedef itk::Image< PixelType, 2 > ImageType; typedef itk::ImageFileReader< ImageType > ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName( argv[1] ); reader->Update(); ImageType::Pointer image = reader->GetOutput(); ImageType::IndexType pixelIndex; pixelIndex[0] = 3; pixelIndex[1] = 3; PixelType onePixel = image->GetPixel( pixelIndex ); PixelType::ValueType red = onePixel.GetRed(); PixelType::ValueType green = onePixel.GetGreen(); PixelType::ValueType blue = onePixel.GetBlue(); std::cout << "Pixel values from GetRed,GetGreen,GetBlue:" << std::endl; std::cout << "Red = " << itk::NumericTraits<PixelType::ValueType>::PrintType(red) << std::endl; std::cout << "Green = " << itk::NumericTraits<PixelType::ValueType>::PrintType(green) << std::endl; std::cout << "Blue = " << itk::NumericTraits<PixelType::ValueType>::PrintType(blue) << std::endl; red = onePixel[0]; // extract Red component green = onePixel[1]; // extract Green component blue = onePixel[2]; // extract Blue component std::cout << "Pixel values:" << std::endl; std::cout << "Red = " << itk::NumericTraits<PixelType::ValueType>::PrintType(red) << std::endl; std::cout << "Green = " << itk::NumericTraits<PixelType::ValueType>::PrintType(green) << std::endl; std::cout << "Blue = " << itk::NumericTraits<PixelType::ValueType>::PrintType(blue) << std::endl; return 0; } //CMakeLists.txt PROJECT(RGBTest) # Find ITK. FIND_PACKAGE(ITK REQUIRED) IF(ITK_FOUND) INCLUDE(${ITK_USE_FILE}) ENDIF(ITK_FOUND) ADD_EXECUTABLE(RGBTest RGBTest.cxx ) TARGET_LINK_LIBRARIES(RGBTest ITKCommon ITKIO) | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | 0001001_os_sn6040.bmp (590,902) 2008-10-02 13:50 https://public.kitware.com/Bug/file/1745/0001001_os_sn6040.bmp | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2008-10-02 13:50 | Johannes Perl | New Issue | |||
2008-10-02 13:50 | Johannes Perl | File Added: 0001001_os_sn6040.bmp | |||
2008-10-02 14:23 | Bill Lorensen | Status | new => assigned | ||
2008-10-02 14:23 | Bill Lorensen | Assigned To | => Bill Lorensen | ||
2008-10-02 14:27 | Bill Lorensen | Note Added: 0013713 | |||
2008-10-02 14:27 | Bill Lorensen | Status | assigned => acknowledged | ||
2008-10-03 12:11 | Bill Lorensen | Resolution | open => fixed | ||
2008-10-03 12:12 | Bill Lorensen | Status | acknowledged => resolved | ||
2008-10-03 12:17 | Bill Lorensen | Status | resolved => feedback | ||
2008-10-03 12:17 | Bill Lorensen | Resolution | fixed => reopened | ||
2008-10-03 12:17 | Bill Lorensen | Note Added: 0013723 | |||
2008-10-03 12:17 | Bill Lorensen | Status | feedback => closed | ||
2008-10-03 12:17 | Bill Lorensen | Resolution | reopened => fixed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|