apply color lut for grayscale images

i create a texture with internal format gl_limunance12.
i want to apply lut for this grayscale medical image image to make it colorized.

if ve tried glPixelMapfv. it works for rgb images but grayscale images.

is there any way to do it with opengl?

If u can use a shader program to perform this lookup.

uniform sampler2D InputTexture;
uniform sampler2D ColorMap;
PS_OUT main(PS_IN In)
{
float4 fTexData = tex2D( InputTexture, In.texture0 );
PS_OUT out;
out.color0 = text1D( ColorMap, fTexData.a );
return out;
}

i know few about glsl.

i ve compiled it and got some errors
0(3) : error C0000: syntax error, unexpected ‘(’ at token “(”
0(3) : error C0501: type name expected at token “(”
0(3) : warning C7022: unrecognized profile specifier “main”
0(3) : warning C7022: unrecognized profile specifier “PS_OUT”
0(5) : error C1115: unable to find compatible overloaded function “tex2D(sampler2D, error)”
0(6) : error C0000: syntax error, unexpected ‘’;’’ at token “;”
0(6) : error C0501: type name expected at token “;”
0(6) : warning C7022: unrecognized profile specifier “PS_OUT”
0(8) : error C0000: syntax error, unexpected reserved word “return” at token “return”
0(8) : error C0501: type name expected at token “return”
0(8) : warning C7537: OpenGL does not allow ‘‘inout’’ after a type specifier

Hi,
first if you use 8bit data use just luminance.

the shader for simple 1d transfer function for texture sliced
volume rendering is easy.


sampler3D volumeTex;
sampler1D lutTex;
void main()
{
   float iso = texture3D(volumeTex, texCoord.xyz);
   vec4 color = texture1D(lutTex, iso);
   gl_FragColor = color;
}

regards,
lobbel

Please refer pixel shader tutorial.

http://www.opengl.org/news/comments/tutorial_cg_pixel_shaders_in_opengl/

http://joshbeam.com/articles/cg_pixel_shaders_in_opengl/

Definition of VS_OUT and PS_OUT are
struct VS_OUTPUT
{
float4 color0 : COLOR0;
float2 texcoord0 : TEXCOORD0;
};

struct PS_OUTPUT
{
float4 color : COLOR;
};