<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I don't know what is .pgm format, but for any image you could just
use vtkWindowToImageFilter, pass your renderwindow to it as input,
and then use the writer with it, e.g.:<br>
<tt><br>
</tt><tt>void savePNG(const char * filename, vtkRenderWindow * rw)</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> vtkWindowToImageFilter * w2i =
vtkWindowToImageFilter::New();</tt><tt><br>
</tt><tt> w2i->SetInput(rw); // rw is vtkRenderWindow that you
are painting into</tt><tt><br>
</tt><tt> w2i->SetInputBufferTypeToRGBA();</tt><tt><br>
</tt><tt> w2i->Update();</tt><tt><br>
</tt><tt><br>
</tt><tt> vtkPNGWriter *writer = vtkPNGWriter::New();</tt><tt><br>
</tt><tt> writer->SetInputConnection(w2i->GetOutputPort());</tt><tt><br>
</tt><tt> writer->SetFileName(filename);</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> rw->SetSize(800, 800);</tt><tt><br>
</tt><tt> rw->Render();</tt><tt><br>
</tt><tt> writer->Write();</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> w2i->Delete();</tt><tt><br>
</tt><tt> writer->Delete();</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt><br>
</tt>Cheers,<br>
Miro<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/05/2013 09:31 PM, R R wrote:<br>
</div>
<blockquote
cite="mid:1383715883.40455.YahooMailNeo@web162805.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:12pt">
<div>Hello all,</div>
<div><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style:
normal;">I have a question about how we can save the result of
volume rendering in .pgm format. I mean I have a volume from
which a 2D image is created using raycasting and is shown on
the screen. I want to save this 2D image in a .pgm file. Could
any body please give me some hint how I can do that.</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style:
normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style:
normal;">Thanks so much.</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style:
normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style:
normal;">Regards,</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style:
normal;">Rane</div>
</div>
</blockquote>
<br>
</body>
</html>