[vtkusers] How to color the warped scence based on grey image?

Q Ma s0343497 at sms.ed.ac.uk
Tue Mar 9 19:01:32 EST 2004


Hi,there

I use a grey level image as input, and using vtkWarpScalar to generate a 3D scene.
However, the lut I set in mapper seems not work.
The 3D scene is always grey unless what colour table I set.
Following is the code:

vtkJPEGReader *vectorreader=vtkJPEGReader::New();
  vectorreader->SetFileName(imagefilename);
  vectorreader->SetDataScalarTypeToInt();
vtkImageGaussianSmooth *smooth=vtkImageGaussianSmooth::New();
  smooth->SetInput(vectorreader->GetOutput());
  smooth->SetStandardDeviation(5,5);
vtkImageDataGeometryFilter *geometry=vtkImageDataGeometryFilter::New();
  geometry->SetInput(smooth->GetOutput());  
vtkWarpScalar *warp=vtkWarpScalar::New();
  warp->SetInput(geometry->GetOutput());
  warp->SetScaleFactor(1);
vtkMergeFilter *merge=vtkMergeFilter::New();
  merge->SetGeometry(warp->GetOutput());
  merge->SetScalars(vectorreader->GetOutput());
vtkLookupTable *Lut=vtkLookupTable::New();
  Lut->SetTableRange(0,255);
  Lut->SetSaturationRange(0,1);
  Lut->SetHueRange(0,1);
  Lut->SetValueRange(0,1);
vtkDataSetMapper *mapper=vtkDataSetMapper::New();
  mapper->SetInput(merge->GetOutput());
  mapper->SetLookupTable(Lut);
  mapper->ScalarVisibilityOn();  
  mapper->SetScalarRange(80,255);  
  mapper->ImmediateModeRenderingOff();
vtkActor *heightactor=vtkActor::New();
  heightactor->SetMapper(mapper);	

Can anybody give me someidea?
Thanks.
Note the input image is a grey image, the grey value is from 80 to 240.

Regards,
Qi



More information about the vtkusers mailing list