[Insight-users] Writing RGBPixel images problem, Bug?

Karthik Krishnan Karthik.Krishnan at kitware.com
Fri Jul 14 17:08:40 EDT 2006


What does  the following piece of code compiled on the ppc darwin with 
xcode  and with unix makefiles tell you ?

#include "itkRGBPixel.h"
#include <iostream>
int main() { std::cout  <<  typeid(itk::RGBPixel<unsigned char>).name() 
<< std::endl; return 1; }

Is it not "N3itk8RGBPixelIhEE" ?

Bradley Lowekamp wrote:

> I am able to repoduce the problem with the given code only with 
> xcode. I am running:
>
> Max OS X 10.4.7
> powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. 
> build 5341)
> Xcode 2.3
> cmake version 2.4-patch 2
>
> When I use a "Unix MakeFiles"  all works fine. But when I use Xcode I 
> am still getting the same error. I added printing of the thrown 
> exception to the code and this is the output produced:
>
> :~/temp/iotest blowek1$ Debug/iotest -2 -d 256 256 rgb -f test.tiff -v 128
> Filename: test.tiff Dimensions: 256 256 -1  Value: 128 Type: Rgb
> Can't write test.tiff
> itk::ExceptionObject (0x256fdd0)
> Location: "virtual bool itk::ImageIOBase::SetPixelTypeInfo(const 
> std::type_info&)"
> File: 
> /nfs/mead/Users/blowek1/software/InsightToolkit-2.8.1/Code/IO/itkImageIOBase.cxx
> Line: 340
> Description: itk::ERROR: TIFFImageIO(0x256fa00): Pixel type currently 
> not supported. typeid.name = N3itk8RGBPixelIhEE
>
>
> With this version of ITK I needed to change the version of CMake I was 
> using. Perhaps I should build all the testing for ITK and do a more 
> complete check. Is there any xcode builds on the dashboard?
>
>
> Thanks
>
> On Jul 14, 2006, at 3:40 PM, Kent Williams wrote:
>
>> I've tried to duplicate this with the current CVS for Insight, and 
>> I've not been able to duplicate it.  I've attached my test program. 
>> Never saw anything resembling this error message.
>>
>> The command line to generate a RGB Image file (in any format that 
>> supports RGB) is this:
>>
>> ImageGenerate -2 -d 256 256 rgb -f test.tiff -v 128
>>
>> -2 means 2D, -d 256 256 means 256x256 image size, 'rgb' means use 
>> itk::RGBPixel<unsigned char> as the pixel type,  -f test.tiff means 
>> write to test.tiff, -v 128 means set every pixel to a value of 128.
>>
>> Bradley Lowekamp wrote:
>>
>>> I have been using itk::ImageFileWriter with pixel type 
>>> itk::RGBPixel<unsigned char> to write my images and it was all 
>>> working. With this useful function to wrap it:
>>>
>>>
>>> template<class ImageType> 
>>> void WriteImage(typename ImageType::ConstPointer image, const 
>>> std::string fname) {
>>> std::cout << "writing image \"" << fname << "\"..." << std::flush;
>>>   typedef  itk::ImageFileWriter<   ImageType  > WriterType;
>>>   typename WriterType::Pointer writer = WriterType::New();
>>>   writer->SetFileName( fname.c_str() );
>>>   writer->SetInput(image);
>>>   writer->Update();
>>> std::cout<< "done." << std::endl;
>>> }
>>>
>>>
>>>  I am now trying to use ITK 2.8.1 and no matter what file type I try 
>>> saving as I am getting a message similar to:
>>>
>>> Description: itk::ERROR: VTKImageIO(0x166f6d0): Pixel type currently 
>>> not supported. typeid.name = N3itk8RGBPixelIhEE
>>>
>>> I have tried tiff,png,jpg all with the same results. Perhaps 
>>> something changed in this version? Grepping around in the test I see 
>>> that the writers now use SetImageIO (not sure if this is new)?
>>>
>>>
>>> I switched to 2.8.1 to use 
>>> the itk::Statistics::ChiSquareDistribution class. The ITK_USE_REVIEW 
>>> or the Code/Review does not include installation of the headers is 
>>> libraries (not sure if this is on purpose). 
>>>
>>>
>>> Thanks,
>>>
>>>
>>> ========================================================
>>> Bradley Lowekamp  
>>> Management Systems Designers Contractor for
>>> Office of High Performance Computing and Communications
>>> National Library of Medicine 
>>> blowekamp at mail.nih.gov <mailto:blowekamp at mail.nih.gov>
>>>
>>>------------------------------------------------------------------------
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users   
>>>
>
> ========================================================
>
> Bradley Lowekamp  
>
> Management Systems Designers Contractor for
>
> Office of High Performance Computing and Communications
>
> National Library of Medicine 
>
> blowekamp at mail.nih.gov <mailto:blowekamp at mail.nih.gov>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>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