[vtkusers] Adding color to a rendered image

Michael Dussere dussere at labri.fr
Wed Jun 16 12:18:07 EDT 2004


Hi,

You should take a look into the example Medical3.cxx which presents 
different lookup table configurations.
Take care, if the example has not been modified recently there is a bug 
and you must correct it. This is from an old mail I wrote :

... It is due to the vtkLookupTable instances that are not built. 
Usually, it seems that vtkMapper calls this method but in Medical3 
example vtkLookupTable is used directly with vtkImageMapToColors and 
vtkImageActor. To solve this problem one can call 
vtkLookupTable::Build() directly.

  vtkLookupTable *satLut = vtkLookupTable::New();
    satLut->SetTableRange (0, 2000);
    satLut->SetHueRange (.6, .6);
    satLut->SetSaturationRange (0, 1);
    satLut->SetValueRange (1, 1);
    satLut->Build(); // need to be added for each vtkLookupTable
  vtkImageMapToColors *saggitalColors = vtkImageMapToColors::New();
    saggitalColors->SetInput(v16->GetOutput());
    saggitalColors->SetLookupTable(bwLut);
  vtkImageActor *saggital = vtkImageActor::New();
    saggital->SetInput(saggitalColors->GetOutput());
    saggital->SetDisplayExtent(32,32, 0,63, 0,92);



Emiliano Beronich wrote:

> Hi everyone!
>
> I have render a scene with an actor (a 3d surface). The image is in 
> gray. Now I would like to enhance the looking of the image adding some 
> colors. I tried to change the properties of the actor but I haven't 
> found the result I'm looking for. The perfect solution is to render 
> the same image (in gray) but show it with my own lookuptable.
> So how can I tell to the rendering process that I want to colorize an 
> image with a specific lookuptable?
> Besides I need to support interaction with the scene (rotation, 
> translation).
>
> I though a solution could be rendering in memory and using 
> vtkWindowToImageFilter to add color in a new pipeline but I think is a 
> little slow.
> Another solution could be rendering in memory in a 256-color bitmap, 
> set my own lookuptable to the bitmap and finally draw it on the 
> window. But I had some errors with setpixelformat and I haven't solved 
> yet.
>
> Does anyone know a better or more direct approach? I would like to set 
> the lookuptable before doing the render.
>
> Regards,
> Emiliano
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers







More information about the vtkusers mailing list