[vtkusers] fill vtkImageData with RGB data?

Mark Wyszomierski markww at gmail.com
Mon Apr 11 17:00:35 EDT 2005


vtkImageViewer2 doesn't seem to have a method for adding a color
transfer function either, so I can't try Dov's suggestion, is this
correct?

Mark

On Apr 11, 2005 2:50 PM, Dov Grobgeld <dov.grobgeld at weizmann.ac.il> wrote:
> Hi Mark,
> 
> One way of doing it is by first quantizing your image into
> a small set of colors (e.g. 1024) and then using a color lookup
> table to define the mapping between the color index and the
> actual RGB color, as well as an optional alpha channel.
> 
> Using RGB directly (if it is all possible) would make it much
> more difficult to control transparency through the various
> lookup tables.
> 
> Hope this helps.
> 
> Regards,
> Dov
> 
> On Mon, Apr 11, 2005 at 12:48:05PM -0400, Mark Wyszomierski wrote:
> > Hi,
> >
> > I have an RGB image, I would like to load it into an instance of
> > vtkImageData. I use the following:
> >
> > image_data->SetDimensions(cx, cy, 1);
> > image_data->SetScalarType(VTK_UNSIGNED_CHAR);
> > image_data->SetNumberOfScalarComponents(3);
> > image_data->AllocateScalars();
> > unsigned char *p = (unsigned char*)image_data->GetScalarPointer();
> >
> > // Now here I will fill image_data with my RGB components in
> > RGB..RGB..RGB order.
> >
> > When I go to display my image using vtkImageViewer2, they always come
> > out grey. Is there a way to make it recognize there are really 3 color
> > channels to create the actual colors?
> >
> > Thanks.
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list