[vtkusers] Re: Question about displaying scalar data as 2D image

Thomas - Kuiran Chen chent at cs.queensu.ca
Mon Oct 11 11:46:36 EDT 2004


Hi Neelam,

As far as I know, vtkImageMapper/vtkActor2D only shows two dimensional images.  If that is what you want, you have to use vtkLookupTable to set the display range of your image, e.g.,:

	// Gray scale lookup table
	vtkLookupTable *GrayLookupTable = vtkLookupTable::New();
	GrayLookupTable->SetTableRange(0, 255);	
	GrayLookupTable->SetHueRange(0, 0);
	GrayLookupTable->SetSaturationRange(0, 0);
	GrayLookupTable->SetValueRange(0, 1);
	GrayLookupTable->SetAlphaRange(0, 1);
	GrayLookupTable->Build();

Then use mapper to set the colors properly: e.g.

	vtkImageMapToColors* ImageMap2Colors = vtkImageMapToColors::New();
	ImageMap2Colors->SetInput(  InputImage->GetOutput() );
	ImageMap2Colors->SetLookupTable( GrayLookupTable );
	ImageMap2Colors->SetOutputFormatToLuminance();	

Finally pass the output of the vtkImageMapToColors to the vktImageActor.

My understanding of the use of vtkLookupTabe is to adjust the display range according to the intensity of the custom image.  More details can be found in the documentation of VTK.

Hope it helps, :-)

Cheers,

Thomas Kuiran Chen

The Image Analysis Laboratory
School of Computing
Queen's University at Kingston
Ontario, Canada K7L 3N6
Emai: chent at cs.queensu.ca





---------------------- Original Message ------------------------
From: neelam sanjeev verma <nsv80 at rediffmail.com>
To: chent at cs.queensu.ca <chent at cs.queensu.ca>
Sent: 2004-10-09 11:00:28
Subject: Question about displaying scalar data as 2D image

  hello sir 
    my problem is that i am unable to draw scalar data of structured grid by using vtkimagedata - vtkimagemapper -vtkactor2d,it is showing only gray color black and white image , my scalar data range is from -127 to 127 . is there any solution fot it. may u help me as u have post a mail to one user that u have solved this problem . may u detail the solution
Thanks For  reply .
bye 
Regards 
Neelam sanjeev verma
lucknow, India



--------------------------------------------------------------------
			



More information about the vtkusers mailing list