[vtk-developers] Drawing on a vtkRenderWindow in C#/ActiViz

cakbulut cakbulut at web.de
Wed Nov 9 15:12:18 EST 2011


Hey David,

Thank a Lot will try at Weekend.

Best regards
Cetin

Von meinem iPhone gesendet

Am 07.11.2011 um 20:44 schrieb "David Cole [via VTK]" <ml-node+s1045678n4972221h40 at n5.nabble.com>:

> Add: 
> 
>       fi.Update(); 
> 
> before the call to GetOutput. Without it, the output is not properly 
> populated, and the width and height come back as "-1" which we use as 
> array indices internal to the "ToBitmap" method, ... which is where 
> the invalid argument exception comes from. 
> 
> If you call Update before GetOutput, all should be well, and you 
> should get a bitmap back. 
> 
> (Sorry for the delayed response, by the way... Hopefully, later is 
> better than never...) 
> 
> 
> Cheers, 
> David C. 
> 
> 
> On Sun, Sep 18, 2011 at 3:34 PM, cakbulut <[hidden email]> wrote:
> 
> > Hi David, 
> > 
> > I have tried the vtkWindowToImageFilter class, but it does not work. I do 
> > not know where I am making a mistake. Here is my code: 
> > 
> >            vtkDICOMImageReader reader = new vtkDICOMImageReader(); 
> > 
> >            reader.SetDirectoryName("C:\\vtkDev\\Book\\data\\SE000002"); 
> >            reader.Update(); 
> > 
> >            mapper.SetInput(reader.GetOutput());
> > 
> >            actor = new vtkActor2D(); 
> >            actor.SetMapper(mapper); 
> > 
> >            vtkRenderer ren1 = 
> > renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer();
> >            vtkRenderWindow renWin = renderWindowControl1.RenderWindow; 
> > 
> >            // Add the actors to the renderer, set the window size 
> >            // 
> >            ren1.AddViewProp(actor); 
> >            renWin.SetSize(250, 250); 
> > 
> >            vtkWindowToImageFilter fi = new vtkWindowToImageFilter(); 
> >            fi.SetInput(renderWindowControl1.RenderWindow); 
> >            vtkImageData v = fi.GetOutput(); 
> > 
> >            try 
> >            { 
> > 
> >                Bitmap bitmap = v.ToBitmap(); *//Here I get Invalid Argument 
> > Exception* 
> >                pictureBox1.Image = bitmap; 
> >            } 
> >            catch (Exception d) 
> >            { 
> >                MessageBox.Show(d.Message); 
> >            } 
> > 
> > Have you got an idea? 
> > 
> > Best regards 
> > cakbulut 
> > 
> > 
> > -- 
> > View this message in context: http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4816781.html
> > Sent from the VTK - Dev mailing list archive at Nabble.com. 
> > _______________________________________________ 
> > Powered by www.kitware.com 
> > 
> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> > 
> > Follow this link to subscribe/unsubscribe: 
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> > 
> >
> _______________________________________________ 
> Powered by www.kitware.com 
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe: 
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4972221.html
> To unsubscribe from Drawing on a vtkRenderWindow in C#/ActiViz, click here. 	


--
View this message in context: http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4978965.html
Sent from the VTK - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20111109/956f1245/attachment.html>


More information about the vtk-developers mailing list