[vtkusers] vtkImageData doesnt get Colored.

Rodrigues, Jason (MED) JasonR at geind.ge.com
Tue Jan 15 22:55:00 EST 2002



        Hello all,
               I am expeirnceing a strange problem at this moment. I have a
vtkImageData object that contains pixel values ranging from 0 - 2500. I want
to color code these values by setting different HSV values of LookUpTable.
But that doenst happen at all. instead the image appears to be completely
balck. further analysis of the pixels at locations X and Y would give me the
original pixel values. (i.e 0-2500)  Can  anybody suggest the possible
solution for the same? 
What are the alternatives to display the image using colors in a vtkRenderer
via the pipeline of vtkImageMapper?
I am sending a small piece of code below.


                vtkLookupTable LUT1 = new vtkLookupTable();
		   LUT1.SetTableRange(0,2500);
		   LUT1.SetSaturationRange(0.0,1.0);
		   LUT1.SetHueRange(0.0, 1.0);
		   LUT1.SetValueRange(0.0, 1.0);
		   LUT1.SetAlphaRange(0.0,1.0);
		   LUT1.Build();
              vtkImageMapToColors mapToRGBA1 = new vtkImageMapToColors();
		mapToRGBA1.SetInput(imagedata);
		mapToRGBA1.SetOutputFormatToRGBA();
		mapToRGBA1.SetLookupTable(LUT1);

               vtkImageCast cast1 =new vtkImageCast ();
		cast1.SetInput(mapToRGBA1.GetOutput());
		cast1.SetOutputScalarType( 5 ); 
		imagedata= cast1.GetOutput();
                        imagedata.update();
            
              imgMapper = new vtkImageMapper();
                       imgMapper.SetInput(imagedata);
                       imgMapper.SetColorWindow(2500);
                       imgMapper.SetColorLevel(1250);
                       imgMapper.SetZSlice(sb.getValue());


            vtkActor2D actor = new vtkActor2D();
                       actor.SetMapper(imgMapper);
                 
            vtkRenderer ren=panel1.getRenderer();
                        ren.AddActor2D(actor);
                        ren.Render();
 


"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this 
communication is strictly Prohibited. 
If you have received this message by error, please notify us 
immediately, return the original mail to the sender and delete the 
message from your system."




More information about the vtkusers mailing list