[vtkusers] Please help me: How get pixel data after Render()

Randall Hand randall.hand at gmail.com
Wed Jun 8 15:30:21 EDT 2005


w2if->GetOutput()->GetPointData()->GetArray(0) will return the vtkDataArray 
storing the pixel information. Then you can use it's "GetVoidPointer" 
function to get a pointer to the beginning of the data. 

But I *STRONGLY* recommend you reconsider what you're doing, and try to keep 
it in the standard VTK Pipeline interface. Dealing with the pointer directly 
can lead to all kinds of nastiness & problems. The vtkImagedata that the 
w2if filter generates can be handed off to any of the Image filters to do 
processing, storage, or computation.

On 6/8/05, Renaud Isabelle <renauisa at yahoo.fr> wrote:
> 
> Hi,
>  thanks for your reply. I check out your filter. This could be a good 
> idea. All I will have to do is: 
>  # Will render in memory.
> renWin->OffScreenRenderingOn();
> renWin->Render();
>  vtkWindowToImageFilter w2if;
> w2if->SetInput(renWin);
>  Ok. And I will have a 2D vtkImageData object. 
>  *But then, how can I have to pointer of the pixel data of this 
> vtkImageData object?*
> ** 
> *Isa*
>   
> 
> *Randall Hand <randall.hand at gmail.com>* a écrit :
> 
> to get the screen image, you can use vtkWindowToImageFilter.. that'll turn 
> the screen display into a 2d vtkImageData object that you can pass to other 
> VTK filters (or in my case, vtkPNGWriter).
> 
> http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html
> 
> 
> 
> On 6/8/05, Renaud Isabelle <renauisa at yahoo.fr> wrote: 
> > 
> > I'm got really *crazy*. I don't manage to use *double buffering* in 
> > order to *avoid flickering* on screen.
> >  I'm using *ImageSliceViewer* *to render a 2D slice of my 3D image on 
> > screen*. It works well without double buffering except for flickering on 
> > screen.
> >  I have already use double buffering in MFC and I have a class CMemDC 
> > that works fine to use memory buffering. 
> >  *-> All I need is a method to get the pixel data of my 2D slice 
> > displayed on screen*.Then I can use it to create a DIB Bitmap from what 
> > is rendered off screen. 
> >  I found the example of rendering in MFC and I tried the series of 
> > instructions:
> >  *this->window->SetupMemoryRendering(x,y,hdc);*
> > *this->window->Render();*
> > *StretchBlt(dc,0,0,x,y,memDC,0,0,x,y,SRCCOPY);*
> > *this->window->ResumeScreenRendering();*
> >  but all is displayed is a *white *page. Especially because during 
> > process, *unsigned char* MemoryData* should be NULL.
> >  Please help me. 
> >    
> > ------------------------------
> > Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos 
> > mails, photos et vidéos !
> > Créez votre Yahoo! Mail<http://us.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_1go/default/*http://fr.promotions.yahoo.com/mail/creer28.html> 
> > 
> > 
> > _______________________________________________
> > 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 
> > 
> > 
> > 
> 
> 
> -- 
> Randall Hand
> http://www.yeraze.com 
> 
> ------------------------------
> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos 
> mails, photos et vidéos !
> Créez votre Yahoo! Mail<http://us.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_1go/default/*http://fr.promotions.yahoo.com/mail/creer28.html> 
> 
> 


-- 
Randall Hand
http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050608/5b868f21/attachment.htm>


More information about the vtkusers mailing list