[vtkusers] convert a float image into 16bit grayscale

ankit master ankit.master at gmail.com
Wed Nov 23 11:18:15 EST 2011


Hello,


I have a 256x 256 image of float values and I am trying to visualize it
into 16bit Grayscale format. I tried using a lookup table but everytime i
either get a blue image or a red image but not a grayscale image. Any help
is greatly appreciated


vtkSmartPointer<vtkLookupTable> lut=
vtkSmartPointer<vtkLookupTable>::New();
lut->SetTableRange(0,65535);
 lut->SetNumberOfTableValues(65536);
lut->SetHueRange(0,0);
lut->SetValueRange(0, 1);
 lut->Build();
    for(int i=0; i<65536; i++)
{
float val1 = (float)i/65536 ;
 lut->SetTableValue(i, val1, val1,val1);
}




        vtkActor *actor1 = vtkActor::New();
vtkPolyDataMapper *mapper1 = vtkPolyDataMapper::New();
vtkImageDataGeometryFilter *convertToPolyImageFilter =
vtkImageDataGeometryFilter::New();
 convertToPolyImageFilter->SetInput(connector->GetOutput() );
convertToPolyImageFilter->Update();
 mapper1->SetInput(convertToPolyImageFilter->GetOutput() );

Thank you

Ankit

-- 

>From the withered tree, a flower blooms.
                                                         - Zen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111123/ab38e131/attachment.htm>


More information about the vtkusers mailing list