[vtkusers] fill vtkImageData with RGB data?

Mark Wyszomierski markww at gmail.com
Tue Apr 12 10:29:09 EDT 2005


Great, that does it Amy. Once I was able to access the
vtkImageMapToWindowLevelColors instance of vtkImageViewer2 via
GetWindowLevel(), I then set a color transfer function as Dov
suggested. This works wonderfully.

Thank you all!
Mark


On Apr 12, 2005 8:37 AM, Amy Squillacote <amy.squillacote at kitware.com> wrote:
> vtkImageViewer2 does have an instance of vtkImageMapToWindowLevelColors
> (call GetWindowLevel() on the vtkImageViewer2), and that class does allow
> you to set a lookup table.  I have not actually tried this, but it's worth
> looking into.
> 
> - Amy
> 
> At 05:00 PM 4/11/2005, Mark Wyszomierski wrote:
> >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
> > >
> >_______________________________________________
> >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