[Insight-users] Exporting RGBQuad Data to itk::Image

Christian Werner christian.werner at rwth-aachen.de
Sat Sep 25 04:04:29 EDT 2010


  Thank you, the RGBAPixel is the perfect choice for my problem!

I just changed the topic slightly so that anybody who is looking or 
"RGBQuad" will find this posting more easily.

Best regards,
Christian

Am 23.09.2010 21:59, schrieb Dan Mueller:
> Hi Christian,
>
> Consider using itk::Image<RGBPixel<unsigned char>, 2>. You will have
> to use iterators to "swizzle" [1] BGR to RGB and skip the "reserved"
> byte (which the documentation says is zero).
>
> Alternatively you could import the buffer directly into
> itk::Image<RGBAPixel<unsigned char>, 2>  but B-R will be swapped, and A
> will be zero...
>
> HTH
>
> Cheers, Dan
>
> [1] http://en.wikipedia.org/wiki/Swizzling_%28computer_graphics%29
>
> On 23 September 2010 14:57, Christian Werner
> <christian.werner at rwth-aachen.de>  wrote:
>>   Hi there!
>>
>> I see that you can assign a pointer to some image data in memory to an
>> itk::Image instance. What should I do, if my data is an RGB-Quad Array? The
>> thing is that I am doing a screenshot in a Win32 environment and want to do
>> image analysis on a part of that screenshot with ITK. If you wonder how a
>> RGB-Quad looks like, this is what the MSDN-Library tells us:
>>
>> typedef struct tagRGBQUAD {
>>   BYTE rgbBlue;
>>   BYTE rgbGreen;
>>   BYTE rgbRed;
>>   BYTE rgbReserved;
>> } RGBQUAD;
>>
>> The data of my screenshot is here:
>>
>> RGBQUAD*            colorData_;
>>
>> Should I create a itk::Image<unsigned char[4], 2>? Or should I use the
>> itk-iterators to write the image data pixel by pixel into my itk::Image?
>>
>> Best regards,
>> Christian



More information about the Insight-users mailing list