[vtkusers] How to use vtkImageImport class for RGB image

Kevin H. Hobbs hobbsk at ohiou.edu
Tue Oct 28 05:23:00 EDT 2008


On Tuesday 28 October 2008 02:59:14 am masabumi ishihara wrote:
> Hi VTK users,
>
> I am a newbie for VTK.
> I am tring to use vtkImageImport class in order to convert the
> third-party image to the VTK 2D image, as follows;
>
>     vtkImageImport *importer = vtkImageImport::New();
>     importer->SetWholeExtent(0,siw-1,0,sih-1,0,0);
>     importer->SetDataExtentToWholeExtent();
>     importer->SetDataScalarTypeToShort();
>     importer->SetImportVoidPointer(b);
>
> BTW, if the void pointer b is scalar, it works well, but if b is RGB
> color data, the error comes about.
> If you know how to use vtkImageImport class for RGB image, please let me
> know.
>

vtkImageImport has SetNumberOfScalarComponents(3), does this do what you want?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081028/df006d8f/attachment.pgp>


More information about the vtkusers mailing list