[vtkusers] vtkTexture and LUT for 16 bit signed images with vtk 5.02

imran khan khan.imranh at gmail.com
Thu Jan 18 17:27:55 EST 2007


Hi:

I am having trouble with using LUT with vtkTexture. I have attached my code
snippet.My scalar data is in id1. I am not seeing anything in the rendered
window.

Any insights would be appreciated.

Imran

  this->id1 = vtkImageData::New();
  this->id1->SetDimensions(jpgSizeX,jpgSizeY,1);
  this->id1->SetScalarType(VTK_SHORT);
  this->id1->SetNumberOfScalarComponents(num_components);
  this->id1->AllocateScalars();
  this->id1->SetDimensions(jpgSizeX,jpgSizeX,1);
  this->id1->SetSpacing(1,1,0);
  this->id1->SetOrigin(0,0,0);

  // insert image as texture
  this->image->SetInput(this->id1);
  this->image->InterpolateOn();

f( bitResolution == 16)
  {
    lut1 = vtkLookupTable::New();
    lut1->SetNumberOfColors(65536);
    lut1->Build();
    for(int i=0;i<32000;i++)
    {
        double value = (double) i*0.000015;
        lut1->SetTableValue(i, value, value,value, 1.0);
    }

    this->image->SetLookupTable(lut1);
    this->image->MapColorScalarsThroughLookupTableOn();
  }

  this->plane->SetOrigin( 0.0, 0.0, 0.0);
  this->plane->SetPoint1(  jpgSizeX, 0.0, 0.0);
  this->plane->SetPoint2( 0.0,  jpgSizeY, 0.0);
  this->plane->SetCenter( jpgSizeX/2,  jpgSizeY/2, 0.0);

  this->planeMapper->SetInput(this->plane->GetOutput());

  this->planeActor->GetProperty()->SetColor(1.0,1.0,1.0);
  this->planeActor->GetProperty()->SetAmbient(1.0);
  this->planeActor->GetProperty()->SetDiffuse(0.0);
  this->planeActor->GetProperty()->SetSpecular(1.0);
  this->planeActor->GetProperty()->SetSpecularPower(5.0);
  this->planeActor->SetMapper(this->planeMapper);
  this->planeActor->SetTexture(this->image);

  this->Renderer->AddActor(this->planeActor);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070118/43e31633/attachment.htm>


More information about the vtkusers mailing list