[vtkusers] fill vtkImageData with RGB data?

Mark Wyszomierski markww at gmail.com
Mon Apr 11 15:04:48 EDT 2005


Hi David,

My RGB data comes from an array I created just for testing. I have
used it for testing in DICOM viewers and it works ok.

I noticed that the image data will display color if I use it with
vtkImageViewer, however it will not work with vtkImageViewer2. I
investigated the differences between the two display classes, it seems
vtkImageViewer2 has no vtkMapper member so I suppose it doesn't know
what to do with the other color channels I supply in the vtkImageData
object. It looks like vtkImageViewer2 has a vtkImageActor member
instead, for which I cannot find a method to set a mapper for...

Is this the real problem?

Thanks so much for your response,
Mark


On Apr 11, 2005 2:26 PM, David Cole <david.cole at kitware.com> wrote:
> Where does your RGB data come from? Does it display properly
> (non-grayscale) in some other viewer?
> 
> It will be definitely be gray if r==g==b for each pixel...
> 
> 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