[vtkusers] Displaying Image Data

Jeff Lee jeff at cdnorthamerica.com
Sun Mar 21 08:33:55 EST 2004


How about something like

vtkUnsignedCharArray *arr = vtkUnsignedCharArray:New();
arr->SetVoidArray(myCharData, xdim*ydim*zdim, 1);

vtkImageData *id = vtkImageData::New();
id->SetDimensions(xdim, ydim. zdim);
id->GetPointData()->SetScalars(arr);
id->SetScalarType(VTK_UNSIGNED_CHAR);
id->SetSpacing(1.0, 1.0, 1.0);
id->SetOrigin(0.0, 0.0, 0.0);

once you have a vtkImageData, you can finish the pipeline with a 
vtkImageActor.
-J

Markus wrote:

> Hi there!
>
> I am trying to use VTK to add visualization to a Computer Vision 
> application. Images are thereby represented as unsigned char arrays 
> containing the pixel values (e.g. manipulated pgm files). How can I 
> display an unsigned char array as an image in a render window in vtk, 
> without reading the file as pgm from the disk ?
>
> Thanks,
>
> Markus
> _______________________________________________
> 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