[vtkusers] How to get image data from vtk object(vtkRenderWindow) before transfering it to png, jpeg or other image data?

yenanqu at scs.fsu.edu yenanqu at scs.fsu.edu
Wed Apr 23 16:35:27 EDT 2008


Hi,
I have tried the following code to do this, but it doesn't seem to get  
the actual image data when I test it.
===========================================
renWin->Render();
vtkWindowToImageFilter * w2i = vtkWindowToImageFilter::New();
    vtkPNGWriter * writer = vtkPNGWriter::New();
    w2i->SetInput( renWin );
    writer->SetInput( w2i->GetOutput() );
    w2i->Update();
    vtkImageData * id = w2i->GetOutput();
id->UpdateInformation();
unsigned char* pPix;
  pPix = (unsigned char*)id->GetScalarPointer();
==============================================

Did anyone has done this before?


Yenan


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the vtkusers mailing list