<div>Hey David,</div><div><br></div><div>Thank a Lot will try at Weekend.</div><div><br></div><div>Best regards</div><div>Cetin<br><br>Von meinem iPhone gesendet</div><div><br>Am 07.11.2011 um 20:44 schrieb "David Cole [via VTK]" <<a href="/user/SendEmail.jtp?type=node&node=4978965&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>>:<br><br></div><div></div><blockquote type="cite"><div>
Add:
<br><br> fi.Update();
<br><br>before the call to GetOutput. Without it, the output is not properly
<br>populated, and the width and height come back as "-1" which we use as
<br>array indices internal to the "ToBitmap" method, ... which is where
<br>the invalid argument exception comes from.
<br><br>If you call Update before GetOutput, all should be well, and you
<br>should get a bitmap back.
<br><br>(Sorry for the delayed response, by the way... Hopefully, later is
<br>better than never...)
<br><br><br>Cheers,
<br>David C.
<br><br><br>On Sun, Sep 18, 2011 at 3:34 PM, cakbulut <<a href="/user/SendEmail.jtp?type=node&node=4972221&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:
<div class="shrinkable-quote"><div class='shrinkable-quote'><br>> Hi David,
<br>>
<br>> I have tried the vtkWindowToImageFilter class, but it does not work. I do
<br>> not know where I am making a mistake. Here is my code:
<br>>
<br>> vtkDICOMImageReader reader = new vtkDICOMImageReader();
<br>>
<br>> reader.SetDirectoryName("C:\\vtkDev\\Book\\data\\SE000002");
<br>> reader.Update();
<br>>
<br>> mapper.SetInput(reader.GetOutput());
<br>>
<br>> actor = new vtkActor2D();
<br>> actor.SetMapper(mapper);
<br>>
<br>> vtkRenderer ren1 =
<br>> renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer();
<br>> vtkRenderWindow renWin = renderWindowControl1.RenderWindow;
<br>>
<br>> // Add the actors to the renderer, set the window size
<br>> //
<br>> ren1.AddViewProp(actor);
<br>> renWin.SetSize(250, 250);
<br>>
<br>> vtkWindowToImageFilter fi = new vtkWindowToImageFilter();
<br>> fi.SetInput(renderWindowControl1.RenderWindow);
<br>> vtkImageData v = fi.GetOutput();
<br>>
<br>> try
<br>> {
<br>>
<br>> Bitmap bitmap = v.ToBitmap(); *//Here I get Invalid Argument
<br>> Exception*
<br>> pictureBox1.Image = bitmap;
<br>> }
<br>> catch (Exception d)
<br>> {
<br>> MessageBox.Show(d.Message);
<br>> }
<br>>
<br>> Have you got an idea?
<br>>
<br>> Best regards
<br>> cakbulut
<br>>
<br>>
<br>> --
<br>> View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4816781.html" target="_top" rel="nofollow" link="external"><a href="http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4816781.html" target="_top" rel="nofollow" link="external">http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4816781.html</a></a><br>> Sent from the VTK - Dev mailing list archive at <a href="http://Nabble.com" target="_top" rel="nofollow" link="external">Nabble.com</a>.
<br>> _______________________________________________
<br>> Powered by <a href="http://www.kitware.com" target="_top" rel="nofollow" link="external">www.kitware.com</a>
<br>>
<br>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external"><a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external">http://www.kitware.com/opensource/opensource.html</a></a><br>>
<br>> Follow this link to subscribe/unsubscribe:
<br>> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_top" rel="nofollow" link="external"><a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_top" rel="nofollow" link="external">http://www.vtk.org/mailman/listinfo/vtk-developers</a></a><br>>
<br>>
</div>_______________________________________________
</div>Powered by <a href="http://www.kitware.com" target="_top" rel="nofollow" link="external">www.kitware.com</a>
<br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external"><a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external">http://www.kitware.com/opensource/opensource.html</a></a><br><br>Follow this link to subscribe/unsubscribe:
<br><a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_top" rel="nofollow" link="external"><a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_top" rel="nofollow" link="external">http://www.vtk.org/mailman/listinfo/vtk-developers</a></a><br><br>
<br>
<br>
<hr noshade="noshade" size="1" color="#cccccc">
<div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4972221.html" target="_top" rel="nofollow" link="external"><a href="http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4972221.html" target="_top" rel="nofollow" link="external">http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4972221.html</a></a>
</div>
<div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em">
To unsubscribe from Drawing on a vtkRenderWindow in C#/ActiViz, <a href="" target="_top" rel="nofollow" link="external">click here</a>.
</div></div></blockquote>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiViz-tp4802425p4978965.html">Re: Drawing on a vtkRenderWindow in C#/ActiViz</a><br/>
Sent from the <a href="http://vtk.1045678.n5.nabble.com/VTK-Dev-f1251487.html">VTK - Dev mailing list archive</a> at Nabble.com.<br/>