[Insight-users] Regarding using RGB colors with pixels in ITKImage

Shiva Kumar shivak at vitinfotech.com
Sat, 24 Jan 2004 11:32:19 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_0035_01C3E26D.B9F15760
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi everyOne,

    For creating an Image using Itk I am defining image as=20
for ex:
    typedef  unsigned int  PixelType;
    typedef itk::Image < PixelType, 2 > ImageType;
here we are using unsigned int but how to associate a color with pixel?.

there is another template class for specifying pixelType like:
  typedef  itk::RGBPixel<  Unsigned char> pixelType
  typedef itk::Image < PixelType, 2 > ImageType

This works fine but the problem is I am using a filter =
itktovtkImageFilter to convert into vtkImage  for rendering
 but this filter will not accept RGBPixeltype.
Then if i use unsigned int or unsigned char how can i specify the color =
values.
How does the filter knows about color representation?

Please anybody has the answer let me know ASAP.

Thanks and Regds
Shiva kumar=20

------=_NextPart_000_0035_01C3E26D.B9F15760
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>hi everyOne,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; For creating an =
Image using=20
Itk&nbsp;I am defining&nbsp;image as&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>for ex:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; typedef&nbsp;=20
unsigned&nbsp;int&nbsp; PixelType;<BR>&nbsp;&nbsp;&nbsp; typedef =
itk::Image &lt;=20
PixelType, 2 &gt; ImageType;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>here we are using unsigned int but how =
to associate=20
a color with pixel?.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>there is another template class for =
specifying=20
pixelType like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; =
typedef&nbsp;&nbsp;itk::RGBPixel&lt;&nbsp;=20
Unsigned char&gt; pixelType<BR>&nbsp;&nbsp;typedef itk::Image &lt; =
PixelType, 2=20
&gt; ImageType</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This works fine but the problem is I am =
using a=20
filter itktovtkImageFilter to convert into vtkImage&nbsp; for=20
rendering</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</FONT><FONT face=3DArial =
size=3D2>but this=20
filter will not accept RGBPixeltype.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Then if i use unsigned int or unsigned =
char how can=20
i specify the color values.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>How does the filter knows about color=20
representation?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Please&nbsp;anybody has the answer let =
me know=20
ASAP.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks and Regds</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Shiva kumar</FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</DIV></FONT></DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_0035_01C3E26D.B9F15760--